Advertisement
thesuhu

Python Network Command

Dec 28th, 2020
1,370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. # mendapatkan ip address
  2. #!/usr/bin/env python
  3. import socket
  4.  
  5. def getIP( ):
  6.     s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  7.     s.connect(('www.google.com', 80))
  8.     addr = s.getsockname( )[0]  
  9.     s.close( )  
  10.     return addr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement