Skip to content

Commit

Permalink
Merge pull request #212 from za/isort-modules
Browse files Browse the repository at this point in the history
Sort importing modules using isort
  • Loading branch information
adeyosemanputra authored Feb 21, 2024
2 parents c11e842 + 19b5f28 commit 80c7370
Show file tree
Hide file tree
Showing 25 changed files with 102 additions and 67 deletions.
2 changes: 1 addition & 1 deletion PyGoatBot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.logic import BestMatch
from chatterbot.trainers import ListTrainer

# Dataset generated by ChatGPT
training_data = [
Expand Down
6 changes: 4 additions & 2 deletions introduction/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from django.contrib import admin
from .models import FAANG,info,login,comments,otp,tickits,CF_user,AF_admin,AF_session_id
from .models import CSRF_user_tbl

from .models import (FAANG, AF_admin, AF_session_id, CF_user, CSRF_user_tbl,
comments, info, login, otp, tickits)

# Register your models here.
admin.site.register(FAANG)
admin.site.register(info)
Expand Down
17 changes: 11 additions & 6 deletions introduction/apis.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import time

import requests
from django.contrib.auth import authenticate, login
from django.http import JsonResponse
from django.shortcuts import redirect
from introduction.playground.ssrf import main
from introduction.playground.A9.main import Log
from django.views.decorators.csrf import csrf_exempt

from introduction.playground.A6.utility import check_vuln
from django.contrib.auth import login,authenticate
from introduction.playground.A9.main import Log
from introduction.playground.ssrf import main

from .utility import *
from django.views.decorators.csrf import csrf_exempt
import time
from .views import authentication_decorator
import requests


# steps -->
# 1. covert input code to corrosponding code and write in file
# 2. extract inputs form 2nd code
Expand Down
1 change: 0 additions & 1 deletion introduction/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User


# Create your forms here.

class NewUserForm(UserCreationForm):
Expand Down
5 changes: 4 additions & 1 deletion introduction/lab_code/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# print("Stdout\n" + data)
print(data + stderr)
'''
import yaml, subprocess
import subprocess

import yaml

stream = open('/home/fox/test.yaml', 'r')
data = yaml.load(stream)

Expand Down
2 changes: 1 addition & 1 deletion introduction/migrations/0002_auto_20210414_1510.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 3.0.6 on 2021-04-14 09:40

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion introduction/migrations/0003_password_user.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 3.0.6 on 2021-04-15 10:50

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion introduction/migrations/0011_tickits.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 4.0.3 on 2022-03-19 11:21

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion introduction/migrations/0012_alter_tickits_user.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Generated by Django 4.0.3 on 2022-03-19 12:06

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion introduction/migrations/0015_blogs.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Generated by Django 4.0.2 on 2022-06-07 12:40

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
Expand Down
15 changes: 9 additions & 6 deletions introduction/mitre.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from django.http import HttpResponse, HttpResponseBadRequest, JsonResponse
from django.shortcuts import render, redirect
from .views import authentication_decorator
from hashlib import md5
import jwt
import datetime
import re
import subprocess
from .models import CSRF_user_tbl
from hashlib import md5

import jwt
from django.http import HttpResponse, HttpResponseBadRequest, JsonResponse
from django.shortcuts import redirect, render
from django.views.decorators.csrf import csrf_exempt

from .models import CSRF_user_tbl
from .views import authentication_decorator

# import os

## Mitre top1 | CWE:787
Expand Down
5 changes: 3 additions & 2 deletions introduction/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.db import models
from django.core.validators import MaxValueValidator
from django.conf import settings
from django.core.validators import MaxValueValidator
from django.db import models

# Create your models here.

class FAANG (models.Model):
Expand Down
1 change: 1 addition & 0 deletions introduction/playground/A6/soln.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import requests


def check_vuln(list_of_modules)->list:
vulns = []
for i in list_of_modules:
Expand Down
1 change: 1 addition & 0 deletions introduction/playground/A6/utility.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import requests


def check_vuln(list_of_modules)->list:
vulns = []
for i in list_of_modules:
Expand Down
2 changes: 2 additions & 0 deletions introduction/playground/A9/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt

from .main import Log


@csrf_exempt
def log_function_target(request):
L = Log(request)
Expand Down
4 changes: 4 additions & 0 deletions introduction/playground/A9/archive.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt

from .main import Log


@csrf_exempt
def log_function_target(request):
L = Log(request)
Expand Down Expand Up @@ -34,6 +36,8 @@ def log_function_target(request):
# ======================================

import datetime


# f = open('test.log', 'a') --> use this file to log
class Log:
def __init__(self,request):
Expand Down
2 changes: 2 additions & 0 deletions introduction/playground/A9/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import datetime


# f = open('test.log', 'a') --> use this file to log
class Log:
def __init__(self,request):
Expand Down
2 changes: 2 additions & 0 deletions introduction/playground/ssrf/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os


def ssrf_lab(file):
try:
dirname = os.path.dirname(__file__)
Expand Down
5 changes: 3 additions & 2 deletions introduction/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.urls import path,include
from django.urls import include, path

from .import views, apis, mitre
from introduction.playground.A9.api import log_function_target

from . import apis, mitre, views

urlpatterns = [
path('accounts/', include('allauth.urls')),
path('', views.home, name='homepage'),
Expand Down
5 changes: 4 additions & 1 deletion introduction/utility.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import hashlib
import os
import uuid

from .models import *
import hashlib


# import re
def ssrf_code_converter(code):
list_input = code.split("\n")
Expand Down
69 changes: 36 additions & 33 deletions introduction/views.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
import base64
import datetime
import hashlib
from django.shortcuts import render,redirect
from django.http import HttpResponse, HttpResponseBadRequest, JsonResponse
from .models import FAANG, AF_session_id,info,login,comments,authLogin, tickits, sql_lab_table,Blogs,CF_user,AF_admin
from django.core import serializers
from requests.structures import CaseInsensitiveDict
from django.contrib.auth import login,authenticate
from django.contrib.auth.forms import UserCreationForm
import json
import logging
import os
import pickle
import random
import re
import string
import os
import subprocess
import uuid
from dataclasses import dataclass
from hashlib import md5
import datetime
from .forms import NewUserForm
from django.contrib import messages
#*****************************************Lab Requirements****************************************************#

from .models import FAANG,info,login,comments,otp
from io import BytesIO
from random import randint
from xml.dom.pulldom import parseString, START_ELEMENT
from xml.sax.handler import feature_external_ges
from xml.dom.pulldom import START_ELEMENT, parseString
from xml.sax import make_parser
from django.views.decorators.csrf import csrf_exempt
from django.template import loader
from django.template.loader import render_to_string
import subprocess
import pickle
import base64
import yaml
import json
from dataclasses import dataclass
import uuid
from .utility import filter_blog, customHash
from xml.sax.handler import feature_external_ges

import jwt
from PIL import Image,ImageMath
import base64
from io import BytesIO
from argon2 import PasswordHasher
import logging
import requests
import re
import yaml
from argon2 import PasswordHasher
from django.contrib import messages
from django.contrib.auth import authenticate, login
from django.contrib.auth.forms import UserCreationForm
from django.core import serializers
from django.http import HttpResponse, HttpResponseBadRequest, JsonResponse
from django.shortcuts import redirect, render
from django.template import loader
from django.template.loader import render_to_string
from django.views.decorators.csrf import csrf_exempt
from PIL import Image, ImageMath
from requests.structures import CaseInsensitiveDict

from .forms import NewUserForm
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

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

#*****************************************Login and Registration****************************************************#

def register(request):
Expand Down Expand Up @@ -1077,6 +1079,7 @@ def crypto_failure_lab3(request):
#-----------------------------------------------SECURITY MISCONFIGURATION -------------------
from pygoat.settings import SECRET_COOKIE_KEY


def sec_misconfig_lab3(request):
if not request.user.is_authenticated:
return redirect('login')
Expand Down
1 change: 1 addition & 0 deletions pygoat/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import os

import django_heroku

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
Expand Down
4 changes: 2 additions & 2 deletions pygoat/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from introduction import views as v
from django.contrib.auth import views as auth_views
from django.urls import include, path

from introduction import views as v

urlpatterns = [
path('admin/', admin.site.urls),
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
from setuptools import setup, find_packages
import pathlib
import pathlib

from setuptools import find_packages, setup

here = pathlib.Path(__file__).parent.resolve()

Expand Down
7 changes: 4 additions & 3 deletions uninstaller.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env python3
import os
import sys
import ctypes
import os
import platform
import colorama
import subprocess
import sys
from shutil import rmtree, which

import colorama


# Platform indepent way to check if user is admin
def is_user_admin():
Expand Down

0 comments on commit 80c7370

Please sign in to comment.