fix: remove strings decodes (Python 3)

This commit is contained in:
ajmeese7 2023-02-11 16:30:59 -05:00
parent d1e50cdb88
commit daf7760517
No known key found for this signature in database
GPG key ID: 8CA7BE49705F7776
4 changed files with 5 additions and 5 deletions

View file

@ -78,7 +78,7 @@ class Blackwidow(object):
)
soup = BeautifulSoup(html_page, "html.parser")
for link in soup.findAll(attribute):
found_redirect = str(link.get(descriptor)).decode("unicode_escape")
found_redirect = str(link.get(descriptor))
if found_redirect is not None and lib.core.settings.URL_REGEX.match(found_redirect):
unique_links.add(found_redirect)
else:
@ -159,4 +159,4 @@ def blackwidow_main(url, **kwargs):
else:
lib.core.settings.logger.fatal(lib.core.settings.set_color(
"did not find any usable links from '{}'".format(url), level=50
))
))

View file

@ -83,7 +83,7 @@ def gather_urls(html, attribute="a", descriptor="href"):
redirects, retval = set(), set()
soup = BeautifulSoup(html, "html.parser")
for link in soup.findAll(attribute):
found_redirect = str(link.get(descriptor)).decode("unicode_escape")
found_redirect = str(link.get(descriptor))
if lib.core.settings.PGP_IDENTIFIER_REGEX.search(found_redirect) is not None:
redirects.add(found_redirect)
for link in redirects:

View file

@ -61,7 +61,7 @@ def get_urls(query, url, verbose=False, **kwargs):
the Google URL. This will open a robot controlled browser window and attempt
to get a URL from Google that will be used for scraping afterwards.
"""
query = query.decode('unicode_escape').encode('utf-8')
query = query.encode('utf-8')
proxy, user_agent = kwargs.get("proxy", None), kwargs.get("user_agent", None)
tor, tor_port = kwargs.get("tor", False), kwargs.get("tor_port", None)
batch = kwargs.get("batch", False)

View file

@ -94,7 +94,7 @@ if __name__ == "__main__":
if urls_to_use is None:
logger.error(set_color(
"unable to run attacks appears that no file was created for the retrieved data", level=40
"Unable to run attacks appears that no file was created for the retrieved data", level=40
))
shutdown()
options = [