#!/usr/bin/env python
from socket import *
from struct import *
from optparse import OptionParser
def main(hostname,port):
s = socket(AF_INET,SOCK_STREAM)
s.connect((hostname,port))
rec = s.recv(1024)
print rec
index1 = rec.find("'")+1
index2 = rec.rfind("'")
print rec[index1:index2]
num = int(rec[index1:index2])
s.send(pack("<I",num))
rec = s.recv(1024)
print rec
if __name__=="__main__":
parse = OptionParser("usage: %prog [options]")
parse.add_option("-H",dest="hostname",default="127.0.0.1",type="string",help="The ip of the target")
parse.add_option("-P",dest="port",default=2999,type="int",help="The port of the host")
(options,args)=parse.parse_args()
main(options.hostname,options.port)