Skip to content

Commit 672bf41

Browse files
committed
Fixes issue #30 now parses mac address
1 parent 1c2eb39 commit 672bf41

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

nmap3/nmap3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,6 @@ class NmapScripts(Nmap):
511511
parser.add_argument('-d', '--d', help='Help', required=True)
512512
args = parser.parse_args()
513513

514-
nmap = Nmap()
515-
result = nmap.nmap_version_detection(args.d)
514+
nmap = NmapHostDiscovery()
515+
result = nmap.nmap_no_portscan(args.d)
516516
print(json.dumps(result, indent=4, sort_keys=True))

nmap3/nmapparser.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,27 @@ def parse_noportscan(self, xmlroot):
238238
# Find all hosts
239239
all_hosts = xmlroot.findall("host")
240240
for host in all_hosts:
241-
242241
host_record = {}
242+
address = []
243+
hostnames = []
244+
243245
if host.find("status") is not None:
244246
for key in host.find("status").attrib:
245247
host_record[key]=host.find("status").attrib.get(key)
246248

247249
for key in host.find("address").attrib:
248250
host_record[key]=host.find("address").attrib.get(key)
249-
251+
252+
for key in host.findall("address"):
253+
address.append(key.attrib)
254+
host_record["addresses"]=address
255+
256+
for hostname in host.find("hostnames"):
257+
for hosts in hostname.findall("hostname"):
258+
hostnames.append(hosts.attrib)
259+
260+
host_record["hostnames"]=hostnames
261+
250262
hosts_list.append(host_record)
251263

252264
runstats = xmlroot.find("runstats")

0 commit comments

Comments
 (0)