Skip to content

Commit 11e9d7b

Browse files
author
patched.codes[bot]
committed
Patched /Users/user/Documents/GitHub/example-python/main.py
1 parent 5d102c2 commit 11e9d7b

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

main.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import requests
22
import subprocess
3+
from django.http import JsonResponse
34

45
def func_calls():
56
formats.get_format()
@@ -8,19 +9,14 @@ def func_calls():
89
sessions.SessionRedirectMixin.resolve_redirects()
910

1011
if __name__ == '__main__':
11-
session = requests.Session()
12-
proxies = {
13-
'http': 'http://test:pass@localhost:8080',
14-
'https': 'http://test:pass@localhost:8090',
15-
}
16-
url = 'http://example.com' # Replace with a valid URL
17-
req = requests.Request('GET', url)
18-
prep = req.prepare()
19-
session.rebuild_proxies(prep, proxies)
12+
from django.urls import path
13+
from django.views.decorators.http import require_http_methods
14+
from django.http import HttpResponse
2015

21-
# Introduce a command injection vulnerability
22-
user_input = input("Enter a command to execute: ")
23-
command = "ping " + user_input
24-
subprocess.call(command, shell=True)
16+
@require_http_methods(["GET"])
17+
def health(request):
18+
return HttpResponse("ok")
2519

26-
print("Command executed!")
20+
urlpatterns = [
21+
path('health', health)
22+
]

0 commit comments

Comments
 (0)