-
Notifications
You must be signed in to change notification settings - Fork 2
/
reconmap.py
289 lines (256 loc) · 13 KB
/
reconmap.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
import requests
import sys
import json
import socket
from datetime import datetime
import time
import shodan
from bs4 import BeautifulSoup
from dnsdumpster.DNSDumpsterAPI import DNSDumpsterAPI
from pywhatcms import whatcms
from requests.exceptions import MissingSchema
from termcolor import colored, cprint
text = colored('''
███████╗██████╗░███████╗░█████╗░██╗░░██╗
██╔════╝██╔══██╗██╔════╝██╔══██╗██║░██╔╝
█████╗░░██████╔╝█████╗░░███████║█████═╝░
██╔══╝░░██╔══██╗██╔══╝░░██╔══██║██╔═██╗░
██║░░░░░██║░░██║███████╗██║░░██║██║░╚██╗
╚═╝░░░░░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚═╝
<3 coded by mohit_1337
''', 'blue')
try:
print(text)
words = "shit", "fuck", "tit", "ass", "penis"
dash = input("Enter Url: ")
except KeyboardInterrupt:
err = colored('\n[-]Quiting', 'red')
print(err)
def enter(dash,words):
try:
if dash in words:
print("do you know what are you typing?")
input("type again: ")
else:
pass
except KeyboardInterrupt:
err = colored('\n[-]Quiting', 'red')
print(err)
def responsed(dash):
global user_agent
user_agent = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36',
}
try:
response = requests.get(dash)
if response.status_code == 200:
ccx = colored(response.status_code, 'green')
print('\nStatus_code: ', ccx)
elif response.status_code == 404:
print("response code: ", {response.status_code})
print("---------------------site doesn't exist check the spell--------------------\n")
sys.exit()
except MissingSchema:
url = colored("URL is in bad format", 'red')
print(url)
sys.exit()
except KeyboardInterrupt:
err = colored('\n[-]Quiting', 'red')
print(err)
except:
ex = colored("[-]Connection refused by the server.....", 'red')
print(ex)
tex = colored('retrying......wait for few seconds.', 'yellow', attrs=['blink'])
print(tex)
time.sleep(3)
ext = colored("Can't connect to your application!...", 'red')
print(ext)
sys.exit()
def cms(dash):
dash = dash.replace("https:\/\/", "")
key = "" #replace your key here
try:
cmd = requests.get("https://whatcms.org/APIEndpoint/Detect?key=" + key +"&url=" + dash)
cc = colored("""\t\t\t\t\t\t-----------------------------------------------------------------------
Detecting cms
----------------------------------------------------------------------------\n""", 'magenta')
time.sleep(3)
print(cc)
ccd = colored('[-]If whatcms key not configured the results will default to None\n\n', 'yellow')
print(ccd)
data = cmd.json()
whatcms.name = data['result']['name']
exc = colored(whatcms.name, 'green')
whatcms.code = data['result']['code']
exce = colored(whatcms.code, 'green')
whatcms.confidence = data['result']['confidence']
excel = colored(whatcms.confidence, 'green')
whatcms.cms_url = data['result']['cms_url']
ex = colored(whatcms.cms_url, 'green')
whatcms.version = data['result']['version']
e = colored(whatcms.version, 'green')
whatcms.msg = data['result']['msg']
ef = colored(whatcms.msg, 'green')
whatcms.id = data['result']['id']
efl = colored(whatcms.id, 'green')
whatcms.request = data['request']
whatcms.request_web = data['request_web']
print('[+] CMS: ' , exc)
print('[+] CMS Version: ' , whatcms.version)
print('[+] CMS Confidence: ' , excel)
print('[+] CMS URL: ' , ex)
print('[+] CMS ID: ' , efl)
except KeyboardInterrupt:
err = colored('[+] operation cancelled by user', 'red')
print(err)
def dir(dash):
try:
cc = colored("""\t\t\t\t\t\t-----------------------------------------------------------------------
Finding robots File
-----------------------------------------------------------------------\n""", 'magenta')
print(cc)
time.sleep(3)
file = requests.get(dash + "/robots.txt")
fal = file.text
if "404" in file.text:
print("[+]no robots file detected")
else:
cc = colored('[+]robots file is present', 'yellow')
print(cc)
except KeyboardInterrupt:
ccx = colored('[-]Operation cancelled by user', 'red')
print(ccx)
sys.exit()
except:
xxs = colored("[-]Connection refused by the server..", 'red')
print(xxs)
sys.exit()
def pt():
cc = colored("""\t\t\t\t\t\t-----------------------------------------------------------------------
Finding Potential Directories
-----------------------------------------------------------------------\n""", 'magenta')
print(cc)
try:
with open('dir.txt', 'r') as wordlist:
for links in wordlist:
links = dash + "/" + links
r = requests.get(links)
http = r.status_code
if http == 200:
lik = links + colored("[-]Vulnerable", 'red')
print(lik)
elif http == 404:
likes = links + colored("[+]Not Vulnerable]", 'green')
print(likes)
except KeyboardInterrupt:
col = colored('[+]Operation Cancelled by user', 'red')
print(col)
except:
colg = colored("[-]Connection refused by the server..", 'red')
sys.exit()
def header(dash):
try:
cc = colored("""\t\t\t\t\t\t-----------------------------------------------------------------------
Fetching URL via wayback
-----------------------------------------------------------------------\n""", 'magenta')
print(cc)
time.sleep(3)
response = requests.get("https://web.archive.org/cdx/search?url="+ dash +"&matchType=prefix&collapse=urlkey&output=text&fl=original&\filter=&limit=10")
resp = response.text
print(resp)
except KeyboardInterrupt:
user = colored('[+]operation canccelled by the user', 'red')
sys.exit()
except:
print("[-]Connection refused by the server..")
sys.exit()
def whois(dash):
cc = colored("""\t\t\t\t\t\t-----------------------------------------------------------------------
Finding Services Via Shodan
-----------------------------------------------------------------------\n""", 'magenta')
print(cc)
lol = colored('[-]Tool will not work properly if you dont provide API keys', 'red')
print(lol)
time.sleep(3)
dash = dash.replace("https://www.", "")
dash = dash.replace("http://www.", "")
dash = dash.replace('http://', "")
dash = dash.replace('https://', "")
dash = dash.replace('/', "")
shodant = socket.gethostbyname(dash)
api = shodan.Shodan('') #replace you shodan key here
host = api.host(shodant)
try:
print("""
IP: {}
Organization: {}
Operating System: {}
ISP: {}
Cloud Service Found: {}
City: {}
Country: {}
Port: {}
""".format(host['ip_str'], host.get('org', 'n/a'), host.get('os', 'n/a'), host.get('isp'), host.get('hostnames'), host.get('city'), host.get('country'), host.get('port')))
except KeyboardInterrupt:
user = colred('[-]quitting', 'red')
except Exception:
pass
def js(dash):
try:
cc = colored("""\t\t\t\t\t\t-----------------------------------------------------------------------
Fetching js files
-----------------------------------------------------------------------\n""", 'magenta')
print(cc)
time.sleep(3)
html = requests.get(dash).content
soup = BeautifulSoup(html, "html.parser")
js_files = []
url = []
for script in soup.find_all("script"):
if script.attrs.get("src"):
url = script.attrs.get("src")
print(dash+url)
except KeyboardInterrupt:
xd = colored('[+]operation Cancelled by user', 'red')
print(xd)
except:
print("Connection refused by the server..")
sys.exit()
def records(dash):
try:
dash = dash.replace("https://", "")
dash = dash.replace("http://www.", "")
dash = dash.replace('http://', "")
dash = dash.replace('https://', "")
dash = dash.replace("/", "")
res = DNSDumpsterAPI(True).search(dash)
dex = colored("\n\n\n\t\t\t\t\t\t----------------------DNS Servers -------------------------\n", 'magenta')
time.sleep(3)
print(dex)
for entry in res['dns_records']['dns']:
print(("{domain} ({ip}) {as} {provider} {country}".format(**entry)))
jar = colored("\n\n\n\t\t\t\t\t\t-------------- MX Records ---------------------\n", 'magenta')
print(jar)
time.sleep(2)
for entry in res['dns_records']['mx']:
print(("{domain} ({ip}) {as} {provider} {country}".format(**entry)))
print("\n\n\n\t\t\t\t\t----------------------- Host Records (A) ---------------------------\n")
for entry in res['dns_records']['host']:
if entry['reverse_dns']:
print(("{domain} ({reverse_dns}) ({ip}) {as} {provider} {country}".format(**entry)))
else:
print(("{domain} ({ip}) {as} {provider} {country}".format(**entry)))
jare = colored("\n\n\n\t\t\t\t\t-------------------------- TXT Records ------------------\n", 'magenta')
for entry in res['dns_records']['txt']:
print(entry)
except KeyboardInterrupt:
print('[+]operation Cancelled by user')
enter(dash,words)
responsed(dash)
cms(dash)
dir(dash)
pt()
header(dash)
whois(dash)
js(dash)
records(dash)