From f095c1d7e6aa2b0af3ed25dd28bdbfc8e4560d02 Mon Sep 17 00:00:00 2001 From: ertaku12 <21290158@ogrenci.ankara.edu.tr> Date: Sat, 21 Dec 2024 12:46:17 +0300 Subject: [PATCH 1/2] Fix: Ignore SSL verification errors in requests - Disabled SSL verification for requests that encounter SSL verification errors. - Added handling to suppress warnings related to insecure HTTPS requests. --- modules/commands.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/commands.py b/modules/commands.py index 738ce60..36b3601 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -1,17 +1,34 @@ import urllib.parse - import requests from data import payloads, types from modules import logger, transform +from requests.exceptions import SSLError +from requests.packages.urllib3.exceptions import InsecureRequestWarning +import warnings + +# Suppress the InsecureRequestWarning when SSL verification is disabled +warnings.simplefilter('ignore', InsecureRequestWarning) def execute(url: str, command: str) -> str: + """ + Execute a command on the target system using the specified URL. + - Ignores SSL verification errors + """ + if "SHELL" not in url: logger.log("Invalid URL. Please make sure the formatting is correct.") exit() command_string = url.replace("SHELL", command) - data = requests.get(command_string) + try: + # Attempt to make the request with SSL verification + data = requests.get(command_string) + except SSLError: + # If an SSL error occurs, retry the request with SSL verification disabled + logger.log("SSL verification failed. Retrying with verify=False.") + data = requests.get(command_string, verify=False) + return data.text From c642e5cf3d10a5c78872150adf1ddaf00937cd5f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 09:53:58 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- modules/commands.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/commands.py b/modules/commands.py index 36b3601..e0bdb0e 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -1,22 +1,23 @@ import urllib.parse +import warnings + import requests +from requests.exceptions import SSLError +from requests.packages.urllib3.exceptions import InsecureRequestWarning from data import payloads, types from modules import logger, transform -from requests.exceptions import SSLError -from requests.packages.urllib3.exceptions import InsecureRequestWarning -import warnings # Suppress the InsecureRequestWarning when SSL verification is disabled -warnings.simplefilter('ignore', InsecureRequestWarning) +warnings.simplefilter("ignore", InsecureRequestWarning) def execute(url: str, command: str) -> str: - """ - Execute a command on the target system using the specified URL. - - Ignores SSL verification errors """ - + Execute a command on the target system using the specified URL. + - Ignores SSL verification errors + """ + if "SHELL" not in url: logger.log("Invalid URL. Please make sure the formatting is correct.") exit()