命令行 nc.py -h 后 它 print 出 err err err err 想usage()
# ----nc.py---------import sys
import time
def usage():
print "BHP Net Tool"
print "Usage:kkkkkk"
sys.exit(0)
def main():
global listen
global port
global execute
global command
global upload_destination
global target
if not len(sys.argv[1:]):
print "err err err err"
try:
opts,args=getopt.getopt(sys.argv[1:],"hle:t:p:cu:", \
["help","listen","execute","target","port","command","upload"])
except getopt.GetoptError as err:
print str(err)
usage()
for o,a in opts:
if o in("-h","--help"): usage()
elif o in("-l","--listen"): print "llllllllll"
elif o in("-e","--execute"): print "eeeeeeeeee"
elif o in("-c","--commandshell"): print "cccccccccc"
elif o in("-u","--upload"): print "uuuuuuuuuu"
elif o in("-t","--target"): print "tttttttttt"
elif o in("-p","--port"): print "pppppppppp"
else:
assert False,"Unhandled Option"
#sys.argv[1:]="-h"
main()
#raw_input("\n\nPress the enter key to exit.")
time.sleep(300)
print "******************"