Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def audit(self):
headers = self.requests.headers
url = self.requests.url
p = urlparse(url)
domain = "{}://{}/".format(p.scheme, p.netloc)
try:
payloads = parse_tld(domain, fix_protocol=True, fail_silently=True)
except AttributeError:
payloads = None
if not payloads:
return
for payload in payloads:
for i in ['.rar', '.zip']:
test_url = domain + payload + i
r = requests.get(test_url, headers=headers, allow_redirects=False, stream=True)
try:
content = r.raw.read(10)
except:
continue
if r.status_code == 200 and self._check(content):