Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self, url, meth="GET", timeout=10, redirs=True, data=None, params=None, verify=True
):
try:
response = requests.request(
url=url,
headers=self.headers,
method=meth,
timeout=timeout,
allow_redirects=redirs,
data=data,
params=params,
verify=verify,
)
# response = requests.request(url="http://127.0.0.1:8000", headers=self.headers, method=meth, timeout=timeout, allow_redirects=redirs, data=data, params=params)
if self.debug:
c.debug_news("DEBUG: Sent the following---------------------")
print(self.headers)
print(url, meth, data, params)
c.debug_news("DEBUG: Received the following---------------------")
c.debug_news(response.url)
c.debug_news("DEBUG: RESPONSE HEADER---------------------")
print(
"\n".join(
"{}: {}".format(k, v) for k, v in response.headers.items()
)
)
c.debug_news("DEBUG: RESPONSE BODY---------------------")
print(response.content)
# print(response)
except Exception as ex:
c.bad_news("Request could not be made for " + self.target)
print(url)
url=url,
headers=self.headers,
method=meth,
timeout=timeout,
allow_redirects=redirs,
data=data,
params=params,
verify=verify,
)
# response = requests.request(url="http://127.0.0.1:8000", headers=self.headers, method=meth, timeout=timeout, allow_redirects=redirs, data=data, params=params)
if self.debug:
c.debug_news("DEBUG: Sent the following---------------------")
print(self.headers)
print(url, meth, data, params)
c.debug_news("DEBUG: Received the following---------------------")
c.debug_news(response.url)
c.debug_news("DEBUG: RESPONSE HEADER---------------------")
print(
"\n".join(
"{}: {}".format(k, v) for k, v in response.headers.items()
)
)
c.debug_news("DEBUG: RESPONSE BODY---------------------")
print(response.content)
# print(response)
except Exception as ex:
c.bad_news("Request could not be made for " + self.target)
print(url)
print(ex)
print(response)
return response
Full output line is stored in t.data[1] and original found data in t.data[2]
"""
for t in targets:
for l in local_results:
if l.target == t.target:
t.data.append(
(
"LOCALSEARCH",
f"[{os.path.basename(l.filepath)}] Line {l.line}: {l.content}".strip(),
l.content.strip(),
)
)
t.pwned += 1
if user_args.debug:
c.debug_news(f"DEBUG: Found following content matching {t.target.target}")
l.target.dump()
return targets
response = requests.request(
url=url,
headers=self.headers,
method=meth,
timeout=timeout,
allow_redirects=redirs,
data=data,
params=params,
verify=verify,
)
# response = requests.request(url="http://127.0.0.1:8000", headers=self.headers, method=meth, timeout=timeout, allow_redirects=redirs, data=data, params=params)
if self.debug:
c.debug_news("DEBUG: Sent the following---------------------")
print(self.headers)
print(url, meth, data, params)
c.debug_news("DEBUG: Received the following---------------------")
c.debug_news(response.url)
c.debug_news("DEBUG: RESPONSE HEADER---------------------")
print(
"\n".join(
"{}: {}".format(k, v) for k, v in response.headers.items()
)
)
c.debug_news("DEBUG: RESPONSE BODY---------------------")
print(response.content)
# print(response)
except Exception as ex:
c.bad_news("Request could not be made for " + self.target)
print(url)
print(ex)
print(response)
return response
verify=verify,
)
# response = requests.request(url="http://127.0.0.1:8000", headers=self.headers, method=meth, timeout=timeout, allow_redirects=redirs, data=data, params=params)
if self.debug:
c.debug_news("DEBUG: Sent the following---------------------")
print(self.headers)
print(url, meth, data, params)
c.debug_news("DEBUG: Received the following---------------------")
c.debug_news(response.url)
c.debug_news("DEBUG: RESPONSE HEADER---------------------")
print(
"\n".join(
"{}: {}".format(k, v) for k, v in response.headers.items()
)
)
c.debug_news("DEBUG: RESPONSE BODY---------------------")
print(response.content)
# print(response)
except Exception as ex:
c.bad_news("Request could not be made for " + self.target)
print(url)
print(ex)
print(response)
return response
headers=self.headers,
method=meth,
timeout=timeout,
allow_redirects=redirs,
data=data,
params=params,
verify=verify,
)
# response = requests.request(url="http://127.0.0.1:8000", headers=self.headers, method=meth, timeout=timeout, allow_redirects=redirs, data=data, params=params)
if self.debug:
c.debug_news("DEBUG: Sent the following---------------------")
print(self.headers)
print(url, meth, data, params)
c.debug_news("DEBUG: Received the following---------------------")
c.debug_news(response.url)
c.debug_news("DEBUG: RESPONSE HEADER---------------------")
print(
"\n".join(
"{}: {}".format(k, v) for k, v in response.headers.items()
)
)
c.debug_news("DEBUG: RESPONSE BODY---------------------")
print(response.content)
# print(response)
except Exception as ex:
c.bad_news("Request could not be made for " + self.target)
print(url)
print(ex)
print(response)
return response