Parses the URL.
(url)
| 166 | |
| 167 | |
| 168 | def 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 | |
| 192 | def scan_url(url, callback_addr): |