Skip to content

Commit bdcf8ba

Browse files
author
patched.codes[bot]
committed
Patched main.py
1 parent 9e553e4 commit bdcf8ba

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

main.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import requests
22
import subprocess
3+
import shlex
34

45
if __name__ == '__main__':
56
formats.get_format()
@@ -8,17 +9,17 @@
89
sessions.SessionRedirectMixin.resolve_redirects()
910
session = requests.Session()
1011
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',
1314
}
14-
url = 'http://example.com' # Replace with a valid URL
15+
url = 'https://example.com' # Replace with a valid URL
1516
req = requests.Request('GET', url)
1617
prep = req.prepare()
1718
session.rebuild_proxies(prep, proxies)
1819

1920
# Introduce a command injection vulnerability
2021
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)
2324

24-
print("Command executed!")
25+
print("Command executed!")

0 commit comments

Comments
 (0)