Skip to content

Commit 38f100b

Browse files
author
patched.codes[bot]
committed
Patched /Users/codelion/Documents/GitHub/example-python/main.py
1 parent e24fb58 commit 38f100b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ def func_calls():
1010
if __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!")

0 commit comments

Comments
 (0)