More python3 fixes
This commit is contained in:
parent
94c3eeba49
commit
9afec1a034
@ -158,7 +158,7 @@ def scan_url(pkg, urls, options, on_progress=None):
|
||||
except Exception as e:
|
||||
output.ewarn(
|
||||
"Handler failed: [%s] %s" %
|
||||
(e.__class__.__name__, e.message)
|
||||
(e.__class__.__name__, str(e))
|
||||
)
|
||||
|
||||
if versions and CONFIG['oneshot']:
|
||||
|
@ -22,7 +22,7 @@ def scan_pkg(pkg, options):
|
||||
output.einfo("Using FreeCode handler: " + package)
|
||||
|
||||
fp = urllib.request.urlopen("http://freecode.com/projects/%s/releases" % package)
|
||||
content = fp.read()
|
||||
content = str(fp.read())
|
||||
|
||||
result = re.findall(
|
||||
r'<a href="/projects/%s/releases/(\d+)">([^<]+)</a>' % package,
|
||||
@ -36,10 +36,10 @@ def scan_pkg(pkg, options):
|
||||
continue
|
||||
fp = urllib.request.urlopen("http://freecode.com/projects/%s/releases/%s" %
|
||||
(package, release_id))
|
||||
content = fp.read()
|
||||
content = str(fp.read())
|
||||
download_page = re.findall(r'<a href="(/urls/[^"]+)"', content)[0]
|
||||
fp = urllib.request.urlopen("http://freecode.com%s" % download_page)
|
||||
content = fp.read()
|
||||
content = str(fp.read())
|
||||
url = re.findall(
|
||||
r'In case it doesn\'t, click here: <a href="([^"]+)"',
|
||||
content
|
||||
|
@ -52,7 +52,7 @@ def confidence_score(found, original, minimum=CONFIDENCE):
|
||||
|
||||
|
||||
def scan_html(data, url, pattern):
|
||||
soup = BeautifulSoup(data)
|
||||
soup = BeautifulSoup(data, features="lxml")
|
||||
results = []
|
||||
|
||||
for link in soup.findAll('a'):
|
||||
@ -114,7 +114,7 @@ def scan_directory_recursive(cp, ver, rev, url, steps, orig_url, options):
|
||||
|
||||
results = []
|
||||
|
||||
if re.search("<\s*a\s+[^>]*href", data, re.I):
|
||||
if re.search(b"<\s*a\s+[^>]*href", data, re.I):
|
||||
results.extend(scan_html(data, url, pattern))
|
||||
elif url.startswith('ftp://'):
|
||||
results.extend(scan_ftp(data, url, pattern))
|
||||
|
Loading…
Reference in New Issue
Block a user