Skip to content

Commit 43fadcc

Browse files
committed
Update README.md
1 parent e9fec49 commit 43fadcc

File tree

6 files changed

+56
-5
lines changed

6 files changed

+56
-5
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ COPY requirements.txt requirements.txt
2121
RUN pip install --no-cache-dir -r requirements.txt
2222

2323

24+
# copy project
25+
COPY . /app/
26+
2427

2528
# install pygoat
2629
EXPOSE 8000

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PyGoat
1+
# PyGoat.
22
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
33
[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-)
44
<!-- ALL-CONTRIBUTORS-BADGE:END -->
@@ -126,3 +126,14 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
126126
<!-- ALL-CONTRIBUTORS-LIST:END -->
127127

128128
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
129+
blabla bla bla bla
130+
blaaaaaa
131+
rrrrr
132+
dddd
133+
eeeee
134+
JITTTT
135+
maptoenum
136+
color
137+
aaaaaaa
138+
aa111aa
139+
lllllllll

introduction/apis.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from introduction.playground.A9.main import Log
55
from introduction.playground.A6.utility import check_vuln
66
from django.contrib.auth import login,authenticate
7+
from .utility import *
78
from django.views.decorators.csrf import csrf_exempt
89
import time
910
from .views import authentication_decorator
@@ -17,10 +18,33 @@
1718
def ssrf_code_checker(request):
1819
if request.user.is_authenticated:
1920
if request.method == 'POST':
21+
python_code = request.POST['python_code']
22+
html_code = request.POST['html_code']
23+
if not (ssrf_code_converter(python_code)):
24+
return JsonResponse({"status": "error", "message": "Invalid code"})
25+
test_bench1 = ssrf_html_input_extractor(html_code)
26+
27+
if (len(test_bench1) >4):
28+
return JsonResponse({'message':'too many inputs in Html\n Try again'},status = 400)
29+
test_bench2 = ['secret.txt']
30+
correct_output1 = [{"blog": "blog1-passed"}, {"blog": "blog2-passed"}, {"blog": "blog3-passed"}, {"blog": "blog4-passed"}]
31+
outputs = []
32+
for inputs in test_bench1:
33+
outputs.append(main.ssrf_lab(inputs))
34+
if outputs == correct_output1:
35+
outputs = []
36+
else:
37+
return JsonResponse({'message':'Testbench failed, Code is not working\n Try again'},status = 200)
38+
39+
correct_output2 = [{"blog": "No blog found"}]
40+
for inputs in test_bench2:
41+
outputs.append(main.ssrf_lab(inputs))
42+
if outputs == correct_output2:
43+
return JsonResponse({'message':'Congratulation, you have written a secure code.', 'passed':1}, status = 200)
2044

2145
return JsonResponse({'message':'Test bench passed but the code is not secure'}, status = 200,safe = False)
2246
else:
23-
return JsonResponse({'message':'1method not allowed'},status = 405)
47+
return JsonResponse({'message':'method not allowed'},status = 405)
2448
else:
2549
return JsonResponse({'message':'UnAuthenticated User'},status = 401)
2650

@@ -58,7 +82,7 @@ def log_function_checker(request):
5882
f.close()
5983
return JsonResponse({"message":"success", "logs": lines},status = 200)
6084
else:
61-
return JsonResponse({"message":"2method not allowed"},status = 405)
85+
return JsonResponse({"message":"method not allowed"},status = 405)
6286

6387
#a7 codechecking api
6488
@csrf_exempt
@@ -96,7 +120,7 @@ def A6_disscussion_api(request):
96120
@csrf_exempt
97121
def A6_disscussion_api_2(request):
98122
if request.method != 'POST':
99-
return JsonResponse({"message":"3method not allowed"},status = 405)
123+
return JsonResponse({"message":"method not allowed"},status = 405)
100124
try:
101125
code = request.POST.get('code')
102126
dirname = os.path.dirname(__file__)

introduction/mitre.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ def csrf_transfer_monei_api(request,recipent,amount):
210210
# @authentication_decorator
211211
@csrf_exempt
212212
def mitre_lab_25_api(request):
213+
if request.method == "POST":
214+
expression = request.POST.get('expression')
215+
result = eval(expression)
216+
return JsonResponse({'result': result})
217+
else:
213218
return redirect('/mitre/25/lab/')
214219

215220

introduction/static/css/dark-theme.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ h2 {
406406
padding: 17px;
407407
border-radius: 10px;
408408
text-align: center;
409+
padding: 13% 0 0 0;
409410
}
410411
#owasp10_2017 {
411412
width: 90%;
@@ -416,6 +417,7 @@ h2 {
416417
padding: 17px;
417418
border-radius: 10px;
418419
text-align: center;
420+
padding: 13% 0 0 0;
419421
}
420422

421423
#sidebar li ul a #owasp10_2021 {
@@ -440,6 +442,7 @@ h2 {
440442
padding: 17px;
441443
border-radius: 10px;
442444
text-align: center;
445+
padding: 13% 0 0 0;
443446
}
444447

445448
#homeSubmenu {
@@ -461,6 +464,7 @@ h2 {
461464
padding: 17px;
462465
border-radius: 10px;
463466
text-align: center;
467+
padding: 13% 0% 0% 0%;
464468
}
465469
#challengeSubmenu {
466470
width: 95%;
@@ -484,6 +488,7 @@ h2 {
484488
padding: 17px;
485489
border-radius: 10px;
486490
text-align: center;
491+
padding: 13% 0% 0% 0%;
487492
}
488493
#mitre25 {
489494
width: 90%;
@@ -494,6 +499,7 @@ h2 {
494499
padding: 17px;
495500
border-radius: 10px;
496501
text-align: center;
502+
padding: 13% 0% 0% 0%;
497503
}
498504

499505
#stylesheet-toggle{

introduction/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ def sql_lab(request):
156156
print(sql_query)
157157
try:
158158
print("\nin try\n")
159-
val=""
159+
val=login.objects.raw(sql_query)
160+
val=login.objects.raw(sql_query)
161+
val=login.objects.raw(sql_query)
160162
except:
161163
print("\nin except\n")
162164
return render(

0 commit comments

Comments
 (0)