nc example.com 79 [return] - prints info about everyone [username] - returns plan and stuff for username
RFC 742 - NAME/FINGER Protocol
RFC 1288 - The Finger User Information Protocol
A finger client written in Python:
import socket def finger(node): # Separate out username and domain elements = node.split('@') if len(elements) == 1: user, host = '', elements elif len(elements) == 2: user, host = elements else: return '' # Input was not in a useful format # Contact host s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(5) # we get bored after N seconds print 'host by name' socket.gethostbyname(host) print "address info" socket.getaddrinfo(host, 79) print 'start connect:', host s.connect((host, 79)) print 'connect finished' #print socket.getaddrinfo(host, 79) #s.create_connection((host, 79), timeout = 10.0) #s = socket.create_connection((host, 79), timeout = 5) s.send(user + "\r\n") result = '' while True: data = s.recv(1024) if len(data) == 0: break result += data s.close() # print result return result print finger('email@example.com') print finger('nummo.strngled.net') print 'Finished'
It has a basic problem: it connects via the standard socket connect() command. Unfortunately, on both Linux and Windows, there is no way to set a timeout. This makes it inconvenient to use if you have the host wrong. connect() will eventually time out, but the delay is quite long, and you have no control over it. This makes the python code tedious to use.