forked from veracode/example-python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (23 loc) · 805 Bytes
/
main.py
File metadata and controls
27 lines (23 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import requests
import subprocess
import shlex
def func_calls():
formats.get_format()
algorithms.HMACAlgorithm.prepare_key()
cli.VerifyOperation.perform_operation()
sessions.SessionRedirectMixin.resolve_redirects()
if __name__ == '__main__':
session = requests.Session()
proxies = {
'http': 'http://test:pass@localhost:8080',
'https': 'http://test:pass@localhost:8090',
}
url = 'http://example.com' # Replace with a valid URL
req = requests.Request('GET', url)
prep = req.prepare()
session.rebuild_proxies(prep, proxies)
# Fixed command injection vulnerability
user_input = input("Enter a command to execute: ")
command = "ping " + shlex.quote(user_input)
subprocess.call(command, shell=True)
print("Command executed!")