Last active
August 29, 2015 14:20
-
-
Save kalebo/65dd711b714635828fdf to your computer and use it in GitHub Desktop.
Dynamic IP Tracker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# To add an an entry from a remote machine (NAME at LOCATION): | |
# $ echo "LOCATION::NAME" | telnet YOURSERVER 45667 | |
import socket | |
from datetime import datetime | |
HOST = "" | |
PORT = 45667 | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind((HOST, PORT)) | |
s.listen(5) | |
while True: | |
conn, addr = s.accept() | |
hostid = conn.recv(1024).rstrip() | |
print "%s (%s) --> %s" % (hostid,datetime.now().strftime("%Y-%m-%dT%H:%M"),addr[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment