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+ from shlex import quote
34
45if __name__ == '__main__' :
56 formats .get_format ()
910 session = requests .Session ()
1011 proxies = {
1112 'http' : 'http://test:pass@localhost:8080' ,
12- 'https' : 'http ://test:pass@localhost:8090' ,
13+ 'https' : 'https ://test:pass@localhost:8090' , # Changed http to https
1314 }
14- url = 'http ://example.com' # Replace with a valid URL
15+ url = 'https ://example.com' # Replace with a valid URL and changed http to https
1516 req = requests .Request ('GET' , url )
1617 prep = req .prepare ()
1718 session .rebuild_proxies (prep , proxies )
1819
19- # Introduce a command injection vulnerability
20+ # Fix for command injection vulnerability
2021 user_input = input ("Enter a command to execute: " )
21- command = "ping " + user_input
22+ safe_user_input = quote (user_input )
23+ command = "ping " + safe_user_input
2224 subprocess .call (command , shell = True )
2325
24- print ("Command executed!" )
26+ print ("Command executed!" )
You can’t perform that action at this time.
0 commit comments