예제 #1
0
def dns(target):
    from socket import gethostbyname
    from nmap3 import Nmap , NmapScanTechniques
    nmap = Nmap()
    ip_addr = gethostbyname(target)
    subdomains = nmap.nmap_dns_brute_script(target)
    return(ip_addr, subdomains)
예제 #2
0
 def __init__(self, ip):
     self.ip = ip
     self.is_iot = None
     self.__nmap = Nmap()
     self.__device_vendor = set()
     self.__device_type = set()
     self.__device_os_family = set()
     self.__device_os_name = set()
     self.__device_mac = None
     self.__device_mac_vendor = None
     self.__ports_to_scan = ports_to_scan
예제 #3
0
 def analyze(self):
     self.exposed_services = []
     nmap = Nmap()
     results = nmap.nmap_version_detection(self.ip, args="-Pn")
     for r in results:
         if 'service' in r:
             service_info = r['service']
             if 'product' in service_info:
                 service = service_info['product']
                 if 'version' in service_info:
                     service += " " + service_info['version']
                 self.exposed_services.append(service)
예제 #4
0
 def run(self):
     from nmap3 import Nmap
     from nmap3.exceptions import NmapNotInstalledError
     try:
         result = Nmap().nmap_os_detection(self.__dict__["host"])
         print(dumps(result, indent=2))
         if self.__dict__["to_file"].strip().lower() == "true":
             with open(f"{self.__dict__['host']}_os_detection.json",
                       "w") as fd:
                 fd.write(dumps(result, indent=4))
                 print("[**]::nmap results written to file")
     except NmapNotInstalledError:
         print("[!!]::Nmap must be intstalled in order to use Nmap modules")
         return
예제 #5
0
def scan_top_ports(domains):
    nmap = Nmap()
    print(Fore.WHITE +
          "\n====================================================")
    print(Fore.WHITE + "     Scna top ports                                 |")
    print(Fore.WHITE +
          "====================================================\n")
    print(Fore.WHITE + 'It is working, wait ....\n')
    print('-' * 47)
    try:
        for domain in domains:
            results = nmap.scan_top_ports(domain)
            for res in results[list(results)[0]]['ports']:
                print(Fore.WHITE + "[*] [ {} ]  {}-{} --- >  {} ".format(
                    domain, res['portid'], res['protocol'], res['state']))
            print('-' * 47)
    except:
        print('eroor')
예제 #6
0
def web_service(target):
    from nmap3 import Nmap
    nmap = Nmap()
    version_result = nmap.nmap_version_detection(target)
    return(version_result)
예제 #7
0
 def __init__(self, host, disablePing=False):
     # print("[+] Starting nmap scan...")
     self.host = host
     self.disablePing = disablePing
     self.nmap = Nmap()