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



Saturday, December 20, 2014

SNMPWALK


snmpwalk

snmpwalk : retrieve a subtree of management values using SNMP GETNEXT requests.

snmpwalk [APPLICATION OPTIONS] [COMMON OPTIONS] [OID]

snmpwalk -v 2c -c C0mmunity 1.2.3.4 .1.3.6.1.4.1.8886.18.2.6.3.3.1.6.10234001

C0mmunity = Community Name
1.2.3.4 = IP address of device
.1.3.6.1.4.1.8886.18.2.6.3.3.1.6.10234001 = OID

example another command:

snmpwalk -mALL -v1 -c C0mmunity 1.2.3.4 system


#SNMP #SNMWALK