Skip to content

Commit 58faa1c

Browse files
committed
Fixes #1043
1 parent 94b9074 commit 58faa1c

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

src/core/injections/controller/checks.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,25 @@ def remove_tags(data):
176176
return data.replace(settings.INJECT_TAG,"").replace(settings.CUSTOM_INJECTION_MARKER_CHAR,"").replace(settings.ASTERISK_MARKER, "").replace(settings.RANDOM_TAG, "")
177177

178178
"""
179-
Process data with custom injection marker character ('*').
179+
Process data with custom injection marker character ('*')
180180
"""
181181
def process_custom_injection_data(data):
182-
if settings.CUSTOM_INJECTION_MARKER != None and isinstance(data, str):
183-
_ = []
184-
for data in data.split("\\n"):
185-
if not data.startswith(settings.ACCEPT) and settings.CUSTOM_INJECTION_MARKER_CHAR in data:
186-
if menu.options.test_parameter != None and settings.CUSTOM_INJECTION_MARKER == False:
187-
data = remove_tags(data)
188-
# elif settings.CUSTOM_INJECTION_MARKER:
189-
data = data.replace(settings.CUSTOM_INJECTION_MARKER_CHAR, settings.ASTERISK_MARKER)
190-
_.append(data)
191-
data = "\\n".join((list(dict.fromkeys(_)))).rstrip("\\n")
192-
182+
if not isinstance(data, str):
183+
# Safely return empty string if input is not a valid string
184+
return ""
185+
186+
if settings.CUSTOM_INJECTION_MARKER is not None:
187+
lines = []
188+
for line in data.split("\\n"):
189+
if not line.startswith(settings.ACCEPT) and settings.CUSTOM_INJECTION_MARKER_CHAR in line:
190+
if menu.options.test_parameter is not None and settings.CUSTOM_INJECTION_MARKER is False:
191+
line = remove_tags(line)
192+
line = line.replace(settings.CUSTOM_INJECTION_MARKER_CHAR, settings.ASTERISK_MARKER)
193+
lines.append(line)
194+
195+
# Remove duplicates, then rejoin lines
196+
data = "\\n".join(list(dict.fromkeys(lines))).rstrip("\\n")
197+
193198
return data
194199

195200
"""

src/utils/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def sys_argv_errors():
262262
DESCRIPTION = "The command injection exploiter"
263263
AUTHOR = "Anastasios Stasinopoulos"
264264
VERSION_NUM = "4.1"
265-
REVISION = "59"
265+
REVISION = "60"
266266
STABLE_RELEASE = False
267267
VERSION = "v"
268268
if STABLE_RELEASE:

0 commit comments

Comments
 (0)