Add HTTP proxy stuff

This commit is contained in:
Neale Pickett 2008-09-05 09:30:00 -06:00
parent 6ef32e3368
commit ff7fa92750
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,11 +7,18 @@ 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.host, self.port = proxy
self.query = ''
self.fragment = ''
self.path = url
else:
(self.scheme, (self.scheme,
self.netloc, self.netloc,
self.path, self.path,