コード例 #1
0
ファイル: nmap_extract.py プロジェクト: 5l1v3r1/scripts-43
def print_report(files):
    print('##############')
    print('# LIVE HOSTS #')
    print('##############')
    print('')
    hosts = nmap.parse_hosts(files, True)
    for host in hosts:
        print(host)

    print('')
    print('###################')
    print('# UNIQUE SERVICES #')
    print('###################')
    print('')
    services = nmap.parse_unique_services(files)
    for service in services:
        print(service)

    print('')
    print('############')
    print('# SERVICES #')
    print('############')
    print('')
    for service in services:
        print("== %s ==" % service)
        found = nmap.parse_service(files, service)
        for host in found:
            print(host)
        print('')
コード例 #2
0
ファイル: nmap_extract.py プロジェクト: 5l1v3r1/scripts-43
def dump_data(files, path):
    hosts_path = path + "/hosts"
    os.mkdir(hosts_path)
    services_path = path + "/services"
    os.mkdir(services_path)

    hosts = nmap.parse_hosts(files, True)
    with open(path + "/hosts.txt", 'w') as f:
        for host in hosts:
            f.write(host + '\n')

    for host in hosts:
        with open(hosts_path + "/" + host + ".txt", 'w') as f:
            found = nmap.parse_ports_for_address(files, host)
            for port in found:
                f.write(port + '\n')

    services = nmap.parse_unique_services(files)
    with open(path + "/services.txt", 'w') as f:
        for service in services:
            f.write(service + '\n')

    for service in services:
        with open(services_path + "/" + service.replace('/', '_') + ".txt",
                  'w') as f:
            found = nmap.parse_service(files, service)
            for host in found:
                f.write(host + '\n')
コード例 #3
0
ファイル: nmap_extract.py プロジェクト: sidaf/scripts
def dump_data(files, path):
    hosts_path = path + "/hosts"
    os.mkdir(hosts_path)
    services_path = path + "/services"
    os.mkdir(services_path)

    hosts = nmap.parse_hosts(files, True)
    with open(path + "/hosts.txt", 'w') as f:
        for host in hosts:
            f.write(host + '\n')

    for host in hosts:
        with open(hosts_path + "/" + host + ".txt", 'w') as f:
            found = nmap.parse_ports_for_address(files, host)
            for port in found:
                f.write(port + '\n')

    services = nmap.parse_unique_services(files)
    with open(path + "/services.txt", 'w') as f:
        for service in services:
            f.write(service + '\n')

    for service in services:
        with open(services_path + "/" + service.replace('/', '_') + ".txt",
                  'w') as f:
            found = nmap.parse_service(files, service)
            for host in found:
                f.write(host + '\n')
コード例 #4
0
ファイル: nmap_extract.py プロジェクト: sidaf/scripts
def print_report(files):
    print('##############')
    print('# LIVE HOSTS #')
    print('##############')
    print('')
    hosts = nmap.parse_hosts(files, True)
    for host in hosts:
        print(host)

    print('')
    print('###################')
    print('# UNIQUE SERVICES #')
    print('###################')
    print('')
    services = nmap.parse_unique_services(files)
    for service in services:
        print(service)

    print('')
    print('############')
    print('# SERVICES #')
    print('############')
    print('')
    for service in services:
        print("== %s ==" % service)
        found = nmap.parse_service(files, service)
        for host in found:
            print(host)
        print('')
コード例 #5
0
ファイル: nmap_rescan.py プロジェクト: sidaf/scripts
def scan_hosts(files):
    info("Parsing nmap xml file(s) ...")
    hosts = nmap.parse_hosts(files, True)
    info("Starting scans ...")
    for host in tqdm(hosts, leave=True):
        ports = set()
        found = nmap.parse_ports_for_address(files, host)
        for port in found:
            ports.add(port.split('/', 1)[0])
        print("sudo nmap -v -Pn -sS -sV --version-intensity 9 -O --script=default --traceroute -T4 -p T:%s --initial-rtt-timeout=200ms --min-rtt-timeout=100ms --max-rtt-timeout=$maxrtt --defeat-rst-ratelimit --open --stats-every 15s -oA tcp_%s %s" % (ports, host, host))
コード例 #6
0
def scan_hosts(files):
    info("Parsing nmap xml file(s) ...")
    hosts = nmap.parse_hosts(files, True)
    info("Starting scans ...")
    for host in tqdm(hosts, leave=True):
        ports = set()
        found = nmap.parse_ports_for_address(files, host)
        for port in found:
            ports.add(port.split('/', 1)[0])
        print(
            "sudo nmap -v -Pn -sS -sV --version-intensity 9 -O --script=default --traceroute -T4 -p T:%s --initial-rtt-timeout=200ms --min-rtt-timeout=100ms --max-rtt-timeout=$maxrtt --defeat-rst-ratelimit --open --stats-every 15s -oA tcp_%s %s"
            % (ports, host, host))
コード例 #7
0
def scan_hosts(url,
               username,
               password,
               files,
               max_concurrent_scans,
               path,
               verify=True):
    scanner = nessus.Scanner(url, username, password, verify)
    info("Connecting to nessus server at {0} ...".format(url))
    scanner.login()
    info("Parsing nmap xml file(s) ...")
    hosts = nmap.parse_hosts(files, True)
    scans = list()
    info("Starting scans ...")
    for host in tqdm(hosts, leave=True):
        ports = set()
        found = nmap.parse_ports_for_address(files, host)
        for port in found:
            ports.add(port.split('/', 1)[0])

        while len(scans) >= max_concurrent_scans:
            check_scans(scanner, scans, path)
            if len(scans) < max_concurrent_scans:
                break
            time.sleep(20)

        scan_id = scanner.create_scan(host, host, ','.join(sorted(ports)))
        scanner.start_scan(scan_id)
        scans.append(scan_id)

    print("\n[+] Waiting for scans to finish ...")
    last = 0
    while len(scans) > 0:
        check_scans(scanner, scans, path)
        if len(scans) == 0:
            break
        if len(scans) != last:
            print("[+] {0} scan(s) left ...".format(len(scans)))
            last = len(scans)
        time.sleep(20)
    print("[+] Finished.")
コード例 #8
0
ファイル: nmap_nessus.py プロジェクト: sidaf/scripts
def scan_hosts(url, username, password, files,
               max_concurrent_scans, path, verify=True):
    scanner = nessus.Scanner(url, username, password, verify)
    info("Connecting to nessus server at {0} ...".format(url))
    scanner.login()
    info("Parsing nmap xml file(s) ...")
    hosts = nmap.parse_hosts(files, True)
    scans = list()
    info("Starting scans ...")
    for host in tqdm(hosts, leave=True):
        ports = set()
        found = nmap.parse_ports_for_address(files, host)
        for port in found:
            ports.add(port.split('/', 1)[0])

        while len(scans) >= max_concurrent_scans:
            check_scans(scanner, scans, path)
            if len(scans) < max_concurrent_scans:
                break
            time.sleep(20)

        scan_id = scanner.create_scan(host, host, ','.join(sorted(ports)))
        scanner.start_scan(scan_id)
        scans.append(scan_id)

    print("\n[+] Waiting for scans to finish ...")
    last = 0
    while len(scans) > 0:
        check_scans(scanner, scans, path)
        if len(scans) == 0:
            break
        if len(scans) != last:
            print("[+] {0} scan(s) left ...".format(len(scans)))
            last = len(scans)
        time.sleep(20)
    print("[+] Finished.")