MCPcopy Create free account
hub / github.com/Y0-kan/Log4jShell-Scan / parse_url

Function parse_url

log4j-scan.py:168–189  ·  view source on GitHub ↗

Parses the URL.

(url)

Source from the content-addressed store, hash-verified

166
167
168def parse_url(url):
169 """
170 Parses the URL.
171 """
172
173 # Url: https://example.com/login.jsp
174 url = url.replace('#', '%23')
175 url = url.replace(' ', '%20')
176
177 if ('://' not in url):
178 url = str("http://") + str(url)
179 scheme = urlparse.urlparse(url).scheme
180
181 # FilePath: /login.jsp
182 file_path = urlparse.urlparse(url).path
183 if (file_path == ''):
184 file_path = '/'
185
186 return({"scheme": scheme,
187 "site": f"{scheme}://{urlparse.urlparse(url).netloc}",
188 "host": urlparse.urlparse(url).netloc.split(":")[0],
189 "file_path": file_path})
190
191
192def scan_url(url, callback_addr):

Callers 1

scan_urlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected