Merge branch 'master' of /home/neale/public_html/repos/firebot

This commit is contained in:
Neale Pickett 2008-10-08 10:14:38 -06:00
commit 08802c0c55
2 changed files with 34 additions and 13 deletions

View File

@ -11,6 +11,10 @@ import os
import time import time
import socket import socket
import rp import rp
import random
import webretriever
webretriever.proxy = ('proxyout.lanl.gov', 8080)
def esc(arg): def esc(arg):
return "'" + arg.replace("'", r"'\''") + "'" return "'" + arg.replace("'", r"'\''") + "'"
@ -72,6 +76,16 @@ class Arsenic(firebot.FireBot, ProcBot):
lag)) lag))
def pii(self, sender, forum, addl, match):
ssns = []
for i in range(10):
ssns.append('%03d-%02d-%04d' % (random.randint(1, 999),
random.randint(1, 99),
random.randint(1, 9999)))
forum.msg('Security incident! %s' % ' '.join(ssns))
bindings.append((re.compile(r'^pii$'),
pii))
bindings.extend(firebot.FireBot.bindings) bindings.extend(firebot.FireBot.bindings)
## ##

View File

@ -7,23 +7,30 @@ import socket
resolver = adns.init() resolver = adns.init()
proxy = None
class WebRetriever(asynchat.async_chat): class WebRetriever(asynchat.async_chat):
def __init__(self, url, body_cb): def __init__(self, url, body_cb):
asynchat.async_chat.__init__(self) asynchat.async_chat.__init__(self)
self.body_cb = body_cb self.body_cb = body_cb
self.url = url if proxy:
(self.scheme, self.host, self.port = proxy
self.netloc, self.query = ''
self.path, self.fragment = ''
self.query, self.path = url
self.fragment) = urlparse.urlsplit(url) else:
assert self.scheme == 'http' (self.scheme,
try: self.netloc,
self.host, port = self.netloc.split(':') self.path,
self.port = int(port) self.query,
except ValueError: self.fragment) = urlparse.urlsplit(url)
self.host = self.netloc assert self.scheme == 'http'
self.port = 80 try:
self.host, port = self.netloc.split(':')
self.port = int(port)
except ValueError:
self.host = self.netloc
self.port = 80
self.set_terminator('\n') self.set_terminator('\n')
self.in_headers = True self.in_headers = True
self.inbuf = '' self.inbuf = ''