On Mon, 29 Jul 2019 at 21:05, Martijn Koster mak-alug@greenhills.co.uk wrote:
Or should I just ditch the bash script for a Python script?
Yes :-)
Fair enough!
Sorry for the delayed response, for some reason Gmail thought your reply was spam.
If you want to use bash, you could parse the file, sort it, then present it like this: [[..snip..]]
Thanks, I like that approach (in a "I used to push .bat files way beyond their comfort zone so this makes sense to me" kind of way), and there's some useful snippets in there I can re-use elsewhere, but the real message is that bash isn't really the best tool if I have Python installed anyway.
You could improve that by using bash 4 associate arrays rather than the intermediate files: [[..snip..]]
Now that's interesting, I haven't played with associative arrays in bash, and with that approach there's no compelling reason to use python to parse the human-readable nmap output.
I'll definitely play with that, thanks!
If you prefer pipes to code, you could hack something like this: [[..snip..]]
One-liners are fun but these days I try to write scripts I have a hope of understanding once a few more grey cells have gone on their merry way!
I’d run Nmap with `-oX n.xml` then use some python like: [[..snip..]]
OK, so now there's a compelling reason to use python; XML does make more sense now you mention it. I think I'll work on this as my starting point.
Thank you so much for the time and effort that went into that response.