Skip to content

Commit 21ae3c0

Browse files
author
patched.codes[bot]
committed
Patched: "/tmp/tmpoo_lsvqj/main.py"
1 parent e24fb58 commit 21ae3c0

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()
@@ -18,9 +19,9 @@ def func_calls():
1819
prep = req.prepare()
1920
session.rebuild_proxies(prep, proxies)
2021

21-
# Introduce a command injection vulnerability
22+
# Fixed command injection vulnerability
2223
user_input = input("Enter a command to execute: ")
23-
command = "ping " + user_input
24+
command = "ping " + shlex.quote(user_input)
2425
subprocess.call(command, shell=True)
2526

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

0 commit comments

Comments
 (0)