Skip to content

Commit 4cf05cb

Browse files
committed
setup page, multiple machines, add new btns
1 parent 471a18a commit 4cf05cb

File tree

14 files changed

+282
-303
lines changed

14 files changed

+282
-303
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ install:
2424
before_script:
2525
- black . --check
2626
script:
27-
- flake8 . --count --max-line-length=88 --show-source --statistics
27+
- flake8 . --count --max-line-length=88 --exclude="src/FlaskRTBCTF/utils/__init__.py" --show-source --statistics

src/FlaskRTBCTF/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/FlaskRTBCTF/helpers.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/FlaskRTBCTF/static/main.css

Lines changed: 65 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
11
@import url("https://fonts.googleapis.com/css?family=Raleway:200,300,400,500,600");
22

3+
:root {
4+
--primary-color: #ce1b28;
5+
--secondary-color: #2c2f36;
6+
--dark-color: #101010;
7+
--light-color: #C9D3E7;
8+
}
9+
310
body {
4-
background: #2c2f36;
5-
color: #C9D3E7 !important;
11+
background: var(--secondary-color);
12+
color: var(--light-color) !important;
613
margin-top: 5rem;
714
font-family: "Raleway", Arial, Helvetica, sans-serif;
815
line-height: 1.65;
916
font-size: 12pt;
1017
}
1118

1219
h1, h2, h3, h4, h5, h6 {
13-
color: #C9D3E7;
20+
color: var(--light-color);
1421
}
1522

1623
hr {
17-
background-color: #C9D3E7;
24+
background-color: var(--light-color);
25+
}
26+
27+
.bg-dark {
28+
background-color: var(--dark-color) !important;
1829
}
1930

