def main():
    parser = argparse.ArgumentParser(
        add_help=False,
        usage='%(prog)s --help',
        formatter_class=argparse.RawTextHelpFormatter,
        epilog='''
Examples:
\tpython %(prog)s host_list.txt cgi_list.txt
\tpython %(prog)s host_list.txt cgi_list.txt -a 1 2 3 -e 2 -w results.csv --proto https -t 10
        '''
    )
    parser.add_argument('hostlist_file', help='\t\tFile of 1 host[:port] per line', metavar='<host_file>')
    parser.add_argument('cgilist_file', help='\t\tFile of 1 cgi per line', metavar='<cgi_file>')
    parser.add_argument('--proto', dest='proto', help='\t\tForce protocol', metavar='http|https')
    parser.add_argument('-t','--threads', dest='threads', help='\t\tSet number of threads', metavar='', type=int, default=THREADS_DEFAULT)
    parser.add_argument('-w','--write', dest='output', help='\t\tWrite CSV file with the results', metavar='<csv>')
    parser.add_argument('-a','--attacks', dest='attacks', help='\t\tSet attacks to test:\n\t\t\t1:Sleep test\n\t\t\t2:Ping local test\n\t\t\t3:String return test\n\t\t\tDefault: [1,2]', metavar='', type=int, nargs='+', default=[1,2])
    parser.add_argument('-e','--exploit_type', dest='exploit', help='\t\tSet exploit payload (1 or 2)', metavar='', type=int, default=2)
    parser.add_argument('-p','--proxy', dest='proxy', help='\t\tSet HTTP proxy', metavar='<host:port>', type=str)
    parser.add_argument('-h', '--help', action='help', help='\t\tPrint this help message then exit')
    options = parser.parse_args()
    hostlist_file = options.hostlist_file
    cgilist_file = options.cgilist_file
    proto = options.proto
    threads = options.threads
    output = options.output
    attacks = options.attacks
    proxy = options.proxy

    global ATTACKS
    ATTACKS = attacks

    global EXPLOIT
    if options.exploit == 1:
        EXPLOIT=EXPLOIT1
    elif options.exploit == 2:
        EXPLOIT=EXPLOIT2

    global concurrent
    concurrent = threads

    global protocol
    protocol = proto

    global PROXY
    if proxy:
        PROXY = proxy
    
    target_list = [line.strip() for line in open(hostlist_file).readlines() if len(line.strip())>0]
    cgi_list = [line.strip() for line in open(cgilist_file).readlines() if len(line.strip())>0]
    

    print "Scanning %s hosts with %s CGIs using %s Threads" %(len(target_list),len(cgi_list), threads)
    print "Attacks chosen: %s. Exploit payload: %s" %(ATTACKS, EXPLOIT % 'command')
    if proxy:
        print "Using proxy: %s" %PROXY
    if protocol:
        print "Forced protocol: %s" %protocol
    

    scan(target_list, cgi_list)

    if output is not None:
        writeCSV(target_results, output) 
    exit(0)
dataset/ETHPy150Open gry/shellshock-scanner/shellshock_scanner.py/main/original