-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.

closed as off-topic by jasonwryan, Stephen Rauch, Archemar, Anthon, Rui F Ribeiro Jul 6 '17 at 12:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – jasonwryan, Stephen Rauch, Archemar, Anthon, Rui F Ribeiro
If this question can be reworded to fit the rules in the help center, please edit the question.

3

Please change this

for x in 'seq 1 254' 

to

for x in `seq 1 254` 

or

for x in $(seq 1 254) 

Not the answer you're looking for? Browse other questions tagged or ask your own question.