) handler = MyHandler( recv, send, orch) # Instantiate the Handler Object using the network wrappers def serveForever(): global client global client_addr while True: # Make it listen `hard` client_new, client_addr = server_socket.accept() client = client_new server_thread = Thread(target=serveForever) server_thread.daemon = True server_thread.start() #========================================================================== #============================== Shell Design part ======================== shell = ExtendableShell( handler, ignore_messages=set(['X']) # It is also the default argument in BaseShell ) shell.start() #========================================================================== # Magic!
class MyHandler(BaseHandler): def onMessage(self, stream, message): # global chunks_sent # print( "Handler: Chunks Received: %d" % chunks_sent ) chunks_sent = 0 # print( message ) pass def onChunk(self, stream, message): # global chunks_sent # if chunks_sent == 0 : # print # chunks_sent += 1logname # print( "Handler: <Chunk>" ) pass def onNotRecognised(self, stream, message): # print( "Handler: <Unrecognised>" ) pass handler = MyHandler(dummy_receive2, dummy_send2, orch2) # shell = ExtendableShell(handler, output = '/tmp/covertutils_out') # shell = ExtendableShell(handler, output='/tmp/covertutils_session1') shell = ExtendableShell(handler, output=True) shell.start(False)