def josh_idea(ip): nmap = nmap3.NmapScanTechniques() json_output = nmap.nmap_syn_scan(target=ip, args=" -A -v -p-") for each_ in json_output: for dictionary in json_output.get(each_): if type(dictionary) is dict: print(dictionary.get("service"))
def scan(): """Do nmap scan and parse mac addresses.""" nmap = nmap3.NmapScanTechniques() scan_result = nmap.nmap_ping_scan(SUBNET) scan_result.pop('stats', None) scan_result.pop('runtime', None) result = {} for ip_address in scan_result: host = scan_result[ip_address] if 'macaddress' in host: mcadr = host['macaddress'] if mcadr and 'addr' in mcadr: mac = mcadr['addr'] result[mac] = ip_address return result