-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb_tester.py
188 lines (161 loc) · 6.57 KB
/
web_tester.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/usr/bin/env python3
# Coded by CyberCommands
import os
import sys
import nmap
import time
import ipwhois
import socket
import requests
import dns.resolver
from pprint import pprint
from urllib.request import urlopen
from urllib.error import HTTPError, URLError
os.system('cls' if os.name == 'nt' else 'clear')
print('\033[1;36m=\033[0m'*62)
print('\033[1;91m[!] WARNING: \033[0mThe Author is not responsible for illegal users.\n')
print('''\t\t \033[1m[*] Options: \n
\033[1;33m\t[1] \033[1;32mIP Whois.
\033[1;33m\t[2] \033[1;32mWebsite Checker.
\033[1;33m\t[3] \033[1;32mPort Scanner.
\033[1;33m\t[4] \033[1;32mNmap Scanner.
\033[1;33m\t[5] \033[1;32mServer Information (HTTP Headers).
\033[1;33m\t[6] \033[1;32mNameservers of Domain.
\033[1;33m\t[7] \033[1;32mCMS Detector.
\033[1;33m\t[8] \033[1;32mExit. \n''')
print('\033[1;36m=\033[0m'*62)
def main():
num = input('\n> CMD $ ')
if num == '1':
ip = input("[*] Enter Target IP: ")
resault = ipwhois.IPWhois(ip).lookup_whois()
pprint(resault)
main()
elif num == '2':
addr = input("[*] Enter Target Url: ")
try:
response = urlopen(addr).getcode()
#if response == 200:
# print('\033[92m[+] HTTP 200 Success. OK, this website is up. \033[0m')
#if response == 400:
# print('\033[91m[-] HTTP 400 Client Errors. Bad Request. \033[0m')
#if response == 500:
# print('\033[91m[-] HTTP 500 Server Errors. Internal Server Error. \033[0m')
except URLError as err:
print('\033[91m[-] Couldn\'t find a server.\033[0m')
print('\033[91m[!] Reason: \033[0m', err.reason)
except HTTPError as err:
print('\033[91m[-] Couldn\'t check target Url. \033[0m')
print('\033[91m[!] Error code: \033[0m', err.code)
main()
elif num == '3':
site_ip = input("[*] Enter Target IP: ")
try:
for port in range(20, 1024):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn = sock.connect_ex((site_ip, port))
if conn == 0:
print('Port \033[92m{}\033[0m:\t \033[92mOpen \033[0m'.format(port))
sock.close()
except KeyboardInterrupt:
print('\033[31m[!] \033[0m \033[33mCtrl +C Detected. Cancel Scanning... \033[0m')
main()
main()
elif num == '4':
target_ip = input("[*] Enter Target IP: ")
res = nmap.PortScanner().scan(target_ip, "0-255") # Range IP address.
print(res)
main()
elif num == '5':
server = input("[*] Enter Target Url: ")
headers = requests.get(server).headers
print("[*] Checking HTTP Header information...")
time.sleep(1)
# Headers is a dict so we can use items() function to get it as Key, Value.
for key, value in headers.items():
print(key + "\t\t \033[92m ==> \033[0m " + value)
main()
elif num == '6':
dom = input("[*] Enter Target Address (example.com): ")
ans = dns.resolver.query(dom, 'NS')
for server in ans:
print(server)
main()
elif num == '7':
site = input("[*] Enter Target Url: ")
# Wordpress Scanner.
start = "\nScan for WordPress... \n"
for s in start:
sys.stdout.write(s)
sys.stdout.flush()
time.sleep(0.2)
wpLcheck = requests.get(site + "/wp-login.php")
if wpLcheck.status_code == 200 and "user_login" in wpLcheck.text and "404" not in wpLcheck.text:
print("\033[92m[+] WordPress detected: Admin Panel ➤ \033[0m" + site + "/wp-admin.php")
else:
print("\033[91m[-] WordPress not detected. \033[0m")
pass
wpAcheck = requests.get(site + "/wp-admin")
if wpAcheck.status_code == 200 and "user_login" in wpAcheck.text and "404" not in wpAcheck.text:
print("\033[92m[+] WordPress detected: Admin Panel ➤ " + site + "/wp-admin")
else:
pass
# Joomla Scanner.
start = "\nScan for Joomla... \n"
for s in start:
sys.stdout.write(s)
sys.stdout.flush()
time.sleep(0.2)
jmAcheck = requests.get(site + "/administrator")
if jmAcheck.status_code == 200 and "mod-login-username" in jmAcheck.text and "404" not in jmAcheck.text:
print("\033[92m[+] Joomla detected: Admin Panel ➤ \033[0m" + site + "/administrator")
else:
print("\033[91m[-] Joomla not detected. \033[0m")
pass
jmScheck = requests.get(site)
if jmScheck.status_code == 200 and "joomla" in jmScheck.text and "404" not in jmScheck:
print("\033[92m[+] Joomla detected: 'joomla' on index. \033[0m")
else:
pass
# Drupal Scanner.
start = "\nScan for Drupal... \n"
for s in start:
sys.stdout.write(s)
sys.stdout.flush()
time.sleep(0.2)
drRcheck = requests.get(site + "/readme.txt")
if drRcheck.status_code == 200 and 'drupal' in drRcheck.text and '404' not in drRcheck.text:
print("\033[92m[+] Drupal detected: Drupal Readme.txt ➤ \033[0m" + site + '/readme.txt')
else:
print("\033[91m[-] Drupal not detected. \033[0m")
pass
drCcheck = requests.get(site + '/core/COPYRIGHT.txt')
if drCcheck.status_code == 200 and 'Drupal' in drCcheck.text and '404' not in drCcheck.text:
print("\033[92m[+] Drupal detected: Drupal COPYRIGHT.txt ➤ \033[0m" + site + '/core/COPYRIGHT.txt')
else:
pass
# Magento Scanner.
start = "\nScan for Magento... \n"
for s in start:
sys.stdout.write(s)
sys.stdout.flush()
time.sleep(0.2)
mgRcheck = requests.get(site + '/RELEASE_NOTES.txt')
if mgRcheck.status_code == 200 and 'magento' in mgRcheck.text:
print("\033[92m[+] Magento detected: Magento Release_Notes.txt ➤ \033[0m" + site + '/RELEASE_NOTES.txt')
else:
print("\033[91m[-] Magento not detected. \033[0m")
pass
mgCcheck = requests.get(site + '/js/mage/cookies.js')
if mgCcheck.status_code == 200 and "404" not in mgCcheck.text:
print("\033[92m[+] Magento detected: Magento cookies.js: \033[0m" + site + '/js/mage/cookies.js')
else:
pass
main()
elif num == '8':
quit()
else:
print("\033[1;31m[!!] Wrong Input. \033[0m")
main()
if __name__ == '__main__':
main()