-
Notifications
You must be signed in to change notification settings - Fork 3
/
login.py
54 lines (50 loc) · 1.99 KB
/
login.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
import urllib.request
import re
import random
import time
HOST_URL = 'host_login_url'
USERNAME_LIST = [] #without prefix
USERNAME_PREFIX = "default_prefix"
CHOICE = ''
PASSWORD = "default_password"
def tryUser(USERNAME_LIST):
try:
req = urllib.request.Request(host_url)
data = 'mode=191&username='USERNAME_PREFIX+USERNAME_LIST+'&password='+PASSWORD+'&a=1355344698415'
data = data.encode('utf-8')
get = urllib.request.urlopen(host_url,data)
getData = get.read()
getData = getData.decode('ascii')
message = re.findall(r'<message>(.*?)</message>',str(getData))
return message[0]
except urllib.error.URLError as err:
print(str(err))
num = 0
# Make a temporary list of the Usernames
tempList = username
while(1):
try:
# Randomly pick usernames and distribute load
choice = random.choice(tempList)
try:
message = tryUser(choice)
if(message == '<![CDATA[You have successfully logged in]]>'):
print('Logged In As ' + 'f201'+choice)
break
else:
if(message == '<![CDATA[Your data transfer has been exceeded, Please contact the administrator]]>'):
print('Connection Failed for '+USERNAME_PREFIX+CHOICE+'. Data Limit has already exceeded.')
if(message == '<![CDATA[The system could not log you on. Make sure your password is correct]]>'):
print('Connection Failed for '+USERNAME_PREFIX+CHOICE+' due to incorrect password.')
num=num+1
# Pop incorrect choice from list
tempList.remove(choice)
# Optional time delay
time.sleep(0.1)
except:
# Exhausted our list and couldn't log in
print("End of list reached. Couldn't log in :(")
break
except:
# Network error
print("Login failed due to network error. Please try again.")