Created
March 25, 2017 00:20
-
-
Save kd7lxl/8644224005e128735064385cb496504a to your computer and use it in GitHub Desktop.
Simple telnet credential harvester
This file contains hidden or 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
| # usage: twistd -ny telnet_auth.py | |
| from twisted.conch.telnet import TelnetTransport, AuthenticatingTelnetProtocol | |
| from twisted.internet.protocol import ServerFactory | |
| from twisted.application.internet import TCPServer | |
| from twisted.application.service import Application | |
| log = open('creds.log', 'a') | |
| class TelnetHoneypot(AuthenticatingTelnetProtocol): | |
| def connectionMade(self): | |
| self.transport.write("Welcome to the HamWAN honeypot! Please provide a username and password.\r\n") | |
| self.transport.write("Username: ") | |
| def telnet_Password(self, line): | |
| print self.username, line | |
| log.write("%s\t%s\n" % (self.username, line)) | |
| log.flush() | |
| self.transport.wont(chr(1)).addCallback(self._ebLogin) | |
| return 'Discard' | |
| factory = ServerFactory() | |
| factory.protocol = lambda: TelnetTransport(TelnetHoneypot, None) | |
| service = TCPServer(8023, factory) | |
| application = Application("Telnet Honeypot Server") | |
| service.setServiceParent(application) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment