tknv

argv, cannot push, keep here

Jul 11th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. # obtain target IP and options
  2. visualize = ''
  3. target_ip = ''
  4. def usage():
  5.     print '-h for help'
  6.     print '-t for target IP'
  7.  
  8. try:
  9.     opts, args = getopt.getopt(sys.argv[1:], "ht:vd", ["help", "targetip=", "visualize", "debug"])
  10. except getopt.GetoptError:
  11.     usage()
  12.         print 'err'
  13.     sys.exit(2)
  14. for opt, arg in opts:
  15.     if opt in ("-h", "--help"):
  16.         usage()
  17.                 print 'help help'
  18.         sys.exit()
  19.     elif opt in ("-t", "--targetip"):
  20.         target_ip = arg
  21.     elif opt in ('-v', '--visualize'):
  22.         visualize = True
  23.     elif opt in ('-d', '--debug'):
  24.         global _debug
  25.         _debug = 1
  26. if visualize:
  27.     print 'visualize'
  28. else:
  29.     print 'no v'
  30. if target_ip == '':
  31.     print 'Shall we indicate target AP or Ctrllr IP'
  32.     sys.exit()
  33. else:
  34.     print target_ip
Advertisement
Add Comment
Please, Sign In to add comment