Exemplo n.º 1
0
from TcpRequest import TcpRequest
import sys
import subprocess
import resource
import re


icmp = IcmpRequest()
tcp = TcpRequest()
resource.setrlimit(resource.RLIMIT_NOFILE, (65536, 65536))

if sys.argv[1] == '-network':
    ip = sys.argv[3]
    mask = sys.argv[5]
    available_hosts = Hosts(ip, mask)
    hosts = available_hosts.get_available_hosts()

    alive_hosts = []

    for host in hosts:
        verify = icmp.verbose_ping(str(host), 0.125, 1)
        if verify is not None:
            alive_hosts.append(verify)

    info_host = []

    for host in alive_hosts:
        ports = tcp.scan_ports(host[0], host[1])
        info_host.append((host[0], host[1], ports))

    with open("data.json", "a") as f: