Skip to content

Commit b59cfa2

Browse files
authored
Merge pull request #49 from abs0lut3pwn4g3/gssoc20-dev
Merge gssoc20-dev into master
2 parents 0432fb2 + eda8118 commit b59cfa2

File tree

18 files changed

+400
-149
lines changed

18 files changed

+400
-149
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Additional context**
32+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!--
2+
The title of the pull request should be of this format <Title_of_Issue>_resolved
3+
The PR should be raised only after making all changes relevant to the issue (all commits)
4+
-->
5+
6+
## Issue that this pull request solves
7+
8+
Closes: # (issue number)
9+
10+
## Proposed changes
11+
12+
Brief description of what is fixed or changed
13+
- Files changed
14+
- Dependencies if any (on other issues/PRs)
15+
- Basic tests done to validate
16+
- Conflicts if any (describe the reason for conflict)
17+
18+
## Types of changes
19+
20+
_Put an `x` in the boxes that apply_
21+
22+
- [ ] Bugfix (non-breaking change which fixes an issue)
23+
- [ ] New feature (non-breaking change which adds functionality)
24+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
25+
- [ ] Documentation update (Documentation content changed)
26+
- [ ] Other (please describe):
27+
28+
## Checklist
29+
30+
_Put an `x` in the boxes that apply_
31+
32+
- [ ] My code follows the style guidelines of this project
33+
- [ ] I have performed a self-review of my own code
34+
- [ ] I have commented my code, particularly in hard-to-understand areas
35+
- [ ] I have made corresponding changes to the documentation
36+
- [ ] My changes generate no new warnings
37+
38+
## Screenshots
39+
40+
Please attach the screenshots of the changes made in case of change in user interface
41+
42+
## Other information
43+
44+
Any other information that is important to this pull request
45+
46+
@ <!-- <tag mentor/project admin> to review and merge -->

.lgtm.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
queries:
2+
- exclude: py/similar-function
3+
- exclude: py/empty-except
4+
- include: py/undefined-placeholder-variable
5+
- include: py/uninitialized-local-variable
6+
- include: py/request-without-cert-validation
7+
- include: py/return-or-yield-outside-function
8+
- include: py/file-not-closed
9+
- include: py/exit-from-finally
10+
- include: py/ineffectual-statement
11+
- include: py/unused-global-variable
12+
- include: py/hardcoded-credentials
13+
- include: py/import-of-mutable-attribute
14+
- include: py/cyclic-import
15+
- include: py/unnecessary-lambda
16+
- include: py/print-during-import

.pylintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[FORMAT]
2+
indent-string=\t
3+
4+
[BASIC]
5+
6+
# Good variable names which should always be accepted, separated by a comma
7+
good-names=organization,RunningTime,box,userHash,rootHash,userScore,rootScore,admin,db,bcrypt

.travis.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
env: SKIP_INTERPRETER=true
3+
4+
branches:
5+
only:
6+
- master
7+
8+
language: python
9+
python:
10+
- "3.7.3"
11+
- "3.8.1"
12+
13+
env:
14+
global:
15+
- DATABASE_URL="postgres://postgres:@localhost:5432/travis_ci_test"
16+
services:
17+
- postgresql
18+
before_install:
19+
- psql -c 'create database travis_ci_test;' -U postgres
20+
21+
install:
22+
- "pip install -r src/requirements.txt"
23+
- pip install --no-cache-dir pytest-flake8
24+
- "python src/create_db.py"
25+
26+
27+
script:
28+
- pytest --lint-only --flake8

README.md

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
# RootTheBox CTF Framework
22

