Last active
March 31, 2019 15:45
-
-
Save dustyfresh/5a745d0251c5163ede8f9e897736e4b0 to your computer and use it in GitHub Desktop.
log brute force traffic on telnet easily with miniboa
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
from miniboa import TelnetServer | |
import logging as logz | |
def on_connect(client): | |
logz.info('New connection from {}'.format(client.address)) | |
clients.append(client) | |
# Fake login prompt | |
client.send('Login: ') | |
def on_disconnect(client): | |
logz.info('Client disconnected {}'.format(client.address)) | |
if client in clients: | |
clients.remove(client) | |
def process(clients): | |
for client in clients: | |
if client.active and client.cmd_ready: | |
payload = client.get_command() | |
logz.info('{} - {}'.format(client.address, str(payload))) | |
# Fake password prompt | |
client.send('\nPassword: ') | |
client.password_mode_on() | |
if __name__ == '__main__': | |
logz.basicConfig(format='%(asctime)s - %(message)s', level=logz.INFO, filename='honey.log') | |
print('Starting telnet honeypot...') | |
clients = [] | |
server = TelnetServer() | |
server = TelnetServer( | |
port=23, | |
address='0.0.0.0', | |
on_connect=on_connect, | |
on_disconnect=on_disconnect | |
) | |
while True: | |
server.poll() | |
process(clients) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment