Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion modules/commands.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down