-1

I'm following along the book "Penetration Testing: A hands-on...." and have hit a road bump in executing this simple bash script.

The script basically looks pings all 254 hosts on the designated network in search of an ICMP reply. I'm writing this in nano and everything looks fine until I hit the ping command. 'ping' isn't changing color or anything, so I assume nano isn't recognizing this as a command. I'm not really sure why. I have no issues pinging IP addresses, but it just doesn't seem to be working within the script.

#!/bin/bash
if [ "$1" == "" ]
then 
echo "Usage: ./pingscript.sh [network]"
echo "example: ./pingscript.sh 192.168.0"
else
for x in 'seq 1 254' ; do
ping -c 1 $1.$x | grep "64 bytes"
done
fi

Why isn't the ping command working? As I mentioned earlier, "ping" doesn't change color within nano. Also, when I run my script, I get the error "ping: 192.168.0.seq: Name or service not known"

Now, I am using the latest version of Kali while the book uses 1.0.6. Any insight is appreciated.

1

1 Answer 1

3

Please change this

for x in 'seq 1 254' 

to

for x in `seq 1 254` 

or

for x in $(seq 1 254) 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.