Last active
December 10, 2019 13:24
-
-
Save guim1111/2b83006909720a09962bb7f9453d1046 to your computer and use it in GitHub Desktop.
Extract up hosts in /24 networks to csv for OpenVas using nmap -sp (so nmap needed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#script extract the IPs of a network that answer to a ping request | |
#create a csv for others automated vuln scanners | |
#use fo this: ./checkUpIps.sh 192.168.1.0 (only networks /24 ended with 0 without writing /24) | |
ip=$1 | |
ipname=$(echo $1 | tr . -) | |
nameResult='ips'$ipname'.txt' | |
namecsv='onlyIps'$ipname'.csv' | |
nmap -sP $1/24 > $nameResult | |
cat $nameResult | grep -P 'Nmap scan report for' | sed -e 's/Nmap scan report for \(.*\)/\1/' | sed 's/$/,/' > $namecsv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment