/ Published in: Bash
requires nmap
./scanner.sh ip_addr output
shall generate a CSV file named output.csv with the results of the port scan
./scanner.sh ip_addr output
shall generate a CSV file named output.csv with the results of the port scan
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/env /bin/bash LOG_FILE=$2 TARGET=$1 CSV_FILE="$LOG_FILE.csv" echo "Porto,Serviço" > $CSV_FILE nmap -v -sS $TARGET > $LOG_FILE CUTLINE=`grep -n "PORT" $LOG_FILE | cut -d':' -f1` let CUTLINE=CUTLINE+1 ENDLINE=`grep -nw "^$" $LOG_FILE|tail -n 1|cut -d ':' -f1` let ENDLINE=ENDLINE-1 sed -n "${CUTLINE},${ENDLINE}p" $LOG_FILE|awk '{print $1","$3}' >> $CSV_FILE echo "done"