import optparse
parser=optparse.OptionParser('usage %prog -H <target ip> -p <target pot>')
parser.add_option('-H',dest='ip',type='string',help='specify target host')
parser.add_option('-p',dest='port' ,type='int' ,help='specify target port')
(options,args)=parser.parse_args()
ip=options.ip;
port=options.port
print "host : "+str(ip)
print "ip : "+str(port)
python parser.py -H 192.168.1.100 -p 21
parser=optparse.OptionParser('usage %prog -H <target ip> -p <target pot>')
parser.add_option('-H',dest='ip',type='string',help='specify target host')
parser.add_option('-p',dest='port' ,type='int' ,help='specify target port')
(options,args)=parser.parse_args()
ip=options.ip;
port=options.port
print "host : "+str(ip)
print "ip : "+str(port)
important points:
dest:= like as variable in which our value save.
type:= which type of value we can save (dest='')
OUTPUT:
save this program parser.py name
then open cmd go to the directory where you save this program and then type: