Skip to content

Commit 492ad54

Browse files
author
patched.codes[bot]
committed
Patched /tmp/tmpeah5txzl/main.py
1 parent e24fb58 commit 492ad54

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import requests
22
import subprocess
3+
import shlex
34

45
def func_calls():
56
formats.get_format()
@@ -20,7 +21,7 @@ def func_calls():
2021

2122
# Introduce a command injection vulnerability
2223
user_input = input("Enter a command to execute: ")
23-
command = "ping " + user_input
24-
subprocess.call(command, shell=True)
24+
command = ["ping"] + shlex.split(user_input)
25+
subprocess.call(command, shell=False)
2526

26-
print("Command executed!")
27+
print("Command executed!")

0 commit comments

Comments
 (0)