Skip to content

Commit

Permalink
traverse IIS folders: dealing with iis folder url
Browse files Browse the repository at this point in the history
  • Loading branch information
FuhuXia committed Aug 13, 2024
1 parent c600db5 commit 3d0a375
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ckanext/spatial/harvesters/waf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import print_function

import os
from urllib.parse import urljoin
import logging
import hashlib
Expand Down Expand Up @@ -310,11 +311,13 @@ def _extract_waf(content, base_url, scraper, results = None, depth=0):
continue
if 'mailto:' in url:
continue
if '..' not in url and url[0] != '/' and url[-1] == '/':
if '..' not in url and url[-1] == '/':
new_depth = depth + 1
if depth > 10:
log.info('Max WAF depth reached')
continue
# turn iis dir url '/some/full/path/' into apache/nginx style 'path/'
url = os.path.basename(url.rstrip('/')) + '/'
new_url = urljoin(base_url, url)
if not new_url.startswith(base_url):
continue
Expand Down

0 comments on commit 3d0a375

Please sign in to comment.