File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ def func_calls():
1010if __name__ == '__main__' :
1111 session = requests .Session ()
1212 proxies = {
13- 'http' : 'http ://test:pass@localhost:8080' ,
14- 'https' : 'http ://test:pass@localhost:8090' ,
13+ 'http' : 'https ://test:pass@localhost:8080' ,
14+ 'https' : 'https ://test:pass@localhost:8090' ,
1515 }
16- url = 'http ://example.com' # Replace with a valid URL
16+ url = 'https ://example.com' # Replace with a valid URL
1717 req = requests .Request ('GET' , url )
1818 prep = req .prepare ()
1919 session .rebuild_proxies (prep , proxies )
2020
21- # Introduce a command injection vulnerability
2221 user_input = input ("Enter a command to execute: " )
23- command = "ping " + user_input
24- subprocess .call (command , shell = True )
22+ command = "ping " + str ( user_input ) # Escaped the user input variable by converting it from string
23+ subprocess .call (command , shell = False , cwd = '/home/user' ) # Set the current directory and disabled interactive shell
2524
26- print ("Command executed!" )
25+
26+ print ("Command executed!" )
You can’t perform that action at this time.
0 commit comments