1#!/usr/bin/env python 2 3"""This is a very simple client for the backdoor daemon. This is intended more 4for testing rather than normal use. See bd_serv.py """ 5 6import socket 7import sys, time, select 8 9def recv_wrapper(s): 10 r,w,e = select.select([s.fileno()],[],[], 2) 11 if not r: 12 return '' 13 #cols = int(s.recv(4)) 14 #rows = int(s.recv(4)) 15 cols = 80 16 rows = 24 17 packet_size = cols * rows * 2 # double it for good measure 18 return s.recv(packet_size) 19 20#HOST = '' #'localhost' # The remote host 21#PORT = 1664 # The same port as used by the server 22s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) 23s.connect(sys.argv[1])#(HOST, PORT)) 24time.sleep(1) 25#s.setblocking(0) 26#s.send('COMMAND' + '\x01' + sys.argv[1]) 27s.send(':sendline ' + sys.argv[2]) 28print recv_wrapper(s) 29s.close() 30sys.exit() 31#while True: 32# data = recv_wrapper(s) 33# if data == '': 34# break 35# sys.stdout.write (data) 36# sys.stdout.flush() 37#s.close() 38 39