Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Ignore SSL verification errors in requests #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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