# HG changeset patch # User osimons # Date 1250852383 0 # Node ID 67ff41922acf1acf18f3643be13a58537f2a43e4 # Parent df849161d68369b96b61b540963f2e728ca6cf70 0.6dev: Removing a leftover beep proxy script that is no longer used or needed. diff --git a/scripts/proxy.py b/scripts/proxy.py deleted file mode 100644 --- a/scripts/proxy.py +++ /dev/null @@ -1,93 +0,0 @@ -# Based on the proxy module from the Medusa project -# Used for inspecting the communication between two BEEP peers - -import asynchat -import asyncore -import socket -import sys - - -class proxy_server(asyncore.dispatcher): - - def __init__(self, host, port): - asyncore.dispatcher.__init__ (self) - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self.set_reuse_addr() - self.there = (host, port) - here = ('', port + 1) - self.bind(here) - self.listen(5) - - def handle_accept(self): - proxy_receiver(self, self.accept()) - - -class proxy_sender(asynchat.async_chat): - - def __init__(self, receiver, address): - asynchat.async_chat.__init__(self) - self.receiver = receiver - self.set_terminator(None) - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self.buffer = '' - self.set_terminator('\r\n') - self.connect(address) - print 'L:', '' - - def handle_connect(self): - print 'L:', '' - - def collect_incoming_data(self, data): - self.buffer = self.buffer + data - - def found_terminator(self): - data = self.buffer - self.buffer = '' - for line in data.splitlines(): - print 'L:', '\x1b[35m' + line + '\x1b[0m' - self.receiver.push(data + '\r\n') - - def handle_close(self): - self.receiver.close() - self.close() - - -class proxy_receiver(asynchat.async_chat): - - channel_counter = 0 - - def __init__(self, server, (conn, addr)): - asynchat.async_chat.__init__(self, conn) - self.set_terminator('\r\n') - self.server = server - self.id = self.channel_counter - self.channel_counter = self.channel_counter + 1 - self.sender = proxy_sender (self, server.there) - self.sender.id = self.id - self.buffer = '' - - def collect_incoming_data (self, data): - self.buffer = self.buffer + data - - def found_terminator(self): - data = self.buffer - self.buffer = '' - for line in data.splitlines(): - print 'I:', '\x1b[34m' + line + '\x1b[0m' - self.sender.push (data + '\r\n') - - def handle_connect(self): - print 'I:', '' - - def handle_close(self): - print 'I:', '' - self.sender.close() - self.close() - - -if __name__ == '__main__': - if len(sys.argv) < 3: - print 'Usage: %s ' % sys.argv[0] - else: - ps = proxy_server(sys.argv[1], int(sys.argv[2])) - asyncore.loop()