def __init__(self, tcp_pac, outputfile): self.source_ip = tcp_pac.source self.source_port = tcp_pac.source_port self.dest_ip = tcp_pac.dest self.dest_port = tcp_pac.dest_port self.status = HttpConn.STATUS_BEGIN self.outputfile = outputfile self.queue = Queue() self.buf = StringIO.StringIO() # start parser thread self.parser_worker = parse_http_data(self.queue, self.buf, (self.source_ip, self.source_port), (self.dest_ip, self.dest_port), parse_config) self.append(tcp_pac)
def _worker(workersocket, clientip, clientport, outputfile): try: buf = StringIO() queue = Queue() handler = ConnectionHandler(workersocket, queue) handler.init_connect() parser_worker = parse_http_data(queue, buf, (clientip, clientport), handler.remote_host, parse_config) handler.proxy_data() handler.close() parser_worker.join() outputfile.write(buf.getvalue()) outputfile.flush() except Exception: import traceback traceback.print_exc()
def __init__(self, tcp_pac, outputfile): self.source_ip = tcp_pac.source self.source_port = tcp_pac.source_port self.dest_ip = tcp_pac.dest self.dest_port = tcp_pac.dest_port self.status = HttpConn.STATUS_BEGIN self.outputfile = outputfile self.queue = Queue() self.buf = StringIO.StringIO() # start parser thread self.parser_worker = parse_http_data( self.queue, self.buf, (self.source_ip, self.source_port), (self.dest_ip, self.dest_port), parse_config) self.append(tcp_pac)