Пример #1
0
def parse_args():
    from optparse import OptionParser
    parser = OptionParser()
    parser.add_option("--twitter-email", dest="twitter_email",
                      help="Registered twitter email", metavar="TWITTER EMAIL")
    parser.add_option("--twitter-pass", dest="twitter_pass",
                      help="Registered twitter pass", metavar="TWITTER PASS")
    parser.add_option("--google-email", dest="google_email",
                      help="Registered google email", metavar="GOOGLE EMAIL")
    parser.add_option("--google-pass", dest="google_pass",
                      help="Registered google pass", metavar="GOOGLE PASS")
#    parser.add_option("--secure", dest="secure", action="store_true",
#                      help="Use secure connection")
    parser.add_option("--offset", dest="offset", type="int", default=0,
                      help="Skip first OFFSET usernames", metavar="OFFSET")
    parser.add_option("-n", "--test", dest="test", action="store_true",
                      help="Test run.")
    parser.add_help_option = False
    
    (option, args) = parser.parse_args()

    if args and not (hasattr(option, 'action') and options.action == 'help'):
        option.action = args[0]

    if not hasattr(option, 'action'):
        option.action = 'help'

    option.extra_args = args[1:]    

    if option.action == 'mention':
        option.extra_args.insert(0, '@%s')
    elif option.action == 'dm':
        option.extra_args.insert(0, 'D %s')
    else:
        print_help()
        sys.exit(0)

    return option, args
Пример #2
0
		parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
						  help="Enable additional details in the output.", default=False)
		
		everything = OptionGroup(
			parser, 'XML Options',
			'This is a seperate group to only parse xml files and output all results to a csv file.')
		everything.add_option("-e", "--everything", action="store_true", dest="everything",
						  help="The option to parse everything in from the nmap xml file", default=False)
		everything.add_option("-x", "--xml", dest="xmlfile",
						  help="XML file to parse")
		everything.add_option("-o", "--output", dest="output",
						  help="Destination you want the output to be.")
		parser.add_option_group(everything)				
		
		nmap = OptionGroup(
			parser, 'Nmap file options',
			'These are the options used only for .nmap files.')
		nmap.add_option("-n", "--hostnames", action="store_true", dest="hostnames",
						  help="Search target path for hostname, ip", default=False)
		nmap.add_option("--online", action="store_true", dest="online",
						  help="This will only look for hosts that were online", default=False)
		nmap.add_option("--offline", action="store_true", dest="offline",
						  help="This will only look for hosts that were offline", default=False)
		nmap.add_option("-a", "--all", action="store_true", dest="all",
						  help="This will look for all hosts in the target path. This is default.", default=False)
		nmap.add_option("-f", "--filename",  dest="filename",
						  help="Filename.nmap to parse through")
		parser.add_option_group(nmap)
		
		parser.add_help_option = True
		threads = []		
Пример #3
0
                        default=False)
        nmap.add_option(
            "-a",
            "--all",
            action="store_true",
            dest="all",
            help=
            "This will look for all hosts in the target path. This is default.",
            default=False)
        nmap.add_option("-f",
                        "--filename",
                        dest="filename",
                        help="Filename.nmap to parse through")
        parser.add_option_group(nmap)

        parser.add_help_option = True
        threads = []
        (options, args) = parser.parse_args()
        tNum = 0
        dir = options.directory

        #Checking to see if the user put in arguments that cannot be combined.
        if (options.online and options.offline):
            parser.error("options -online and -offline are mutually exclusive")
        elif (options.online and options.all):
            parser.error("options -online and -all are mutually exclusive")
        elif (options.offline and options.all):
            parser.error("options -offline and -all are mutually exclusive")
        elif (dir == None and options.recursive):
            parser.error(
                "You need a directory if you are going to recursively search through one."