Skip to main content

Table Of Contents

  • Linux Scripting

LINUX SCRIPTING

NIX SCRIPTING

Ping sweep -- (Replace first three octets of IP to set class C address to scan)

for x in {1..254..1};do ping -c 1 1.1.1.$x |grep "64 b" |cut -d" " -f4 >> ips.txt; done

Reverse DNS Lookup -- (Create new bash script with the following contents)

#!/bin/bash
echo "Enter Class C Range: i.e. 192.168.3"
 
read range
for ip in {1..254..1};do
host $range.$ip |grep "name pointer" |cut -d" " -f5
done

Fork bomb -- (Creates processes until system "crashes")

:(){ :|: & };:

DNS reverse lookup -- (Replace first three octets of IP to set class C address to scan)

for ip in {1..254..1}; do dig -x 1.1.1.$ip | grep $ip >> dns.txt; done;

IP banning script

#!/bin/sh
 
# This script bans any IP in the /24 subnet for 192.168.1.0 starting at 2
# It assumes 1 is the router and does not ban IPs .20, .21, .22
 
i=2
while [[ $i –le 253 ]]
do
if [[ $i –ne 20 && $i –ne 21 && $i –ne 22 ]]; then
echo "BANNED: arp -s 192.168.1.$i"
arp -s 192.168.1.$i 00:00:00:00:00:0a
else
echo "IP NOT BANNED:192.168.1.$i*****"
echo "*******************************"
fi
i=`expr $i +1`
done

Compare 2 files for similar lines

for line in $(cat <FILE_PATH>); do grep -i $line <FILE_PATH>; done;