Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandbox URL Creation #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions introduction/playground/A6/soln.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import requests
from security import safe_requests


def check_vuln(list_of_modules)->list:
vulns = []
for i in list_of_modules:
k = i.split("==")
url = f"https://pypi.org/pypi/{k[0]}/{k[1]}/json"
response = requests.get(url)
response = safe_requests.get(url)
response.raise_for_status()
info = response.json()
existing_vuln = info['vulnerabilities']
if len(existing_vuln) > 0:
vulns.append(existing_vuln)
return vulns
return vulns
30 changes: 15 additions & 15 deletions introduction/playground/A6/utility.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import requests
def check_vuln(list_of_modules)->list:
vulns = []
for i in list_of_modules:
k = i.split("==")
url = f"https://pypi.org/pypi/{k[0]}/{k[1]}/json"
response = requests.get(url)
response.raise_for_status()
info = response.json()
existing_vuln = info['vulnerabilities']
if len(existing_vuln) > 0:
vulns.append(existing_vuln)
return vulns
from security import safe_requests


def check_vuln(list_of_modules)->list:
vulns = []
for i in list_of_modules:
k = i.split("==")
url = f"https://pypi.org/pypi/{k[0]}/{k[1]}/json"
response = safe_requests.get(url)
response.raise_for_status()
info = response.json()
existing_vuln = info['vulnerabilities']
if len(existing_vuln) > 0:
vulns.append(existing_vuln)
return vulns
4 changes: 2 additions & 2 deletions introduction/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from xml.sax.handler import feature_external_ges

import jwt
import requests
import yaml
from argon2 import PasswordHasher
from django.contrib import messages
Expand All @@ -38,6 +37,7 @@
from .models import (FAANG, AF_admin, AF_session_id, Blogs, CF_user, authLogin,
comments, info, login, otp, sql_lab_table, tickits)
from .utility import customHash, filter_blog
from security import safe_requests

#*****************************************Lab Requirements****************************************************#

Expand Down Expand Up @@ -953,7 +953,7 @@ def ssrf_lab2(request):
elif request.method == "POST":
url = request.POST["url"]
try:
response = requests.get(url)
response = safe_requests.get(url)
return render(request, "Lab/ssrf/ssrf_lab2.html", {"response": response.content.decode()})
except:
return render(request, "Lab/ssrf/ssrf_lab2.html", {"error": "Invalid URL"})
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ urllib3==1.26.9
Werkzeug==2.1.2
whitenoise==6.2.0
zipp==3.8.0
security==1.3.1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library holds security tools for protecting Python API calls.

License: MITOpen SourceMore facts

Loading