Skip to content

Instantly share code, notes, and snippets.

@Partyschaum
Created December 11, 2017 13:43
Show Gist options
  • Save Partyschaum/d4acd7b6e821916d71b2296d3c398ba9 to your computer and use it in GitHub Desktop.
Save Partyschaum/d4acd7b6e821916d71b2296d3c398ba9 to your computer and use it in GitHub Desktop.
Ask whois.denic.de for information
import socket
whois_server = 'whois.denic.de'
whois_server_port = 43
domain_query = b"shinythings.de\0"
s = socket.socket()
s.connect((whois_server, whois_server_port))
s.sendall(domain_query)
chunks = []
bytes_read = None
while bytes_read != 0:
chunk = s.recv(2048)
bytes_read = len(chunk)
chunks.append(chunk)
print(''.join(chunks))
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment