Skip to content

Commit cf5acef

Browse files
committed
Python Code Scanning example
1 parent 77613d4 commit cf5acef

File tree

211 files changed

+15108
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+15108
-2
lines changed

.all-contributorsrc

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"files": [
3+
"README.md"
4+
],
5+
"imageSize": 100,
6+
"commit": false,
7+
"contributors": [
8+
{
9+
"login": "pwned-17",
10+
"name": "pwned-17",
11+
"avatar_url": "https://avatars.githubusercontent.com/u/61360833?v=4",
12+
"profile": "https://github.com/pwned-17",
13+
"contributions": [
14+
"code"
15+
]
16+
},
17+
{
18+
"login": "prince-7",
19+
"name": "Aman Singh",
20+
"avatar_url": "https://avatars.githubusercontent.com/u/53997924?v=4",
21+
"profile": "https://github.com/prince-7",
22+
"contributions": [
23+
"code"
24+
]
25+
},
26+
{
27+
"login": "adeyosemanputra",
28+
"name": "adeyosemanputra",
29+
"avatar_url": "https://avatars.githubusercontent.com/u/24958168?v=4",
30+
"profile": "https://github.com/adeyosemanputra",
31+
"contributions": [
32+
"code",
33+
"doc"
34+
]
35+
},
36+
{
37+
"login": "gaurav618618",
38+
"name": "gaurav618618",
39+
"avatar_url": "https://avatars.githubusercontent.com/u/29380890?v=4",
40+
"profile": "https://github.com/gaurav618618",
41+
"contributions": [
42+
"code",
43+
"doc"
44+
]
45+
},
46+
{
47+
"login": "kUSHAL0601",
48+
"name": "MajAK",
49+
"avatar_url": "https://avatars.githubusercontent.com/u/29600964?v=4",
50+
"profile": "https://github.com/kUSHAL0601",
51+
"contributions": [
52+
"code"
53+
]
54+
},
55+
{
56+
"login": "JustinDPerkins",
57+
"name": "JustinPerkins",
58+
"avatar_url": "https://avatars.githubusercontent.com/u/60413733?v=4",
59+
"profile": "https://github.com/JustinDPerkins",
60+
"contributions": [
61+
"code"
62+
]
63+
},
64+
{
65+
"login": "Hkakashi",
66+
"name": "Liu Peng",
67+
"avatar_url": "https://avatars.githubusercontent.com/u/43193113?v=4",
68+
"profile": "https://github.com/Hkakashi",
69+
"contributions": [
70+
"code"
71+
]
72+
},
73+
{
74+
"login": "RupakBiswas-2304",
75+
"name": "Metaphor",
76+
"avatar_url": "https://avatars.githubusercontent.com/u/75058161?v=4",
77+
"profile": "https://github.com/RupakBiswas-2304",
78+
"contributions": [
79+
"code"
80+
]
81+
},
82+
{
83+
"login": "whokilleddb",
84+
"name": "whokilleddb",
85+
"avatar_url": "https://avatars.githubusercontent.com/u/56482137?v=4",
86+
"profile": "https://whokilleddb.github.io",
87+
"contributions": [
88+
"code"
89+
]
90+
}
91+
],
92+
"contributorsPerLine": 7,
93+
"projectName": "pygoat",
94+
"projectOwner": "adeyosemanputra",
95+
"repoType": "github",
96+
"repoHost": "https://github.com",
97+
"skipCi": true
98+
}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.env/
2+
*.pyc
3+
env
4+
pygoat/db.sqlite3
5+
venv
6+
*.sqlite3
7+
*db.sqlite3*
8+
app.log
9+
bin

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.formatting.provider": "yapf"
3+
}

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM python:3.11.0b1-buster
2+
3+
# set work directory
4+
WORKDIR /app
5+
6+
7+
# dependencies for psycopg2
8+
RUN apt-get update && apt-get install --no-install-recommends -y dnsutils=1:9.11.5.P4+dfsg-5.1+deb10u7 libpq-dev=11.16-0+deb10u1 python3-dev=3.7.3-1 \
9+
&& apt-get clean \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
13+
# Set environment variables
14+
ENV PYTHONDONTWRITEBYTECODE 1
15+
ENV PYTHONUNBUFFERED 1
16+
17+
18+
# Install dependencies
19+
RUN python -m pip install --no-cache-dir pip==22.0.4
20+
COPY requirements.txt requirements.txt
21+
RUN pip install --no-cache-dir -r requirements.txt
22+
23+
24+
# copy project
25+
COPY . /app/
26+
27+
28+
# install pygoat
29+
EXPOSE 8000
30+
31+
32+
RUN python3 /app/manage.py migrate
33+
WORKDIR /app/pygoat/
34+
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers","6", "pygoat.wsgi"]

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn pygoat.wsgi --log-file -

PyGoatBot.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
from chatterbot import ChatBot
2+
from chatterbot.logic import BestMatch
3+
from chatterbot.trainers import ListTrainer
4+
5+
# Dataset generated by ChatGPT
6+
training_data = [
7+
'What is OWASP PyGoat?',
8+
'OWASP PyGoat is an intentionally vulnerable web application used for learning web security testing.',
9+
'Why should I learn web security testing?',
10+
'Learning web security testing can help you understand how to identify and prevent web application attacks.',
11+
'What types of vulnerabilities can PyGoat help me learn about?',
12+
'PyGoat can help you learn about various types of web application vulnerabilities, including injection attacks, cross-site scripting (XSS), and broken authentication and session management.',
13+
'How can I use PyGoat to learn web security testing?',
14+
'PyGoat includes a series of lessons and challenges designed to teach you about web security testing techniques and common vulnerabilities.',
15+
'Is PyGoat suitable for beginners?',
16+
'Yes, PyGoat is designed to be accessible to beginners and experienced professionals alike.',
17+
'Where can I download PyGoat?',
18+
'You can download PyGoat from the official GitHub repository at https://github.com/OWASP/PyGoat',
19+
'Are there any resources available to help me get started with PyGoat?',
20+
'Yes, the PyGoat documentation includes a Getting Started guide and a list of additional resources to help you learn about web security testing.',
21+
'Can I contribute to PyGoat?',
22+
'Yes, PyGoat is an open-source project and welcomes contributions from anyone interested in improving the application.',
23+
]
24+
25+
chatbot = ChatBot(
26+
"PyGoatBot",
27+
storage_adapter="chatterbot.storage.SQLStorageAdapter",
28+
database_uri="sqlite:///database.sqlite3",
29+
logic_adapters=[
30+
{
31+
"import_path": "chatterbot.logic.BestMatch",
32+
"default_response": "I'm sorry, I'm not sure",
33+
"maximum_similarity_threshold": 0.80,
34+
}
35+
],
36+
)
37+
38+
trainer = ListTrainer(chatbot)
39+
trainer.train(training_data)
40+
41+
print("Welcome to PyGoatBot! Type 'q' or 'exit' to quit.")
42+
while True:
43+
try:
44+
user_input = input("You: ")
45+
if user_input.lower() == "exit" or user_input.lower() == "q":
46+
break
47+
48+
print("Available questions:")
49+
for i, question in enumerate(training_data[::2], start=1):
50+
print(f"{i}. {question}")
51+
52+
while True:
53+
try:
54+
question_index = int(input("Enter a number to select a question: "))
55+
break
56+
except ValueError:
57+
print("Please enter a valid number.")
58+
59+
question = training_data[(question_index - 1) * 2]
60+
response = chatbot.get_response(question)
61+
print(f"PyGoatBot: {response}")
62+
63+
except (KeyboardInterrupt, EOFError):
64+
break

README.md

