From c9ea95110ccf3079866bae9ef073487d774771b4 Mon Sep 17 00:00:00 2001 From: ophirharpazg Date: Mon, 31 Aug 2020 16:52:10 +0300 Subject: [PATCH] remove unnecessary function and replace with urljoin --- monkey/infection_monkey/exploit/drupal.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) 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)