Advertisement
skip420

hostip

Sep 9th, 2022
1,041
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. # remote user ip finder of victims system
  2.  
  3.  
  4. import socket
  5. def get_ip():
  6.         s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  7.         s.settimeout(0)
  8.         try:
  9.             # doesn't even have to be reachable
  10.             s.connect(('192.168.1.1', 1))
  11.             IP = s.getsockname()[0]
  12.         except Exception:
  13.             IP = '127.0.0.1'
  14.         finally:
  15.             s.close()
  16.         return IP
  17. print(get_ip())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement