Skip to content

Commit f07e323

Browse files
eshaan7Aman-Codeschttrjeankr
authored
merge gssoc20-dev into master (abs0lut3pwn4g3#53)
* update to conform with flake8/PEP8 | abs0lut3pwn4g3#47 * Update README.md * Create CODE_OF_CONDUCT.md (abs0lut3pwn4g3#51) * 1. psf/black formatting with travis checks, 2. adjust docs, create CONTRIBUTING.md, 3. helper fns for creating admin pass and secret key by itself on run create admin pass and secret key by itself on run * Update README.md Co-authored-by: Aman-Codes <[email protected]> Co-authored-by: Ankur Chattopadhyay <[email protected]>
1 parent 054bde9 commit f07e323

20 files changed

+495
-350
lines changed

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ install:
2121
- "pip install -r src/requirements.txt"
2222
- "python src/create_db.py"
2323

24+
before_script:
25+
- black . --check
2426
script:
25-
- pytest --flake8
27+
- flake8 . --count --max-line-length=88 --show-source --statistics

CODE_OF_CONDUCT.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
As contributors and maintainers of the RTB-CTF-Framework project, and in the interest
6+
of fostering an open and welcoming community, we pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at our Slack channel. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
[homepage]: https://www.contributor-covenant.org
69+
70+
For answers to common questions about this code of conduct, see
71+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
2+
# Contributing to RTB-CTF-Framework
3+
4+
<p align="center">
5+
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/graphs/contributors">
6+
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors-anon/abs0lut3pwn4g3/RTB-CTF-Framework?color=red&logo=github&style=for-the-badge">
7+
</a>
8+
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues?q=is%3Aopen+is%3Aissue+label%3Agssoc20">
9+
<img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/abs0lut3pwn4g3/RTB-CTF-Framework/gssoc20?color=deeppink&style=for-the-badge">
10+
</a>
11+
</p>
12+
13+
<p align="center">
14+
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues?q=is%3Aopen+is%3Aissue+label%3Aeasy">
15+
<img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/abs0lut3pwn4g3/RTB-CTF-Framework/easy?color=seagreen&style=for-the-badge">
16+
</a>
17+
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues?q=is%3Aopen+is%3Aissue+label%3Amedium">
18+
<img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/abs0lut3pwn4g3/RTB-CTF-Framework/medium?color=%23e99695&style=for-the-badge">
19+
</a>
20+
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues?q=is%3Aopen+is%3Aissue+label%3Ahard">
21+
<img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/abs0lut3pwn4g3/RTB-CTF-Framework/hard?color=%23cc317c%09&style=for-the-badge">
22+
</a>
23+
</p>
24+
25+
## This project makes use of the following Flask libraries
26+
27+
* Flask-blueprints for modularity and clean codebase,
28+
* Flask-admin for Admin views and easy realtime management,
29+
* Flask-SQLAlchemy for SQL models,
30+
* Flask-login for session handling,
31+
* Flask-wtf for responsive forms,
32+
* Flask-mail for mail service,
33+
* Flask-bcrypt for password hashing and security,
34+
35+
## Style Guide
36+
37+
Keeping to a consistent code style throughout the project makes it easier to contribute and collaborate. Please stick to the guidelines in PEP8, [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) and the Google Style Guide unless there’s a very good reason not to.
38+
39+
## Contact
40+
41+
##### 👨 Project Owner
42+
43+
- Eshaan Bansal ([github](https://github.com/eshaan7),[linkedin](https://www.linkedin.com/in/eshaan7/))
44+
45+
##### 👬 Mentors
46+
47+
- Sombuddha Chakravarty ([github](https://github.com/sammy1997),[linkedin](https://www.linkedin.com/in/sombuddha-chakravarty-9482b5131/))
48+
49+
Feel free to ask your queries!! 🙌
50+
51+
##### Slack Channel
52+
53+
- [#proj_root-the-box-ctf-framework](https://app.slack.com/client/TRN1H1V43/CUC71PDD2)
54+
55+
## Where to start ?
56+
57+
See: [Issues](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues) and the following To-do list. Or just ping one of the mentors with new ideas.
58+
59+
> Note: All PRs within the GSSoC'20 period will be merged in the `gssoc20-dev` branch.
60+
61+
## To-do
62+
63+
- [ ] Ideas for additional logging techniques to prevent flag sharing, cheating and such. (Issue: [#7](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/7))
64+
- [ ] Support for *n* number of boxes (accordions? seperate route?). (Issue: [#17](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/17))
65+
- [ ] Rating system: Average Box rating - input, calculate, output. (Issue: [#14](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/14))
66+
- [ ] Dark theme for `admin control` panel. (Issue: [#16](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/16))
67+
- [ ] Testing Password reset functionality, the mail-server setup, etc.
68+
- [ ] More info on `home.html`
69+
- [ ] Need to implement `account.html`
70+
- [ ] Support for more hashes per box (not a priority)
71+
72+
<hr/>
73+
74+
- [x] Freeze Scoreboard automatically past running time specified (Issue: [#3](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/3))
75+
- [x] Adding a `Deploy to Heroku` button. (Issue: [#15](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/15))
76+
- [x] Adding CI, Linting, Formatting specs. (Issue: [#18](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/18))
77+
- [x] db relationship between User and Score Tables (priority | issue: #5)
78+
- [x] isAdmin column in User table and Admin views (priority)
79+
- [x] Notifications
80+
- [x] Use Flask Blueprints
81+
- [x] Finalize black theme?
82+
- [x] Error messages not appearing in `/submit`
83+
- [x] Implement `machine.html` to server a page where one can download/serve machines

README.md

+60-94
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,80 @@
11
# RootTheBox CTF Framework
22

3-
<p align="center">
4-
<a href="https://lgtm.com/projects/g/abs0lut3pwn4g3/RTB-CTF-Framework/context:python">
5-
<img alt="Language grade: Python" src="https://img.shields.io/lgtm/grade/python/g/abs0lut3pwn4g3/RTB-CTF-Framework.svg?logo=lgtm&logoWidth=18"/>
3+
<p >
4+
<a href="https://inventory.rawsec.ml/" target="_blank">
5+
<img height="26px" alt="Rawsec's CyberSecurity Inventory" src="https://inventory.rawsec.ml/img/badges/Rawsec-inventoried-FF5050_for-the-badge.svg">
66
</a>
7-
<a href="https://travis-ci.com/abs0lut3pwn4g3/RTB-CTF-Framework">
7+
<img height="26px" src="https://forthebadge.com/images/badges/made-with-python.svg">
8+
</p>
9+
<p style="height:18px">
10+
<a href="https://travis-ci.com/abs0lut3pwn4g3/RTB-CTF-Framework" target="_blank">
811
<img alt="Build Status" src="https://travis-ci.com/abs0lut3pwn4g3/RTB-CTF-Framework.svg?branch=gssoc20-dev"/>
912
</a>
10-
</p>
11-
12-
<p align="center">
13-
<a href="https://inventory.rawsec.ml/">
14-
<img alt="Rawsec's CyberSecurity Inventory" src="https://inventory.rawsec.ml/img/badges/Rawsec-inventoried-FF5050_for-the-badge.svg">
13+
<!-- <a href="https://lgtm.com/projects/g/abs0lut3pwn4g3/RTB-CTF-Framework/context:python">
14+
<img alt="Language grade: Python" src="https://img.shields.io/lgtm/grade/python/g/abs0lut3pwn4g3/RTB-CTF-Framework.svg?logo=lgtm&logoWidth=18"/>
15+
</a> -->
16+
<a href="https://github.com/psf/black" target="_blank">
17+
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"/>
1518
</a>
1619
</p>
1720

18-
<p align="center">
19-
<img src="https://forthebadge.com/images/badges/made-with-python.svg">
20-
</p>
21-
22-
A lightweight, easy to deploy CTF framework(in Flask) for HackTheBox style machines.
21+
A lightweight, easy to deploy CTF framework (in Flask) for HackTheBox style machines.
2322

2423
The main purpose of this project is to serve as a scoring engine and CTF manager.
2524

2625
**Want to see it in action?**
2726

2827
A live demo of the app is available at: <https://rtblivedemo.herokuapp.com/>.
2928

30-
You can login and mess around as 2 users: `admin:admin` and `test:test`(i.e. username:password combinations)
29+
You can login and mess around as 2 users: `admin:admin` and `test:test` (i.e. username:password combinations)
3130

3231
## Features
3332

33+
##### For CTF hosters
34+
* A page to show relevant details about the machine such as name, IP, OS, points and difficulty level.
35+
* Automatic strong password for administrator
36+
* Well implemented controls for administrators providing features such as issuing notifications, database CRUD operations, full fledged logging,
37+
* Simple User Registration/login process, account management, Forgot password functionalities,
38+
* Flag submission (currently 2 flags: user and root),
39+
* Real time scoreboard tracking,
40+
* Easily deployable on Heroku.
41+
3442
##### For Developers & Contributors
3543
* Flask-blueprints for modularity and clean codebase,
3644
* Flask-admin for Admin views and easy realtime management,
3745
* Flask-SQLAlchemy for SQL models,
3846
* Flask-wtf for forms,
3947
* Flask-mail for mail service.
4048

41-
##### For CTF hosters
42-
* A page to show relevant details about the machine such as name, IP, OS, points and difficulty level.
43-
* Well implemented controls for administrators providing features such as issuing notifications, database CRUD operations, full fledged logging,
44-
* Simple User Registration/login process, account management, Forgot password functionalities,
45-
* Flag submission (currently 2 hashes: user and root),
46-
* Real time scoreboard tracking,
47-
* Easily deployable on Heroku.
49+
## Deployment
50+
51+
### Heroku
52+
53+
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
54+
55+
or do it manually,
56+
57+
1. Create your heroku app using `heroku` cli tool.
58+
59+
Follow the official guide by Heroku: https://devcenter.heroku.com/articles/getting-started-with-python#prepare-the-app
60+
61+
2. Provision Database add-on.
62+
63+
Add the following add on to your new app: https://elements.heroku.com/addons/heroku-postgresql
64+
65+
3. Creating database instance. In your heroku app directory,
66+
67+
```bash
68+
$ heroku run bash
69+
[heroku]$ python create_db.py
70+
```
71+
4. Your app should be live now. You can run `heroku open` to open it in browser.
72+
73+
### Docker
74+
75+
```bash
76+
$ docker-compose up
77+
```
4878

4979
## How To Use
5080

@@ -78,36 +108,13 @@ $ cd src/
78108
[venv]$ python run.py
79109
```
80110

81-
### Deployment using Heroku
111+
### Configuration For Your CTF
82112

83-
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
84-
85-
or do it manually,
86-
87-
1. Create your heroku app using `heroku` cli tool.
88-
89-
Follow the official guide by Heroku: https://devcenter.heroku.com/articles/getting-started-with-python#prepare-the-app
90-
91-
2. Provision Database add-on.
92-
93-
Add the following add on to your new app: https://elements.heroku.com/addons/heroku-postgresql
94-
95-
3. Creating database instance. In your heroku app directory,
96-
97-
```bash
98-
$ heroku run bash
99-
[heroku]$ python create_db.py
100-
```
101-
4. Your app should be live now. You can run `heroku open` to open it in browser.
102-
103-
104-
## For Your CTF
105-
106-
Using this as simple as anything.
113+
Using this as simple as anything.
107114

108115
1. Just configure your CTF settings in [`config.py`](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/blob/master/src/FlaskRTBCTF/config.py).
109116

110-
2. DO NOT FORGET to change admin credentials from [`create_db.py`](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/blob/master/src/create_db.py)
117+
2. When you run [`create_db.py`](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/blob/master/src/create_db.py), a strong and random 16 char password for the **admin** user is created and set in the environment variable `ADMIN_PASS`. On Heroku, you can reveal this password from your application's dashboard settings.
111118

112119
3. See database instance creation steps under How To Use.
113120

@@ -117,7 +124,7 @@ Bonus: You can manage the database CRUD operations from admin views GUI as well
117124
118125
## Contributing
119126

120-
<p align="center">
127+
<p>
121128
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/graphs/contributors">
122129
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors-anon/abs0lut3pwn4g3/RTB-CTF-Framework?color=red&logo=github&style=for-the-badge">
123130
</a>
@@ -126,61 +133,20 @@ Bonus: You can manage the database CRUD operations from admin views GUI as well
126133
</a>
127134
</p>
128135

129-
<p align="center">
130-
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues?q=is%3Aopen+is%3Aissue+label%3Aeasy">
131-
<img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/abs0lut3pwn4g3/RTB-CTF-Framework/easy?color=seagreen&style=for-the-badge">
132-
</a>
133-
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues?q=is%3Aopen+is%3Aissue+label%3Amedium">
134-
<img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/abs0lut3pwn4g3/RTB-CTF-Framework/medium?color=%23e99695&style=for-the-badge">
135-
</a>
136-
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues?q=is%3Aopen+is%3Aissue+label%3Ahard">
137-
<img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/abs0lut3pwn4g3/RTB-CTF-Framework/hard?color=%23cc317c%09&style=for-the-badge">
138-
</a>
139-
</p>
140-
141-
Keeping to a consistent code style throughout the project makes it easier to contribute and collaborate. Please stick to the guidelines in PEP8 and the Google Style Guide unless there’s a very good reason not to.
142-
Please see: [Issues](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues) and the following To-do list.
143-
144-
> Note: All PRs within the GSSoC'20 period will be merged in the `gssoc20-dev` branch.
145136

146137
##### 👨 Project Owner
147138

148-
- Eshaan Bansal ([github](https://github.com/eshaan7),[linkedin](https://www.linkedin.com/in/eshaan7/))
139+
- Eshaan Bansal ([github](https://github.com/eshaan7), [linkedin](https://www.linkedin.com/in/eshaan7/))
149140

150141
##### 👬 Mentors
151142

152-
- Sombuddha Chakravarty ([github](https://github.com/sammy1997),[linkedin](https://www.linkedin.com/in/sombuddha-chakravarty-9482b5131/))
143+
- Sombuddha Chakravarty ([github](https://github.com/sammy1997), [linkedin](https://www.linkedin.com/in/sombuddha-chakravarty-9482b5131/))
153144

154-
Feel free to ask your queries!! 🙌
155-
156-
##### Slack Channel
145+
##### Slack Channel for GSSoC 2020
157146

158147
- [#proj_root-the-box-ctf-framework](https://app.slack.com/client/TRN1H1V43/CUC71PDD2)
159148

160-
## To-do
161-
162-
- [ ] Ideas for additional logging techniques to prevent flag sharing, cheating and such. (Issue: [#7](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/7))
163-
- [ ] Support for *n* number of boxes (accordions? seperate route?). (Issue: [#17](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/17))
164-
- [ ] Rating system: Average Box rating - input, calculate, output. (Issue: [#14](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/14))
165-
- [ ] Dark theme for `admin control` panel. (Issue: [#16](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/16))
166-
- [ ] Testing Password reset functionality, the mail-server setup, etc.
167-
- [ ] More info on `home.html`
168-
- [ ] Support for more hashes per box (not a priority)
169-
- [ ] Need to implement `account.html` (not a priority)
170-
171-
<hr/>
172-
173-
- [x] Freeze Scoreboard automatically past running time specified (Issue: [#3](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/3))
174-
- [x] Adding a `Deploy to Heroku` button. (Issue: [#15](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/15))
175-
- [x] Adding CI, Linting, Formatting specs. (Issue: [#18](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues/18))
176-
- [x] db relationship between User and Score Tables (priority | issue: #5)
177-
- [x] isAdmin column in User table and Admin views (priority)
178-
- [x] Notifications
179-
- [x] Use Flask Blueprints
180-
- [x] Finalize black theme?
181-
- [x] Error messages not appearing in `/submit`
182-
- [x] Implement `machine.html` to server a page where one can download/serve machines
183-
149+
For further guidelines, Please refer to [CONTRIBUTING.md](CONTRIBUTING.md)
184150

185151
## Screenshots
186152

app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "RootTheBox CTF Framework",
3-
"description": "A lightweight, easy to deploy CTF framework(in Flask) for HackTheBox style machines.",
3+
"description": "A lightweight, easy to deploy CTF framework (in Flask) for HackTheBox style machines.",
44
"repository": "https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework",
55
"addons": [
66
{

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# content of setup.cfg
1+
# content of setup.cfg (deprecated atm)
22
[tool:pytest]
33
flake8-ignore = W191

0 commit comments

Comments
 (0)