1
+ import sys , time , requests
2
+
3
+ """
4
+ Task: 0002-PG
5
+ Priority: Medium
6
+ Deadline: 2023-10-15
7
+ Task Given To: @Altorx @Morpheus
8
+ Task Given By: @I2rys
9
+ Programming Language (s) Scope: Python, NodeJS
10
+ Task (s): Make a tool to find all params, API endpoints on a website including external ones (Recursive. If you can).
11
+
12
+ Date of make: 20/10/2023 (DD/MM/YY) late by: 5 days
13
+ I will be using python for this.
14
+
15
+ - Fuck Morpheus
16
+ """
17
+
18
+ class color :
19
+ end = '\033 [0m'
20
+ bold = '\033 [1m'
21
+ Spartan = '\033 [38;5;196m'
22
+ quotecolor = '\033 [38;5;226m'
23
+ blue = '\033 [38;5;33m'
24
+ green = '\033 [38;5;40m'
25
+
26
+
27
+ banner = color .bold + color .Spartan + """
28
+ ..^!?Y5PGGBGGGP5~ .:..
29
+ . P&@@@@@@@@@@@@@@@@~J@@@@&B57^.
30
+ .7B@#.&@@@@@@@@@@@@@@@@&&@@@@@@@@@@@#Y:
31
+ ^G@@@@@G#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&J
32
+ ~#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&P7:
33
+ ^#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@B7.
34
+ P@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#7.
35
+ .&@@@@@@@@@@@@@@@@&#BBBBB###BBBBBBB&@@5:
36
+ :@@@@@@@@@@@@@@@&#&&@@@@@@@@@@@@@@@&&7
37
+ .&@@@@@@@@@@@@@&&@@@@@@@@@@@@@@@@@@@@&
38
+ P@@@@@@@@@@@@@@@@@@@&#GPPGGGGPPPPG#&&.
39
+ .&@@@@@@@@@@@@@@@@&GPG#&@@@@@@@@@&#P?:
40
+ .Y#@@@@@@@@@@@@@&G#@@@@@@@@@@@@@@@@@@@#!.7B
41
+ J@@@@@@@@@@@@@@B&@@@@@@@@@@@@@@@@@@@@@@@@@@.
42
+ J@@@@@@@@@@@@@B@@@@@@@@@@@@@@@@@@@@@@@@@@@@~
43
+ ~@@@@@@@@@@@@#@@@@@@@@@@@@@@@@@@@&@@@@@@@@@J
44
+ .@@@@@@@@@@@@&@@@@@@@@@@@@@@@&&@@@@@@@@@@@@B
45
+ JG&@@@@@&?!~G@@@@@@@@@@&&&@@@@@@@@@@@@@@@@&
46
+ .&@@@@@? ~@@@@&&&&&@@@@@@@@@@@@@@@@@@@@@:
47
+ .@@@@#. ?@@@@@@@@@@@@@@@@@@@@@5B#B&@@@@7
48
+ ^@@G G@@@@@@@@@@@@@@@@@@@?P@&7^^~Y@G
49
+ ^# .@@@@@@&&&&@@@@@@@@@&#GPGPPP~7&
50
+ ^@@@@@@@7J@@@@@@@@@@@@@@&#G^7@.
51
+ .@@@@@@? &@@@@@@@@@@@@@@@@5?@^
52
+ .B@@@@@! Y@@@@@@@@@@@@@@@@B~@7
53
+ .J@@@@@5. B@@@@@@@@@@@@@@@@&7#:
54
+ .J55J^ .#@@@@@@@@@@@@@@@@&?@~
55
+ .7B@@@@@@@@@@@@@@!@P
56
+ .!G@@@@@@@@@@@7&@
57
+ .~G&@@@@@@@BJ@P
58
+ ^Y#@@@@@5G@P
59
+ .7B&@@BG&5
60
+ :7P?
61
+ """ + color .end
62
+
63
+ for char in banner :
64
+ sys .stdout .write (char )
65
+ sys .stdout .flush ()
66
+ time .sleep (0.000001 )
67
+
68
+ print (f"{ color .quotecolor } Discovering secrets with Hercules.{ color .end } " .center (125 ))
69
+
70
+ def log (i , msg ):
71
+ if i == "*" :
72
+ print (f"{ color .blue } [*]{ color .end } { msg } " )
73
+ elif i == "+" :
74
+ print (f"{ color .green } [+]{ color .end } { msg } " )
75
+ elif i == "-" :
76
+ print (f"{ color .Spartan } [-]{ color .end } { msg } " )
77
+ elif i == "!" :
78
+ print (f"{ color .bold } [!]{ color .end } { msg } " )
79
+
80
+ url = input (f"\n { color .bold } Enter the URL of the website you want to scan: { color .end } " )
81
+
82
+ if not url .startswith ("http://" ) and not url .startswith ("https://" ):
83
+ url = "http://" + url
84
+
85
+ try :
86
+ requests .get (url )
87
+ except :
88
+ log ("-" , "Invalid URL" )
89
+ exit ()
90
+
91
+ log ("*" , "URL is valid" )
92
+
93
+ log ("*" , "Starting to scan for endpoints\n " )
94
+
95
+ endpoints = open ("endpoints.txt" , "r" ).read ().splitlines ()
96
+
97
+ foundendpoints = []
98
+ notfoundendpoints = []
99
+
100
+ for endpoint in endpoints :
101
+ try :
102
+ r = requests .get (url + endpoint )
103
+ if "404" or "Not Found" in r .text :
104
+ log ("-" , f"Endpoint { url + endpoint } not found" )
105
+ notfoundendpoints .append (url + endpoint )
106
+ else :
107
+ log ("+" , f"Found endpoint { url + endpoint } " )
108
+ foundendpoints .append (url + endpoint )
109
+ except KeyboardInterrupt :
110
+ log ("+" , "Exiting" )
111
+ exit ()
112
+ except :
113
+ log ("-" , f"Endpoint { url + endpoint } not found" )
114
+ notfoundendpoints .append (url + endpoint )
115
+
116
+ log ("*" , "Starting to scan for params\n " )
117
+
118
+ params = open ("params.txt" , "r" ).read ().splitlines ()
119
+
120
+ foundparams = []
121
+ notfoundparams = []
122
+
123
+ for param in params :
124
+ try :
125
+ r = requests .get (url + "?" + param )
126
+ if "404" or "Not Found" in r .text :
127
+ log ("-" , f"Param { param } not found" )
128
+ notfoundparams .append (param )
129
+ else :
130
+ log ("+" , f"Found param { param } " )
131
+ foundparams .append (param )
132
+ except KeyboardInterrupt :
133
+ log ("+" , "Exiting" )
134
+ exit ()
135
+ except :
136
+ log ("-" , f"Param { param } not found" )
137
+ notfoundparams .append (param )
138
+
139
+ log ("*" , "Done scanning\n " )
140
+
141
+ print (f"{ color .bold } Found endpoints:{ color .end } " )
142
+ for endpoint in foundendpoints :
143
+ print (f"{ color .green } [+]{ color .end } { endpoint } " )
144
+
145
+ print (f"{ color .bold } \n Not found endpoints:{ color .end } " )
146
+ for endpoint in notfoundendpoints :
147
+ print (f"{ color .Spartan } [-]{ color .end } { endpoint } " )
148
+
149
+ print (f"{ color .bold } \n Found params:{ color .end } " )
150
+ for param in foundparams :
151
+ print (f"{ color .green } [+]{ color .end } { param } " )
152
+
153
+ print (f"{ color .bold } \n Not found params:{ color .end } " )
154
+ for param in notfoundparams :
155
+ print (f"{ color .Spartan } [-]{ color .end } { param } " )
156
+
157
+ asktosave = input (f"{ color .bold } \n Do you want to save the results? (y/n): { color .end } " )
158
+ if asktosave == "y" :
159
+ foldername = url
160
+ with open (foldername + "/Found Endpoints.txt" , "w" ) as f :
161
+ for endpoint in foundendpoints :
162
+ f .write (endpoint + "\n " )
163
+
164
+ with open (foldername + "/Not Found Endpoints.txt" , "w" ) as f :
165
+ for endpoint in notfoundendpoints :
166
+ f .write (endpoint + "\n " )
167
+
168
+ with open (foldername + "/Found Params.txt" , "w" ) as f :
169
+ for param in foundparams :
170
+ f .write (param + "\n " )
171
+
172
+ with open (foldername + "/Not Found Params.txt" , "w" ) as f :
173
+ for param in notfoundparams :
174
+ f .write (param + "\n " )
175
+
176
+ log ("+" , "Saved results" )
177
+
178
+ log ("+" , "Exiting" )
179
+ exit ()
180
+
181
+ # Made by Altorx
182
+ # Fuck you Morpheus
0 commit comments