-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuzzing.py
More file actions
135 lines (123 loc) · 8.35 KB
/
fuzzing.py
File metadata and controls
135 lines (123 loc) · 8.35 KB
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
from colorama import Fore, Back, Style
from datetime import datetime
import requests
import colorama
import argparse
import time
import os
colorama.init()
os.system("clear")
print(Fore.GREEN)
def attack(url='http://127.0.0.1',wordlist='/usr/share/dirb/wordlists/common.txt',cookie=0,output=0):
try:
directoriesFile = open(wordlist,"r",encoding='utf-8')
dr_content = directoriesFile.read()
directoriesFile.close()
except Exception as e:
print(Fore.RED)
print(f"\nError! error code: {e}")
except KeyboardInterrupt:
print(Fore.GREEN)
print("\nbye bye")
try:
founds = []
for directories in dr_content.split("\n"):
targetUrl = url + "/" + str(directories)
result = requests.get(url=targetUrl,headers=cookie)
if "200" in str(result.status_code):
status_code = str(result.status_code)
print(Fore.GREEN)
web = f"[+] http://{url}/{directories} |> (Code:{status_code})"
print(f"\nFound >> {web}")
founds = str(web)
if output != 0 or output != " ":
with open(output,"a",encoding="utf-8") as file:
file.write(founds + "\n")
file.close()
print(Fore.RED)
else:
pass
else:
status_code = str(result.status_code)
web = f"[+] http://{url}/{directories} |> (Code:{status_code}"
with open("otherSituations.txt","a",encoding="utf-8") as file:
file.write(web + "\n")
file.close()
pass
except KeyboardInterrupt:
print(Fore.GREEN)
print("\nbye bye")
except Exception as e:
print(Fore.RED)
print(f"\nError! error code: {e}")
info = datetime.today()
time = datetime.ctime(info)
print(Fore.RED)
end_time = f"End Time: {time}".center(50,"=")
print(end_time)
ap = argparse.ArgumentParser()
ap.add_argument("-u", "--url", required=True, help="Target url\nhttp://test.com")
ap.add_argument("-w", "--wordlist", required=True, help="Directories or files wordlist\ndefault: /usr/share/dirb/wordlists/common.txt")
ap.add_argument("-c", "--cookie", required=False, help="Ör:\n 'Cookie': 'PHPSESSID=d143rj8718t2fl67a4jv4tb2s7; security=low'")
ap.add_argument("-o", "--output", required=False, help="Save to file")
args = vars(ap.parse_args())
url = args["url"]
wordlist = args["wordlist"]
cookie = args["cookie"]
output = args["output"]
print(Fore.BLUE)
print("""
.
...'',,. .''''.....
.'''''''''.... .'''. .......''.....
..''.','...''.... '. ... .''. .:ddl. .................
..','',,''...''''...''',,. ,od:..:dd:..;dd; .:cccc:,. ..'......'''......
...'','..''.....'... ..',,''::. ;ddc. ;dd:..'od;.,odc''::c;..,:;'...........,'..'.....
...'''..''..''.........';'':;::';o, .coo:;cdl. 'od,.'lo:.......,:lcclc'........,'..'.........
...'...............,cooolc,..lc.:d;.cl...;c;,'',....;l,...,c:::;..lxo::lod;..,;....'...............
....''...........;lol,.;odo' 'c:,,,,;c,........ ..................,::::loc'.cddl:,'.....'...........
.......'.........:dl'. ;dd; .',''.,c,.... .;:;'.,:. .....'.... ..;;..cddl;,col,....''......'....
...........'.'.... 'ddo:....ldo; ''',.. ;olcooc;. .... 'dd:. .,ldo....','.....'...'..
.................'. ,ooollol:'.. .co:;ll;,. . .''. .cddl. ..........'..'''....
.............''. ... ....';. ,llolcc:' .cdc'. .. .........'.......
.. .. ...... ...'::. .. ................
...... . .;:cldc,. ......
......... .lxoccl, .''......
....... .,;:coo:. .',...'.
....... .;;. ........
..'... .. .'. ....'.
..... .;. ;;'. ...''.
..... .;, .;... ....'.
.... .,;;;;,,. .....
... ...,;' ....
..,;cll:.
.cdocll,
.,clcloc,.
...;cc.
.,'. .,:'
.;ol;;cl;. Oğulcan KAÇAR
.;oddl;'. github.com/OgulcanKacarr
.:lloolc:'.
.....'...'.......''..'.. .''. ...... ..'....'...'.......'.........
.........
..........
..........
.''....'..
""")
info = datetime.today()
start_time = datetime.ctime(info)
_cookie = cookie
print(Fore.BLUE)
print("".center(50,"_"))
print(Fore.RED)
print(f"Start Time: {start_time}\nUrl: {url}\nWordlist: {wordlist}\nCookie: {_cookie}")
print(Fore.BLUE)
print("".center(50,"_"))
a = os.path.exists(output)
if a == True:
c = f"rm {output}"
os.system(c)
b = os.path.exists("otherSituations.txt")
if b == True:
os.system("rm otherSituations.txt")
attack(url,wordlist,cookie,output)