File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 11import requests
22import subprocess
3+ import shlex
34
45def func_calls ():
56 formats .get_format ()
@@ -11,16 +12,17 @@ def func_calls():
1112 session = requests .Session ()
1213 proxies = {
1314 'http' : 'http://test:pass@localhost:8080' ,
14- 'https' : 'http ://test:pass@localhost:8090' ,
15+ 'https' : 'https ://test:pass@localhost:8090' , # Changed http to https for secure transmission
1516 }
16- url = 'http ://example.com' # Replace with a valid URL
17+ url = 'https ://example.com' # Changed http to https for secure transmission
1718 req = requests .Request ('GET' , url )
1819 prep = req .prepare ()
1920 session .rebuild_proxies (prep , proxies )
2021
21- # Introduce a command injection vulnerability
22+ # Fix for command injection vulnerability
2223 user_input = input ("Enter a command to execute: " )
23- command = "ping " + user_input
24+ safe_user_input = shlex .quote (user_input )
25+ command = "ping " + safe_user_input
2426 subprocess .call (command , shell = True )
2527
26- print ("Command executed!" )
28+ print ("Command executed!" )
You can’t perform that action at this time.
0 commit comments