remove unnecessary function and replace with urljoin

This commit is contained in:
ophirharpazg 2020-08-31 16:52:10 +03:00
parent 1ae8ecff62
commit c9ea95110c
1 changed files with 2 additions and 9 deletions

View File

@ -15,13 +15,6 @@ __author__ = 'Ophir Harpaz'
LOG = logging.getLogger(__name__) 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: def check_drupal_cache(r: requests.Response) -> bool:
""" """
Check if a response had the cache header. 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 """ """ Find a target article that does not 404 and is not cached """
articles = set() articles = set()
while lower < upper: while lower < upper:
u = build_url(base_url, str(lower)) u = urljoin(base_url, str(lower))
r = requests.get(u) r = requests.get(u)
if r.status_code == 200: # found an article if r.status_code == 200: # found an article
articles.add(lower) articles.add(lower)
@ -75,7 +68,7 @@ class DrupalExploiter(WebRCE):
LOG.info('Could not find a Drupal node to attack') LOG.info('Could not find a Drupal node to attack')
continue continue
for node_id in node_ids: 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): if self.check_if_exploitable(node_url):
self.add_vuln_url(url) # Where is this used? self.add_vuln_url(url) # Where is this used?
self.vulnerable_urls.append(node_url) self.vulnerable_urls.append(node_url)