Exemplo n.º 1
0
def options():
    start_time = time.time()
    parser = argparse.ArgumentParser(description='Vxscan V2.0')
    parser.add_argument("-u",
                        "--url",
                        help='Start scanning url -u xxx.com or -u url1,url2')
    parser.add_argument("-f", "--file", help='read the url from the file')
    parser.add_argument("-s", "--save", help='save in dbfile')
    parser.add_argument("-i", "--inet", help='cidr eg. 1.1.1.1 or 1.1.1.0/24')
    args = parser.parse_args()
    if args.save:
        dbname = args.save
    else:
        dbname = 'result'
    if args.inet:
        inet(args.inet, dbname)
    if args.url:
        start_out(args.url)
        if ActiveCheck([args.url]).pool():
            start(args.url, dbname)
    if args.file:
        read_file(args.file, dbname)
    end_time = time.time()
    if args.file or args.url or args.inet:
        gener()
        print('\nrunning {0:.3f} seconds...'.format(end_time - start_time))
    else:
        print('No scan url, Please start scanning with -u or -f')
Exemplo n.º 2
0
def read_file(file):
    hosts = []
    with open(file, 'rt') as f:
        for ip in f.readlines():
            hosts.append(ip.strip())
    start_out(hosts)
    hosts2 = ActiveCheck(hosts).pool()
    for i in hosts2:
        start(i)
Exemplo n.º 3
0
def inet(net, dbname):
    hosts = []
    try:
        result = list(ipaddress.ip_network(net).hosts())
        for ip in result:
            hosts.append(str(ip))
        start_out(hosts)
    except Exception as e:
        print("The task could not be carried out. {}".format(str(e)))
    hosts2 = ActiveCheck(hosts).pool()
    for i in hosts2:
        start(i, dbname)
Exemplo n.º 4
0
def read_file(file, dbname):
    hosts = []
    try:
        with open(file, 'rt') as f:
            for ip in f.readlines():
                hosts.append(ip.strip())
        start_out(hosts)
        hosts2 = ActiveCheck(hosts).pool()
        for i in hosts2:
            start(i, dbname)
    except FileNotFoundError:
        print('input file')
    except Exception as e:
        logging.exception(e)
Exemplo n.º 5
0
 def pool(self, hosts):
     task = []
     # 通过socket与ping命令验证ip存活与域名解析
     hosts2 = ActiveCheck(hosts).pool()
     try:
         for host in hosts2:
             host = host.strip('/')
             if not re.search('http://|https://', host):
                 host = 'http://' + host
             name, wafresult = start(host)
             self.waf.append(name)
             if wafresult != 'NoWAF':
                 continue
             if not SKIP:
                 proto = self.get_proto(name)
                 for i in proto:
                     urls = self.get_urls(i)
                     for url in urls:
                         task.append(i + url)
         if task:
             self.run(task)
         self.save(self.outjson)
     except Exception as e:
         logging.exception(e)