I was recently tasked with finding a way to output all the IPs and associated open ports found during an engagement. My primary data source was from nmap, so that's what I used.
Here's my method (doubtless to be improved). The tips I got from scripts and files somewhere:
1. cat.gnmap | awk '{printf "%s\t", $2;
for (i=4;i<=NF;i++) {
split($i,a,"/");
if (a[2]=="open") printf ",%s",a[1];}
print ""}' | sed -e 's/,//' | sed -e 's/\t/ /' > parsed.txt
2. In Excel, either open the parsed.txt file, or in a new sheet, click the "Data" tab, and click "From Text" to open the Text Import Wizard.
3. Choose "Delimited", and click "Next".
4. In the Delimiters section, only "Space" should be checked. Click "Next".
5. Select each Column and click the "Text" radio button. It should look as below.
6. Finish Importing. If using the Text Import Wizard, click OK.
Here's my method (doubtless to be improved). The tips I got from scripts and files somewhere:
1. cat
for (i=4;i<=NF;i++) {
split($i,a,"/");
if (a[2]=="open") printf ",%s",a[1];}
print ""}' | sed -e 's/,//' | sed -e 's/\t/ /' > parsed.txt
2. In Excel, either open the parsed.txt file, or in a new sheet, click the "Data" tab, and click "From Text" to open the Text Import Wizard.
3. Choose "Delimited", and click "Next".
4. In the Delimiters section, only "Space" should be checked. Click "Next".
5. Select each Column and click the "Text" radio button. It should look as below.
6. Finish Importing. If using the Text Import Wizard, click OK.
No comments:
Post a Comment