Forum Thread: Writing Python Script

Hello null-byte!
This is my first post and i need some help.

The thing is followed these steps in the given link https://null-byte.wonderhowto.com/how-to/hack-like-pro-find-exact-location-any-ip-address-0161964/and succeeded in finding location. Now I'm planning to write a script which does the whole process when we execute the script. First i made a .sh script with following commands:

cd /root/pygeoip-0.1.3
./IPloc.py (This is the script i made after)

In IPloc.py, the following commands are there:
x=raw_input('Insert the IP address:')
import pygeoip
gip=pygeoip.GeoIP('GeoLiteCity.dat')
rec=gip.recordbyaddr('x')
for key,val in rec.items():
print "%s: %s" %(key,val

The results are not coming. But when i manually execute the commands in IPloc.py, there is no error.
This is how the error looks like:

Insert the IP address:64.233.161.99
Traceback (most recent call last):
File "./IPlocfind.py", line 5, in <module>
rec=gip.recordbyaddr('x')
File "/root/NH3/pygeoip-0.3.2/pygeoip/init.py", line 546, in recordbyaddr
ipnum = util.ip2long(addr)
File "/root/NH3/pygeoip-0.3.2/pygeoip/util.py", line 39, in ip2long
return int(binascii.hexlify(socket.inetpton(socket.AFINET6, ip)), 16)
socket.error: illegal IP address string passed to inet_pton

Any help would be appreciated!

1 Response

Nevermind....i found the fix.
There is no need of apostrophe('x').

Share Your Thoughts

  • Hot
  • Active