bdamele/icmpsh

socket.error: illegal IP address string passed to inet_aton

SanStardust opened this issue · 1 comments

[root@VM-0-3-centos icmpsh]# ./run.sh
image
:(
how can i do
Python 2.7.5 (default, Nov 16 2020, 22:23:17)
CentOS Linux release 7.6.1810 (Core)

Commment follow two lines of code in run.sh and add code IP=$1

#IPINT=$(ifconfig | grep "eth" | cut -d " " -f 1 | head -1)
#IP=$(ifconfig "$IPINT" |grep "inet addr:" |cut -d ":" -f 2 |awk '{ print $1 }')
IP=$1

Command

┌──(kali㉿kali)-[~/Desktop/icmpsh]
└─$ sudo ./run.sh 192.168.1.10 

Reason
grep eth result inculde ether, so the first value of the ifconfig | grep "eth" | cut -d " " -f 1 may be blank
Resulting in ifconfig "$IPINT" |grep "inet addr:" |cut -d ":" -f 2 |awk '{ print $1 }' is blank

┌──(kali㉿kali)-[~/Desktop/icmpsh]
└─$ ifconfig 
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 02:42:83:d3:4c:ec  txqueuelen 0  (Ethernet)
        ...
┌──(kali㉿kali)-[~/Desktop/icmpsh]
└─$ ifconfig | grep "eth" | cut -d " " -f 1          

eth0:

eth1: