nmap-parse-output icon indicating copy to clipboard operation
nmap-parse-output copied to clipboard

not working with appended nmap results

Open DuoMorph opened this issue 6 years ago • 6 comments

command one:

nmap -p 80,445,443,21,22 -T5 --min-parallelism 16 -n --min-hostgroup 16 -Pn --append-output -oA testnmapappend --open 192.168.0.0/28

command two:

nmap -p 80,445,443,21,22 -T5 --min-parallelism 16 -n --min-hostgroup 16 -Pn --append-output -oA testnmapappend --open 192.168.0.16/28

output nmap-parse-output with result file (testnmapappend.xml):

$ nmap-parse-output testnmapappend.xml hosts
-:82: parser error : XML declaration allowed only at the start of the document
<?xml version="1.0" encoding="UTF-8"?>
     ^
-:83: parser error : Extra content at the end of the document
<!DOCTYPE nmaprun>
^
unable to parse -

DuoMorph avatar Aug 13 '19 11:08 DuoMorph

Yes, the problem is that Nmap does just append the second XML output to the first XML output which results in an invalid XML file. In this case, nmap-parse-output must split the file into multiple XML files before passing it to xsltproc. I will probably look into this with the next release.

Example output of --append-output:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE nmaprun>
<?xml-stylesheet href="file:///usr/bin/../share/nmap/nmap.xsl" type="text/xsl"?>
<!-- Nmap 7.70 scan initiated Tue Aug 13 16:19:30 2019 as: nmap -sS -p0- -oA test -&#45;privileged localhost -->
<nmaprun scanner="nmap" args="nmap -sS -p0- -oA test -&#45;privileged localhost" start="1565705970" startstr="Tue Aug 13 16:19:30 2019" version="7.70" xmloutputversion="1.04">
[...]
</nmaprun>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE nmaprun>
<?xml-stylesheet href="file:///usr/bin/../share/nmap/nmap.xsl" type="text/xsl"?>
<!-- Nmap 7.70 scan initiated Tue Aug 13 16:20:04 2019 as: nmap -sS -p0- -oA test -&#45;privileged -&#45;append-output localhost -->
<nmaprun scanner="nmap" args="nmap -sS -p0- -oA test -&#45;privileged -&#45;append-output localhost" start="1565706004" startstr="Tue Aug 13 16:20:04 2019" version="7.70" xmloutputversion="1.04">
[...]
</nmaprun>

SvenTo avatar Aug 13 '19 14:08 SvenTo

any chance this can be resolved ?

royharoush avatar Jul 20 '20 12:07 royharoush

Yes, I'm planning to add support with the next release. However, it is still work in progress because I'm working on multi file support, too.

SvenTo avatar Aug 28 '20 13:08 SvenTo

@royharoush one solution is to not append to the xml and instead merge both xmls https://github.com/CBHue/nMap_Merger

0xtavian avatar Dec 19 '20 07:12 0xtavian

that worked for you ? i haven't found a normal nmap merger yet .. anyway .. ill give it a try ! thanks !

On Sat, Dec 19, 2020 at 9:15 AM 0xtavian [email protected] wrote:

@royharoush https://github.com/royharoush one solution is to not append to the xml and instead merge both xmls https://github.com/CBHue/nMap_Merger

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ernw/nmap-parse-output/issues/1#issuecomment-748432965, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB54XIGKUMAEXM5YCAF4CPLSVRHKHANCNFSM4ILJ46EA .

royharoush avatar Dec 19 '20 08:12 royharoush

@royharoush yea works like a charm

0xtavian avatar Dec 21 '20 21:12 0xtavian