3-
[![Rawsec's CyberSecurity Inventory](https://inventory.rawsec.ml/img/badges/Rawsec-inventoried-FF5050_for-the-badge.svg)](https://inventory.rawsec.ml/)
4-
[![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com)
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"/>
6+
</a>
7+
<a href="https://travis-ci.com/abs0lut3pwn4g3/RTB-CTF-Framework">
8+
<img alt="Build Status" src="https://travis-ci.com/abs0lut3pwn4g3/RTB-CTF-Framework.svg?branch=gssoc20-dev"/>
9+
</a>
10+
</p>
511

6-
A lightweight, easy to deploy CTF framework(in Flask) for HackTheBox style machines. <br/>
7-
The main purpose of this project is to serve as a scoring engine and CTF manager.<br/>
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">
15+
</a>
16+
</p>
17+
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.
23+
24+
The main purpose of this project is to serve as a scoring engine and CTF manager.
25+
26+
**Want to see it in action?**
27+
28+
A live demo of the app is available at: <https://rtblivedemo.herokuapp.com/>.
829

9-
<b>Want to see it in action ?</b>
10-
11-
A live demo of the app is available at: https://rtblivedemo.herokuapp.com/. <br/>
1230
You can login and mess around as 2 users: `admin:admin` and `test:test`(i.e. username:password combinations)
1331

1432
## Features
@@ -99,11 +117,45 @@ Bonus: You can manage the database CRUD operations from admin views GUI as well
99117
100118
## Contributing
101119

102-
Please see: [issues](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues) and the below To-do list.
120+
<p align="center">
121+
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/graphs/contributors">
122+
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors-anon/abs0lut3pwn4g3/RTB-CTF-Framework?color=red&logo=github&style=for-the-badge">
123+
</a>
124+
<a href="https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues?q=is%3Aopen+is%3Aissue+label%3Agssoc20">
125+
<img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/abs0lut3pwn4g3/RTB-CTF-Framework/gssoc20?color=deeppink&style=for-the-badge">
126+
</a>
127+
</p>
128+
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+
Please see: [Issues](https://github.com/abs0lut3pwn4g3/RTB-CTF-Framework/issues) and the below To-do list.
103142

104143
> Note: All PRs within the GSSoC'20 period will be merged in the `gssoc20-dev` branch.
105144
106-
> Note: All PRs within the GSSoc'20 period will be merged in the `gssoc20-dev` branch.
145+
#### 👨 Project Owner
146+
147+
- Eshaan Bansal ([github](https://github.com/eshaan7),[linkedin](https://www.linkedin.com/in/eshaan7/))
148+
149+
#### 👬 Mentors
150+
151+
- Sombuddha Chakravarty ([github](https://github.com/sammy1997),[linkedin](https://www.linkedin.com/in/sombuddha-chakravarty-9482b5131/))
152+
153+
Feel free to ask your queries!! 🙌
154+
155+
#### Slack Channel
156+
157+
- [#proj_root-the-box-ctf-framework](https://app.slack.com/client/TRN1H1V43/CUC71PDD2)
158+
107159

108160
## To-do
109161

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# content of setup.cfg
2+
[tool:pytest]
3+
flake8-ignore = W191

src/FlaskRTBCTF/__init__.py

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,37 @@
1515
login_manager.login_message_category = 'info'
1616
mail = Mail()
1717

18+
1819
def create_app(config_class=Config):
19-
app = Flask(__name__)
20-
app.config.from_object(Config)
20+
app = Flask(__name__)
21+
app.config.from_object(Config)
2122

22-
db.init_app(app)
23-
bcrypt.init_app(app)
24-
login_manager.init_app(app)
25-
admin_manager.init_app(app)
26-
# Add model views
27-
from FlaskRTBCTF.admin.views import MyModelView
28-
from FlaskRTBCTF.models import User, Score, Notification
29-
if LOGGING:
30-
from FlaskRTBCTF.models import Logs
31-
admin_manager.add_view(MyModelView(User, db.session))
32-
admin_manager.add_view(MyModelView(Score, db.session))
33-
admin_manager.add_view(MyModelView(Notification, db.session))
34-
if LOGGING:
35-
admin_manager.add_view(MyModelView(Logs, db.session))
36-
mail.init_app(app)
23+
db.init_app(app)
24+
bcrypt.init_app(app)
25+
login_manager.init_app(app)
26+
admin_manager.init_app(app)
27+
# Add model views
28+
from FlaskRTBCTF.admin.views import MyModelView
29+
from FlaskRTBCTF.models import User, Score, Notification, Machine
30+
if LOGGING:
31+
from FlaskRTBCTF.models import Logs
32+
admin_manager.add_view(MyModelView(User, db.session))
33+
admin_manager.add_view(MyModelView(Score, db.session))
34+
admin_manager.add_view(MyModelView(Notification, db.session))
35+
admin_manager.add_view(MyModelView(Machine, db.session))
36+
if LOGGING:
37+
admin_manager.add_view(MyModelView(Logs, db.session))
38+
mail.init_app(app)
3739

38-
from flask_sslify import SSLify
39-
if 'DYNO' in os.environ: # only trigger SSLify if the app is running on Heroku
40-
sslify = SSLify(app)
40+
from flask_sslify import SSLify
41+
if 'DYNO' in os.environ: # only trigger SSLify if the app is running on Heroku
42+
_sslify = SSLify(app)
4143

42-
from FlaskRTBCTF.users.routes import users
43-
from FlaskRTBCTF.ctf.routes import ctf
44-
from FlaskRTBCTF.main.routes import main
45-
app.register_blueprint(users)
46-
app.register_blueprint(ctf)
47-
app.register_blueprint(main)
44+
from FlaskRTBCTF.users.routes import users
45+
from FlaskRTBCTF.ctf.routes import ctf
46+
from FlaskRTBCTF.main.routes import main
47+
app.register_blueprint(users)
48+
app.register_blueprint(ctf)
49+
app.register_blueprint(main)
4850

49-
return app
51+
return app

src/FlaskRTBCTF/config.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
from datetime import datetime
33
import pytz
44

5+
56
''' Flask related Configurations. Note: DO NOT FORGET TO CHANGE 'SECRET_KEY' ! '''
67

8+
79
class Config:
810
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
911
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///site.db'
@@ -26,7 +28,7 @@ class Config:
2628
"ctfname": "RootTheBox CTF",
2729
"name": "Abs0lut3Pwn4g3",
2830
"website": {
29-
"url": "https://Abs0lut3Pwn4g3.cf",
31+
"url": "https://Abs0lut3Pwn4g3.github.io/",
3032
"name": "Official Abs0lut3Pwn4g3 Website"
3133
},
3234
"website_2": {
@@ -43,26 +45,9 @@ class Config:
4345

4446
RunningTime = {
4547
"from": datetime(2019,7,7,15,00,00,0, pytz.utc),
46-
"to": datetime(2019,7,8,0,00,00,0, pytz.utc),
48+
"to": datetime(2030,7,8,0,00,00,0, pytz.utc),
4749
"TimeZone": "UTC"
48-
} # We do not recommended changing the Timezone.
49-
50-
# Specify Your Pwnable Box/Machine settings
51-
52-
box = {
53-
"name": "My Awesome Pwnable Box",
54-
"ip": "127.0.0.1",
55-
"os": "Linux",
56-
"points": { "user": 10, "root": 20 },
57-
"hardness": "You tell"
58-
}
59-
60-
# Specify The Hashes, you can use python's secrets package to generate them
61-
62-
userHash = 'A'*32 # dummy hash, length = 32 fixed
63-
rootHash = 'B'*32 # dummy hash, length = 32 fixed
64-
userScore = 10
65-
rootScore = 20
50+
} # We do not recommend changing the Timezone.
6651

6752
# Logging: Set to 'True' to enable Logging in Admin Views.
6853

0 commit comments

Comments
 (0)