nano getip.py
#!/usr/bin/python
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 0))
address=s.getsockname()[0]
print address
chmod 755 getip.py
./getip.py

 

Comments powered by CComment