Is This an IP Tracker Code Or I'm a Wrong?

Question: Is This a IP Tracker?

def grab_ip():
  ip = socket.gethostbyname(socket.gethostname()
	write_ip = open("ipInfo.txt" ,"a")
  return "Command Complete"

print (grab_ip())>

No, another step is needed to get the IP.
socket.gethostbyname() only gets the hostname, not the IP.
and even if you get the IP, it doesn’t get your IP, it gets the IP of the virtual machine running the Repl.


Hi @VictorNwadike. I’m not sure, but I think this just grabs your Repl’s server’s IP or something. Also, please format your code like this:

print('hello, world!')
Raw ```py
print('hello, world!')

It’s Not Mine.

I Friend Told Me About The IP Tracker and i Should ask if it Really Gets You’re IP

Not Mine.

This is the machine IP, to have the client IP via a web app(I guess you are using flask or similar) is not allowed … (I do not mean replit, the browsers )

1 Like

It Isn’t My Coding

It Is Coding a Friend Warned me About So i Couldn’t Read it Well So I’m Asking Others

This wil give you the host IP. In a desktop python app it is your PC IP, but running on a server, VPN or cloud will give you that IP as the code is not running on the local client

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.