20-
.bg-steel {
21-
background-color: #101010;
31+
.bg-primary {
32+
background-color: var(--primary-color) !important;
2233
}
2334

2435
.site-header .navbar-nav .nav-link {
2536
color: #bbbbbb;
2637
}
2738

2839
.site-header .navbar-nav .nav-link:hover {
29-
color: #ce1b28;
40+
color: var(--primary-color);
3041
}
3142

3243
.site-header .navbar-nav .nav-link.active {
@@ -41,7 +52,8 @@ hr {
4152
}
4253

4354
a.red-link {
44-
color: #ce1b28 !important;
55+
cursor: pointer;
56+
color: var(--primary-color) !important;
4557
font-size: 17px;
4658
}
4759

@@ -50,52 +62,60 @@ a.red-link:hover {
5062
}
5163

5264
a.red-underlined-link {
53-
color: #ce1b28 !important;
65+
color: var(--primary-color) !important;
5466
text-decoration: underline;
5567
}
5668

5769
a:hover, .btn-hover-red:hover {
58-
color: #ce1b28 !important;
70+
color: var(--primary-color) !important;
5971
text-decoration: none !important;
6072
}
6173

6274
.title-heading {
63-
color: #C9D3E7 !important;
75+
color: var(--light-color) !important;
6476
}
6577

78+
/* machine.html */
79+
6680
.machine-heading {
6781
font-size: 2.5rem;
68-
background: #101010;
82+
background: var(--dark-color);
6983
text-align: center;
70-
box-shadow: 0 7px 16px 0 #ce1b28;
84+
box-shadow: 0 7px 16px 0 var(--primary-color);
7185
box-sizing: border-box;
7286
}
7387

88+
89+
.btn-sm {
90+
border-radius: 10%;
91+
cursor: pointer;
92+
}
93+
7494
/* custom bootstrap */
7595

7696
.table-responsive {
77-
box-shadow: 0px 9px 18px 0px #101010 !important;
97+
box-shadow: 0px 9px 18px 0px var(--dark-color) !important;
7898
}
7999

80100
.table-row-odd {
81-
background-color: #2c2f36;
101+
background-color: var(--secondary-color);
82102
color: #fff;
83103
}
84104

85105
.table-row-even {
86-
background: #101010;
106+
background: var(--dark-color);
87107
color: #fff;
88108
padding: 10px !important;
89-
box-shadow: 69px 10px 18px 0 #ce1b28 !important;
109+
box-shadow: 69px 10px 18px 0 var(--primary-color) !important;
90110
box-sizing: border-box;
91111
border-collapse: collapse;
92112
}
93113

94114
.content-section, .jumbotron {
95115
background: rgba(35,36,39,0.95);
96116
padding: 10px 20px;
97-
color: #C9D3E7;
98-
border: 1px solid #2c2f36;
117+
color: var(--light-color);
118+
border: 1px solid var(--secondary-color);
99119
box-shadow: 0 9px 18px 0 rgba(0,0,0,0.25);
100120
box-sizing: border-box;
101121
border-radius: 3px;
@@ -108,17 +128,17 @@ a:hover, .btn-hover-red:hover {
108128
}
109129

110130
.card {
111-
background: #101010;
131+
background: var(--dark-color);
112132
padding: 10px 20px;
113-
color: #C9D3E7;
114-
border: 1px solid #2c2f36;
115-
box-shadow: 0 5px 18px 0 #ce1b28;
133+
color: var(--light-color);
134+
border: 1px solid var(--secondary-color);
135+
box-shadow: 0 5px 18px 0 var(--primary-color);
116136
box-sizing: border-box;
117137
margin-bottom: 20px;
118138
}
119139

120140
.custom-checkbox .custom-control-input:checked ~ .custom-control-label::after{
121-
background-color: #ce1b28 !important;
141+
background-color: var(--primary-color) !important;
122142
}
123143

124144
.form-control {
@@ -134,28 +154,40 @@ a:hover, .btn-hover-red:hover {
134154
}
135155

136156
ul.list-group a.list-group-item {
137-
background: #2c2f36;
138-
color: #C9D3E7;
157+
background: var(--secondary-color);
158+
color: var(--light-color);
139159
box-shadow: 0 9px 18px 0 rgba(0,0,0,0.25);
140160
box-sizing: border-box;
141161
}
142162

143163
.alert-success {
144-
color: #ce1b28 !important;
145-
background-color: #101010 !important;
146-
border: 1px solid #2c2f36 !important;
164+
color: var(--primary-color) !important;
165+
background-color: var(--dark-color) !important;
166+
border: 1px solid var(--secondary-color) !important;
147167
box-sizing: border-box;
148168
border-radius: 3px;
149169
box-shadow: 0 9px 18px 0 rgba(0,0,0,0.25) !important;
150170
}
151171

152-
.alert-info, .alert-danger{
153-
color: #101010 !important;
154-
background-color: #ce1b28 !important;
172+
.alert-info, .alert-danger {
173+
color: var(--dark-color) !important;
174+
background-color: var(--primary-color) !important;
155175
opacity: 0.8;
156176
filter: alpha(opacity=30);
157-
border: 1px solid #2c2f36 !important;
177+
border: 1px solid var(--secondary-color) !important;
158178
box-sizing: border-box;
159179
border-radius: 3px;
160180
box-shadow: 0 9px 18px 0 rgba(0,0,0,0.25) !important;
161181
}
182+
183+
184+
/* Setup.html */
185+
186+
.line {
187+
background-color: #bbbbbb !important;
188+
}
189+
190+
.active .bs-stepper-circle {
191+
background-color: var(--light-color) !important;
192+
color: var(--dark-color) !important;
193+
}

src/FlaskRTBCTF/templates/account.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
{% block content %}
55

66
<div class="content-section">
7-
<h3>Username:</h3><span>{{ current_user.username }}</span>
7+
<h4>Username:</h4><span>{{ current_user.username }}</span>
88
<hr/>
9-
<h3>Email: </h3>
9+
<h4>Email:</h4>
1010
<span>{{ current_user.email }}</span>
1111
</div>
1212

src/FlaskRTBCTF/templates/home.html

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
<div class="content-section">
55
<div class="jumbotron jumbotron-fluid">
66
<div class="container">
7-
<h1 class="display-5">Welcome to {{ organization['ctfname'] }}</h1>
7+
<h1 class="display-5">Welcome to {{ settings.ctf_name }}</h1>
88
{% if current_user.is_authenticated %}
9-
<p class="lead">If you owned the box then you can submit the hashes <a class="red-underlined-link" href="{{ url_for('ctf.machine') }}">here</a>.</p>
9+
<p class="lead">
10+
If you owned the box then you can submit the hashes
11+
<a class="red-underlined-link" href="{{ url_for('ctf.machines') }}">here
12+
</a>
13+
.
14+
</p>
1015
{% else %}
1116
<p class="lead">You need to <a class="red-underlined-link" href="{{ url_for('users.login') }}">login</a> first.</p>
1217
{% endif %}
@@ -18,12 +23,18 @@ <h1 class="display-5">Welcome to {{ organization['ctfname'] }}</h1>
1823
<h2 class="title-heading">Rules</h2>
1924
<hr/>
2025
<ul>
21-
<li>Running time: <code>{{ RunningTime['from'].strftime("%Y-%m-%d %I:%M %p") }}</code> to <code>{{ RunningTime['to'].strftime("%Y-%m-%d %I:%M %p") }}</code> (All times in <code>{{ RunningTime['TimeZone'] }}</code>)</li>
26+
<li>Running time:
27+
<code>{{ RunningTime['from'].strftime("%Y-%m-%d %I:%M %p") }}</code>
28+
to
29+
<code>{{ RunningTime['to'].strftime("%Y-%m-%d %I:%M %p") }}</code>
30+
(All times in <code>UTC</code>)
31+
</li>
2232
<li>Needless to say: no bruteforcing (you'll never guess, anyway)</li>
23-
<li>Automated vulnerability scanners will get you nowhere(we know 'cause we made the box)</li>
33+
<li>Automated vulnerability scanners will get you nowhere (we know 'cause we made the box)</li>
2434
<li>Attacking this CTF infrastructure website is unnecessary. There are no hints.
2535
This website is for the sole purpose of registration, hash submission and management.</li>
26-
<li>We have tested the machine multiple, I repeat multiple times so if you are receiving a status code of 404 or 301. Figure it out yourself!</li>
36+
<li>We have tested the machine multiple, I repeat multiple times so if you are receiving a status code of 404 or 301.
37+
Figure it out yourself!</li>
2738
<li>Have fun! :)</li>
2839
</ul>
2940
</div>

src/FlaskRTBCTF/templates/layout.html

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,26 @@
88
<!-- Favicon -->
99
<link rel='shortcut icon' type='image/x-icon' href="{{ url_for('static', filename='favicon.ico')}}"/>
1010
<!-- Bootstrap CSS -->
11-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
11+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
1212
<!-- Font Awesome -->
13-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css">
13+
<link rel="stylesheet" type="text/css"
14+
href="https://use.fontawesome.com/releases/v5.6.3/css/all.css">
1415
<!-- local css -->
15-
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">
16+
<link rel="stylesheet" type="text/css"
17+
href="{{ url_for('static', filename='main.css') }}">
1618
<!-- Title -->
1719
{% if title %}
18-
<title>{{ organization['ctfname'] }} - {{ title }}</title>
20+
<title>{{ settings.ctf_name }} - {{ title }}</title>
1921
{% else %}
20-
<title>{{ organization['ctfname'] }}</title>
22+
<title>{{ settings.ctf_name }}</title>
2123
{% endif %}
2224
</head>
2325
<body>
2426

2527
<header class="site-header">
26-
<nav class="navbar navbar-expand-md navbar-dark bg-steel fixed-top">
28+
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
2729
<div class="container">
28-
<a class="navbar-brand mr-4" href="/">{{ organization['ctfname'] }}</a>
30+
<a class="navbar-brand mr-4" href="/">{{ settings.ctf_name }}</a>
2931
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggle" aria-controls="navbarToggle" aria-expanded="false" aria-label="Toggle navigation">
3032
<span class="navbar-toggler-icon"></span>
3133
</button>
@@ -34,13 +36,14 @@
3436
<a class="nav-item nav-link" href="{{ url_for('main.home') }}">Home</a>
3537
<a class="nav-item nav-link" href="{{ url_for('main.notifications') }}">Notifications</a>
3638
<a class="nav-item nav-link" href="{{ url_for('ctf.scoreboard') }}">Scoreboard</a>
37-
<a class="nav-item nav-link" href="{{ url_for('ctf.machine') }}">Machine</a>
39+
<a class="nav-item nav-link" href="{{ url_for('ctf.machines') }}">Machines</a>
3840
</div>
3941
<!-- Navbar Right Side -->
4042
<div class="navbar-nav">
4143
{% if current_user.is_authenticated %}
4244
{% if current_user.isAdmin %}
4345
<a class="nav-item nav-link" href="/admin">Admin Controls</a>
46+
<a class="nav-item nav-link" href="/setup">Setup</a>
4447
{% endif %}
4548
<a class="nav-item nav-link" href="{{ url_for('users.account') }}">@{{ current_user.username }}</a>
4649
<a class="nav-item nav-link" href="{{ url_for('users.logout') }}">Logout</a>
@@ -74,26 +77,44 @@
7477
{% endfor %}
7578
{% endif %}
7679
{% endwith %}
80+
81+
<!-- All the main content goes here -->
7782
{% block content %}{% endblock %}
83+
7884
</div>
7985
<div class="col-md-4">
8086
<div class="content-section">
81-
<h3>{{ organization['name'] }}</h3>
82-
<p class='text-muted'>{{ organization['tagline'] }}
87+
<h3>{{ settings.organization_name }}</h3>
88+
<p class="text-muted">
8389
<ul class="list-group">
84-
<a target="_blank" href="{{ organization['website']['url'] }}" class="list-group-item list-group-item-action">{{ organization['website']['name'] }}</a>
85-
<a target="_blank" href="{{ organization['website_2']['url'] }}" class="list-group-item list-group-item-action">{{ organization['website_2']['name'] }}</a>
86-
<a target="_blank" href="{{ organization['website_3']['url'] }}" class="list-group-item list-group-item-action">{{ organization['website_3']['name'] }}</a>
90+
{% for w in settings.websites %}
91+
<a target="_blank" href="{{ w.url }}" class="list-group-item list-group-item-action">{{ w.name }}</a>
92+
{% endfor %}
8793
</ul>
8894
</p>
8995
</div>
9096
</div>
9197
</div>
9298
</main>
9399

94-
<!-- Optional JavaScript -->
95-
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
96-
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
97-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
100+
<!-- jQuery and Bootstrap JS -->
101+
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
102+
integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
103+
<!-- popper.js for popovers -->
104+
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
105+
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
106+
<!-- bootstrap.js -->
107+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
108+
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
109+
110+
<script>
111+
$(document).ready(function(){
112+
$('[data-toggle="tooltip"]').tooltip(
113+
{
114+
'delay': { show: 50, hide: 50 }
115+
}
116+
);
117+
});
118+
</script>
98119
</body>
99120
</html>

0 commit comments

Comments
 (0)