Tuesday, December 23, 2014

Script - NMAP

Script - NMAP

=========================================================
#!/bin/bash
# This script is going to scan network 192.168.1.0/24 with name and
# append to file name host-up-with-ports.txt
nmap --top-ports 65535 192.168.1.0/24 &> host-up-with-ports.txt
=========================================================
#!/bin/bash
# This script is going to scan network 192.168.1.0/24 with name and
# append to file name hosts-up-with-name.txt
nmap -sP 192.168.1.0/24 |grep "Nmap scan report" >> hosts-up-with-name.txt
=========================================================
#!/bin/bash
# This script is going to ping all hosts in network 192.168.1.0/24
# and it will append all the hosts up to to file hosts-up.txt
check_ping()
{
  ping -c 1 $1 > /dev/null
  [ $? -eq 0 ] && echo Node with IP: $i is up.
}
for i in 192.168.1.{1..255}
do
check_ping $i |grep "Node with IP" >> hosts-up.txt
done
=========================================================
#!/bin/bash
# This is a master script going to run and call another script with the following optoins
clear
# Variables
user=$(whoami)
break="====================="
echo $break
echo "Hello H4cK3R%!"
echo $break
echo
echo "Welcome, Mr. $user"
echo
echo
echo "1. Check Hosts Up"
echo "2. Scan Hosts Up"
echo "3. Scan Hosts Ports"
echo ""
echo -n "Choice: "
read choice
echo $choice
case $choice in
        1) ./check_ping.sh;;
        2) ./scan-host-with-name.sh;;
        3) ./scan_ports.sh;;
        *) echo "Please Enter the valid option."
esac



No comments:

Post a Comment