Lines changed: 131 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,131 @@
1-
# Python_Example
2-
Intentionally vuln web Application Security in django. our roadmap build intentionally vuln web Application in django. The Vulnerability can based on OWASP top ten
1+
# PyGoat
2+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3+
[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-)
4+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
5+
6+
intentionally vuln web Application Security in django.
7+
our roadmap build intentionally vuln web Application in django. The Vulnerability can based on OWASP top ten
8+
<br>
9+
10+
Table of Contents
11+
=================
12+
13+
* [pygoat](#pygoat)
14+
* [Installation](#installation)
15+
* [From Sources](#from-sources)
16+
* [Docker Container](#docker-container)
17+
* [Installation Video](#installation-video)
18+
* [Uninstallation](#uninstallation)
19+
* [Solutions](/Solutions/solution.md)
20+
* [For Developers](/docs/dev_guide.md)
21+
22+
## Installation
23+
24+
### From Sources
25+
26+
To setup the project on your local machine:
27+
<br>
28+
29+
First, Clone the repository using GitHub website or git in Terminal
30+
```
31+
git clone https://github.com/adeyosemanputra/pygoat.git
32+
### To Download a specific branch
33+
git clone -b <branch_name> https://github.com/adeyosemanputra/pygoat.git
34+
```
35+
36+
#### Method 1
37+
38+
1. Install all app and python requirements using installer file - `bash installer.sh`
39+
2. Apply the migrations `python3 manage.py migrate`.<br>
40+
3. Finally, run the development server `python3 manage.py runserver`.<br>
41+
4. The project will be available at <http://127.0.0.1:8000>
42+
43+
#### Method 2
44+
45+
1. Install python3 requirements `pip install -r requirements.txt`.<br>
46+
2. Apply the migrations `python3 manage.py migrate`.<br>
47+
3. Finally, run the development server `python3 manage.py runserver`.<br>
48+
4. The project will be available at <http://127.0.0.1:8000>
49+
50+
#### Method 3
51+
52+
1. Install all app and python requirements using `setup.py` file - `pip3 install .`
53+
2. Apply the migrations `python3 manage.py migrate`.<br>
54+
3. Finally, run the development server `python3 manage.py runserver`.<br>
55+
4. The project will be available at <http://127.0.0.1:8000>
56+
57+
### Docker Container
58+
1. Install [Docker](https://www.docker.com)
59+
2. Run `docker pull pygoat/pygoat` or `docker pull pygoat/pygoat:latest`
60+
3. Run `docker run --rm -p 8000:8000 pygoat/pygoat:latest`
61+
4. Browse to <http://127.0.0.1:8000>
62+
5. Remove existing image using `docker image rm pygoat/pygoat` and pull again incase of any error
63+
64+
### From Docker-Compose
65+
1. Install [Docker](https://www.docker.com)
66+
2. Run `docker-compose up` or `docker-compose up -d`
67+
68+
### Build Docker Image and Run
69+
1. Clone the repository &ensp; `git clone https://github.com/adeyosemanputra/pygoat.git`
70+
2. Build the docker image from Dockerfile using &ensp; `docker build -f Dockerfile -t pygoat .`
71+
3. Run the docker image &ensp;`docker run --rm -p 8000:8000 pygoat:latest`
72+
4. Browse to <http://127.0.0.1:8000> or <http://0.0.0.0:8000>
73+
74+
### Installation video
75+
76+
1. From Source using `installer.sh`
77+
- [Installing PyGoat from Source](https://www.youtube.com/watch?v=7bYBJXG3FRQ)
78+
2. Without using `installer.sh`
79+
- [![](http://img.youtube.com/vi/rfzQiMeiwso/0.jpg)](http://www.youtube.com/watch?v=rfzQiMeiwso "Installation Pygoat")
80+
3. Install with Mac M1 (using Virtualenv)
81+
- [![](http://img.youtube.com/vi/rfzQiMeiwso/0.jpg)](https://youtu.be/a5UV7mUw580 "Install with Mac M1 - using Virtualenv")
82+
83+
84+
## Uninstallation
85+
86+
### On Debian/Ubuntu Based Systems
87+
- On Debian/Ubuntu based systems, you can use the `uninstaller.sh` script to uninstall `pygoat` along with all it's dependencies.
88+
- To uninstall `pygoat`, simply run:
89+
```bash
90+
$ bash ./uninstaller.sh
91+
```
92+
93+
### On Other Systems
94+
- On other systems, you can use the `uninstaller.py` script to uninstall `pygoat` along with all it's dependencies
95+
- To uninstall `pygoat`, simply run:
96+
```bash
97+
$ python3 uninstaller.py
98+
```
99+
100+
## Solutions
101+
<a href="/Solutions/solution.md">Solutions to all challenges</a>
102+
103+
## Contributors ✨
104+
105+
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
106+
107+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
108+
<!-- prettier-ignore-start -->
109+
<!-- markdownlint-disable -->
110+
<table>
111+
<tr>
112+
<td align="center"><a href="https://github.com/pwned-17"><img src="https://avatars.githubusercontent.com/u/61360833?v=4?s=100" width="100px;" alt=""/><br /><sub><b>pwned-17</b></sub></a><br /><a href="https://github.com/adeyosemanputra/pygoat/commits?author=pwned-17" title="Code">💻</a></td>
113+
<td align="center"><a href="https://github.com/prince-7"><img src="https://avatars.githubusercontent.com/u/53997924?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aman Singh</b></sub></a><br /><a href="https://github.com/adeyosemanputra/pygoat/commits?author=prince-7" title="Code">💻</a></td>
114+
<td align="center"><a href="https://github.com/adeyosemanputra"><img src="https://avatars.githubusercontent.com/u/24958168?v=4?s=100" width="100px;" alt=""/><br /><sub><b>adeyosemanputra</b></sub></a><br /><a href="https://github.com/adeyosemanputra/pygoat/commits?author=adeyosemanputra" title="Code">💻</a> <a href="https://github.com/adeyosemanputra/pygoat/commits?author=adeyosemanputra" title="Documentation">📖</a></td>
115+
<td align="center"><a href="https://github.com/gaurav618618"><img src="https://avatars.githubusercontent.com/u/29380890?v=4?s=100" width="100px;" alt=""/><br /><sub><b>gaurav618618</b></sub></a><br /><a href="https://github.com/adeyosemanputra/pygoat/commits?author=gaurav618618" title="Code">💻</a> <a href="https://github.com/adeyosemanputra/pygoat/commits?author=gaurav618618" title="Documentation">📖</a></td>
116+
<td align="center"><a href="https://github.com/kUSHAL0601"><img src="https://avatars.githubusercontent.com/u/29600964?v=4?s=100" width="100px;" alt=""/><br /><sub><b>MajAK</b></sub></a><br /><a href="https://github.com/adeyosemanputra/pygoat/commits?author=kUSHAL0601" title="Code">💻</a></td>
117+
<td align="center"><a href="https://github.com/JustinDPerkins"><img src="https://avatars.githubusercontent.com/u/60413733?v=4?s=100" width="100px;" alt=""/><br /><sub><b>JustinPerkins</b></sub></a><br /><a href="https://github.com/adeyosemanputra/pygoat/commits?author=JustinDPerkins" title="Code">💻</a></td>
118+
<td align="center"><a href="https://github.com/Hkakashi"><img src="https://avatars.githubusercontent.com/u/43193113?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Liu Peng</b></sub></a><br /><a href="https://github.com/adeyosemanputra/pygoat/commits?author=Hkakashi" title="Code">💻</a></td>
119+
</tr>
120+
<tr>
121+
<td align="center"><a href="https://github.com/RupakBiswas-2304"><img src="https://avatars.githubusercontent.com/u/75058161?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Metaphor</b></sub></a><br /><a href="https://github.com/adeyosemanputra/pygoat/commits?author=RupakBiswas-2304" title="Code">💻</a></td>
122+
<td align="center"><a href="https://whokilleddb.github.io"><img src="https://avatars.githubusercontent.com/u/56482137?v=4?s=100" width="100px;" alt=""/><br /><sub><b>whokilleddb</b></sub></a><br /><a href="https://github.com/adeyosemanputra/pygoat/commits?author=whokilleddb" title="Code">💻</a></td>
123+
</tr>
124+
</table>
125+
126+
<!-- markdownlint-restore -->
127+
<!-- prettier-ignore-end -->
128+
129+
<!-- ALL-CONTRIBUTORS-LIST:END -->
130+
131+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

Solutions/img/img4.png

26.2 KB
Loading

Solutions/img/pic1.png

52.9 KB
Loading

Solutions/img/pic2.png

41.9 KB
Loading

Solutions/img/pic3.png

177 KB
Loading

0 commit comments

Comments
 (0)