Stanley LEsniak
Stanley LEsniak

Reputation: 59

python-nmap exporting data like -oA in nmap

Is there a way to output the files in python-nmap like using the -oA option in nmap cli? I can run the nmap scanner no problem, but the output comes out in a dict. i wanted to be able to output all 3 formats automatically

Upvotes: 0

Views: 176

Answers (1)

Farshad Sarmali
Farshad Sarmali

Reputation: 328

you can use subprocess for run command and run nmap tools

import subprocess as sub
sub.run(["nmap", "-oA", "/pathFiles/filename with out suffix", "127.0.0.1/32"], shell=True)

for pars xml data: ( or see this pars nmap data )

import nmap
nm = nmap.PortScanner()
nm.analyse_nmap_xml_scan("xmlData")

I see this python-nmap but in code you can't use -oA because in code :

enter image description here

Upvotes: 1

Related Questions