devsecops-wrappers/linux/pingsweep.sh
Heretic b54a338ecf
Add files via upload
pingsweep.sh scans networks.txt with nmap, tries TCP pings if ICMP fails, and produces inventory.csv with IP plus method.
scan_multi_concurrent.sh Multi-Subnet Scanner that produces a CSV with ip, hostname, mac, vendor.
2025-10-31 09:51:46 -05:00

32 lines
760 B
Bash

#!/bin/bash
#
# ./pingsweep.sh
#
# Author: Victor Bishop (Heretic312)
# Date: 10/31/2025
#
# About:
# This scans networks.txt with Nmap, tries TCP pings if ICMP fails, and produces inventory.csv with IP plus method.
#
# Usage:
# Make a file networks.txt listing each routed subnet you want to scan:
# 10.0.10.0/24
# 10.0.20.0/24
# 192.168.50.0/24
#
# Notes:
# Replace default .txt and .csv names as needed
nets="networks.txt"
out="inventory.csv"
echo "ip,method" > $out
# ICMP sweep
nmap -sn -iL $nets -oG - | awk '/Up$/{print $2",icmp"}' >> $out
# TCP fallback for networks with no hits (optional)
nmap -sn -PS22,80,443 -iL $nets -oG tcpfallback.gnmap
awk '/Up$/{print $2",tcp"}' tcpfallback.gnmap >> $out
# dedupe
sort -u $out -o $out