mirror of https://github.com/nealey/firebot
Merge branch 'master' of /home/neale/public_html/repos/firebot
This commit is contained in:
commit
08802c0c55
14
arsenic.py
14
arsenic.py
|
@ -11,6 +11,10 @@ import os
|
|||
import time
|
||||
import socket
|
||||
import rp
|
||||
import random
|
||||
import webretriever
|
||||
|
||||
webretriever.proxy = ('proxyout.lanl.gov', 8080)
|
||||
|
||||
def esc(arg):
|
||||
return "'" + arg.replace("'", r"'\''") + "'"
|
||||
|
@ -72,6 +76,16 @@ class Arsenic(firebot.FireBot, ProcBot):
|
|||
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)
|
||||
|
||||
##
|
||||
|
|
|
@ -7,23 +7,30 @@ import socket
|
|||
|
||||
resolver = adns.init()
|
||||
|
||||
proxy = None
|
||||
|
||||
class WebRetriever(asynchat.async_chat):
|
||||
def __init__(self, url, body_cb):
|
||||
asynchat.async_chat.__init__(self)
|
||||
self.body_cb = body_cb
|
||||
self.url = url
|
||||
(self.scheme,
|
||||
self.netloc,
|
||||
self.path,
|
||||
self.query,
|
||||
self.fragment) = urlparse.urlsplit(url)
|
||||
assert self.scheme == 'http'
|
||||
try:
|
||||
self.host, port = self.netloc.split(':')
|
||||
self.port = int(port)
|
||||
except ValueError:
|
||||
self.host = self.netloc
|
||||
self.port = 80
|
||||
if proxy:
|
||||
self.host, self.port = proxy
|
||||
self.query = ''
|
||||
self.fragment = ''
|
||||
self.path = url
|
||||
else:
|
||||
(self.scheme,
|
||||
self.netloc,
|
||||
self.path,
|
||||
self.query,
|
||||
self.fragment) = urlparse.urlsplit(url)
|
||||
assert self.scheme == 'http'
|
||||
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.in_headers = True
|
||||
self.inbuf = ''
|
||||
|
|
Loading…
Reference in New Issue