Skip to content

Instantly share code, notes, and snippets.

@t3h2mas
Created April 21, 2016 22:37
Show Gist options
  • Save t3h2mas/6b349f0c2ec1c7d64b2dd0e6e270f858 to your computer and use it in GitHub Desktop.
Save t3h2mas/6b349f0c2ec1c7d64b2dd0e6e270f858 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
IP=`hostname -I | cut -d ' ' -f1`
HOST=`python ./parse_ip.py $IP`
nmap -sP $IP/24 -oG hosts
cat hosts | grep Up | cut -d ' ' -f2 > hosts_clean
mv hosts_clean hosts
while read p; do
if [ "$p" == "$IP" ]; then
continue
fi
echo $p
nmap -sS -O $p -oG $p.results
done <hosts
#!/usr/bin/python
from sys import argv
if __name__ == "__main__":
addr = argv[1].split('.')
addr[-1] = '0'
print '.'.join(addr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment