-
Notifications
You must be signed in to change notification settings - Fork 0
/
web_app_mapper_py3.x.py
54 lines (38 loc) · 1.38 KB
/
web_app_mapper_py3.x.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 queue
import threading
import os
import urllib
import http
from urllib import request
from urllib import error
threads = 10
target = "http://www.blackfire.mobi" #目標網址
directory = "D:/joomla-cms/joomla_3.9.5" #目錄
filters =[".jpg", ".gif", ".png", ".css"]
os.chdir(directory)
web_paths = queue.Queue() #把稍後想檢查目標是否擁有的檔名加到裡面
for r,d,f in os.walk("."): #接著用os.walk函式走訪本基web應用程式下所有目錄
for files in f:
remote_path = "%s/%s" %(r,files)
if remote_path.startswith("."):
remote_path = remote_path[1:]
if os.path.splitext(files)[1] not in filters:
web_paths.put(remote_path)
def test_remote():
while not web_paths.empty():
path = web_paths.get()
url = "{}{}".format(target,path)
#request = urllib.request.Request(url)
try:
response = urllib.request.urlopen(url)
content = response.read()
print("[%s] => %s"% (response.code,path))
response.close()
except urllib.error.HTTPError as error:
#print("Failed {}".format(error.code))
#except:
pass
for i in range(threads):
print("Spawning thread: %s"% i)
t = threading.Thread(target = test_remote)
t.start()