File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 1
1
import requests
2
2
import subprocess
3
+ import shlex
3
4
4
5
if __name__ == '__main__' :
5
6
formats .get_format ()
8
9
sessions .SessionRedirectMixin .resolve_redirects ()
9
10
session = requests .Session ()
10
11
proxies = {
11
- 'http' : 'http ://test:pass@localhost:8080' ,
12
- 'https' : 'http ://test:pass@localhost:8090' ,
12
+ 'http' : 'https ://test:pass@localhost:8080' ,
13
+ 'https' : 'https ://test:pass@localhost:8090' ,
13
14
}
14
- url = 'http ://example.com' # Replace with a valid URL
15
+ url = 'https ://example.com' # Replace with a valid URL
15
16
req = requests .Request ('GET' , url )
16
17
prep = req .prepare ()
17
18
session .rebuild_proxies (prep , proxies )
18
19
19
20
# Introduce a command injection vulnerability
20
21
user_input = input ("Enter a command to execute: " )
21
- command = "ping " + user_input
22
- subprocess .call (command , shell = True )
22
+ command = "ping " + shlex . quote ( user_input )
23
+ subprocess .call (command , shell = False )
23
24
24
- print ("Command executed!" )
25
+ print ("Command executed!" )
You can’t perform that action at this time.
0 commit comments