diff --git a/monkey/infection_monkey/exploit/drupal.py b/monkey/infection_monkey/exploit/drupal.py index c1b749ad9..06cd17e54 100644 --- a/monkey/infection_monkey/exploit/drupal.py +++ b/monkey/infection_monkey/exploit/drupal.py @@ -15,13 +15,6 @@ __author__ = 'Ophir Harpaz' LOG = logging.getLogger(__name__) -def build_url(*args) -> str: - f = '' - for x in args: - f = urljoin(f, x) - return f - - def check_drupal_cache(r: requests.Response) -> bool: """ Check if a response had the cache header. @@ -33,7 +26,7 @@ def find_articles(base_url: str, lower: int = 1, upper: int = 10): """ Find a target article that does not 404 and is not cached """ articles = set() while lower < upper: - u = build_url(base_url, str(lower)) + u = urljoin(base_url, str(lower)) r = requests.get(u) if r.status_code == 200: # found an article articles.add(lower) @@ -75,7 +68,7 @@ class DrupalExploiter(WebRCE): LOG.info('Could not find a Drupal node to attack') continue for node_id in node_ids: - node_url = build_url(url, str(node_id)) + node_url = urljoin(url, str(node_id)) if self.check_if_exploitable(node_url): self.add_vuln_url(url) # Where is this used? self.vulnerable_urls.append(node_url)