implemented working externAgent wrapper
[progcomp10.git] / src / link / pexpect / examples / bd_client.py
1 #!/usr/bin/env python
2
3 """This is a very simple client for the backdoor daemon. This is intended more
4 for testing rather than normal use. See bd_serv.py """
5
6 import socket
7 import sys, time, select
8
9 def 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
22 s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
23 s.connect(sys.argv[1])#(HOST, PORT))
24 time.sleep(1)
25 #s.setblocking(0)
26 #s.send('COMMAND' + '\x01' + sys.argv[1])
27 s.send(':sendline ' + sys.argv[2])
28 print recv_wrapper(s)
29 s.close()
30 sys.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

UCC git Repository :: git.ucc.asn.au