forked from 42CTF/website
Compare commits
12 Commits
7cd43ca35f
...
9ac003ea3c
Author | SHA1 | Date |
---|---|---|
Danhia | 9ac003ea3c | |
Danhia | 5cf86b9c36 | |
zero | 7c06c24d9f | |
zero | 9b2da1e2cc | |
zero | 891c2530e6 | |
Danhia | 13895d7712 | |
Danhia | 0f64c7579c | |
zero | 02331beff4 | |
zero | 5b2abeac20 | |
Danhia | 1771f3c2bb | |
Danhia | 09118cac7a | |
zero | dd7a69aa50 |
|
@ -0,0 +1,25 @@
|
||||||
|
# Generated by Django 3.2.11 on 2022-08-18 15:41
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('accounts', '0012_auto_20220801_2212'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='campus',
|
||||||
|
name='logo',
|
||||||
|
field=models.URLField(default='https://42.fr'),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='campus',
|
||||||
|
name='url',
|
||||||
|
field=models.URLField(default='https://42.fr', max_length=100),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Generated by Django 3.2.11 on 2022-08-18 15:44
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('accounts', '0013_auto_20220818_1741'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='campus',
|
||||||
|
name='logo',
|
||||||
|
field=models.URLField(blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='campus',
|
||||||
|
name='url',
|
||||||
|
field=models.URLField(blank=True, max_length=100),
|
||||||
|
),
|
||||||
|
]
|
|
@ -28,6 +28,8 @@ class UserProfileInfo(models.Model):
|
||||||
class Campus(models.Model):
|
class Campus(models.Model):
|
||||||
id = models.IntegerField(primary_key=True, unique=True)
|
id = models.IntegerField(primary_key=True, unique=True)
|
||||||
name = models.CharField(max_length=50)
|
name = models.CharField(max_length=50)
|
||||||
|
url = models.URLField(max_length=100,blank=True)
|
||||||
|
logo = models.URLField(max_length=200,blank=True)
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
from django.contrib import sitemaps
|
||||||
|
from django.urls import reverse
|
||||||
|
from .models import Category, CTF
|
||||||
|
from .views import category, ctf
|
||||||
|
|
||||||
|
class CategorySitemap(sitemaps.Sitemap):
|
||||||
|
changefreq = "weekly"
|
||||||
|
priority = 0.7
|
||||||
|
i18n = True
|
||||||
|
|
||||||
|
def items(self):
|
||||||
|
return Category.objects.all()
|
||||||
|
|
||||||
|
def location(self, obj):
|
||||||
|
return reverse(category, kwargs={'cat_slug': obj.slug})
|
||||||
|
|
||||||
|
class CTFSitemap(sitemaps.Sitemap):
|
||||||
|
changefreq = "weekly"
|
||||||
|
priority = 0.7
|
||||||
|
i18n = True
|
||||||
|
|
||||||
|
def items(self):
|
||||||
|
return CTF.objects.all()
|
||||||
|
|
||||||
|
def location(self, obj):
|
||||||
|
return reverse(ctf, kwargs={'cat_slug': obj.category.slug, 'ctf_slug': obj.slug})
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="col-sm-12 col-md-9">
|
<div class="col-sm-12 col-md-9">
|
||||||
<div class="ctf-block">
|
<div class="ctf-block">
|
||||||
<div class="ctf-head">
|
<div class="ctf-head">
|
||||||
<h3>{{ ctf.name }}</h3>
|
<h1>{{ ctf.name }}</h1>
|
||||||
<small>{% trans "Published date" %} : {{ ctf.pub_date }}</small>
|
<small>{% trans "Published date" %} : {{ ctf.pub_date }}</small>
|
||||||
</div>
|
</div>
|
||||||
{% if date < ctf.pub_date %}
|
{% if date < ctf.pub_date %}
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-12 ctf-head">
|
||||||
|
<h1>{{ cat.name }}</h1>
|
||||||
|
</div>
|
||||||
<div class="col-sm-12 col-md-9 news-card">
|
<div class="col-sm-12 col-md-9 news-card">
|
||||||
<h3>{{ cat.name }}</h3>
|
|
||||||
{% if ctfs %}
|
{% if ctfs %}
|
||||||
<table class="table table-striped table-dark">
|
<table class="table table-striped table-dark">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -4,9 +4,7 @@ register = template.Library()
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def get_chall_by_lang(chall, lang):
|
def get_chall_by_lang(chall, lang):
|
||||||
print(chall.slug)
|
|
||||||
filepath = "ctfs/templates/challenges/"+ lang + "/" + chall.slug + ".html"
|
filepath = "ctfs/templates/challenges/"+ lang + "/" + chall.slug + ".html"
|
||||||
print(filepath)
|
|
||||||
try:
|
try:
|
||||||
with open(filepath) as fp:
|
with open(filepath) as fp:
|
||||||
return fp.read()
|
return fp.read()
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
|
from django.contrib.sitemaps.views import sitemap
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from .sitemaps import CategorySitemap, CTFSitemap
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
|
sitemaps = {
|
||||||
|
'categories': CategorySitemap(),
|
||||||
|
'challenges': CTFSitemap(),
|
||||||
|
}
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('<str:cat_slug>/', views.category, name='category'),
|
path('<str:cat_slug>/', views.category, name='category'),
|
||||||
path('<str:cat_slug>/<str:ctf_slug>', views.ctf, name='ctf')
|
path('<str:cat_slug>/<str:ctf_slug>', views.ctf, name='ctf'),
|
||||||
|
path('sitemap.xml', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
from django.contrib import sitemaps
|
||||||
|
from django.urls import reverse
|
||||||
|
from .models import Event
|
||||||
|
|
||||||
|
class EventsSitemap(sitemaps.Sitemap):
|
||||||
|
changefreq = "daily"
|
||||||
|
priority = 0.7
|
||||||
|
i18n = True
|
||||||
|
|
||||||
|
def items(self):
|
||||||
|
return Event.objects.all()
|
||||||
|
|
||||||
|
def location(self, obj):
|
||||||
|
return reverse('events:event_info', kwargs={'event_slug': obj.slug})
|
||||||
|
|
||||||
|
class StaticViewSitemap(sitemaps.Sitemap):
|
||||||
|
priority = 0.7
|
||||||
|
changefreq = 'daily'
|
||||||
|
i18n = True
|
||||||
|
def items(self):
|
||||||
|
return ['events:events']
|
||||||
|
|
||||||
|
def location(self, item):
|
||||||
|
return reverse(item)
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="ctf-block">
|
<div class="ctf-block">
|
||||||
<a href="{% url 'events:event_info' event_slug=event.slug %}">< Back to event</a>
|
<a href="{% url 'events:event_info' event_slug=event.slug %}">< Back to event</a>
|
||||||
<div class="ctf-head">
|
<div class="ctf-head">
|
||||||
<h2>{% trans "Event" %} - {{ event.name }}</h2>
|
<h1>{% trans "Event" %} - {{ event.name }}</h1>
|
||||||
<h4>{{ ctf.name }}</h4>
|
<h4>{{ ctf.name }}</h4>
|
||||||
<small>{% trans "Published date" %} : {{ ctf.pub_date }}</small>
|
<small>{% trans "Published date" %} : {{ ctf.pub_date }}</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="event-block">
|
<div class="event-block">
|
||||||
<div class="event-head" style="background-image:linear-gradient(180deg, rgba(102,102,102,0.3) 100%, rgba(29,29,29,1) 100%),url('{{ event.img }}');">
|
<div class="event-head" style="background-image:linear-gradient(180deg, rgba(102,102,102,0.3) 100%, rgba(29,29,29,1) 100%),url('{{ event.img }}');">
|
||||||
<h3>{{ event.name }}</h3>
|
<h1>{{ event.name }}</h1>
|
||||||
{% if ended == True %}
|
{% if ended == True %}
|
||||||
<small>{% trans "This event is over." %}</small>
|
<small>{% trans "This event is over." %}</small>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12 ctf-head">
|
||||||
<h3>{% trans "Events" %}</h3>
|
<h1>{% trans "Events" %}</h1>
|
||||||
</div>
|
</div>
|
||||||
{% if events %}
|
{% if events %}
|
||||||
{% for ev in events %}
|
{% for ev in events %}
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
|
from django.contrib.sitemaps.views import sitemap
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from .sitemaps import StaticViewSitemap, EventsSitemap
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
app_name = "events"
|
app_name = "events"
|
||||||
|
|
||||||
|
sitemaps = {
|
||||||
|
'events': EventsSitemap(),
|
||||||
|
'static': StaticViewSitemap(),
|
||||||
|
}
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.events, name='events'),
|
path('', views.events, name='events'),
|
||||||
|
path('sitemap.xml', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
|
||||||
path('<str:event_slug>', views.event, name='event_info'),
|
path('<str:event_slug>', views.event, name='event_info'),
|
||||||
path('<str:event_slug>/challenge/<str:chall_slug>', views.chall_event_info, name='event_chall_info'),
|
path('<str:event_slug>/challenge/<str:chall_slug>', views.chall_event_info, name='event_chall_info'),
|
||||||
path('pwd/<str:event_slug>', views.submit_pwd, name='submit_pwd'),
|
path('pwd/<str:event_slug>', views.submit_pwd, name='submit_pwd'),
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
from django.contrib import sitemaps
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
class StaticViewSitemap(sitemaps.Sitemap):
|
||||||
|
priority = 0.5
|
||||||
|
changefreq = 'monthly'
|
||||||
|
i18n = True
|
||||||
|
def items(self):
|
||||||
|
return ['home', 'cgu']
|
||||||
|
|
||||||
|
def location(self, item):
|
||||||
|
return reverse(item)
|
|
@ -4,7 +4,7 @@
|
||||||
{% get_current_language as lang %}
|
{% get_current_language as lang %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 news-card">
|
<div class="col-12 news-card">
|
||||||
<h2>Conditions générales d'utilisation du site 42CTF</h2>
|
<h1>Conditions générales d'utilisation du site 42CTF</h1>
|
||||||
|
|
||||||
<h5>Article 1 : Objet</h5>
|
<h5>Article 1 : Objet</h5>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
|
from django.contrib.sitemaps.views import sitemap
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from .sitemaps import StaticViewSitemap
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
|
sitemaps = {
|
||||||
|
'static': StaticViewSitemap(),
|
||||||
|
}
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.home, name='home'),
|
path('', views.home, name='home'),
|
||||||
path('CGU', views.cgu, name='cgu'),
|
path('CGU', views.cgu, name='cgu'),
|
||||||
|
path('sitemap.xml', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -9,12 +9,15 @@ from django.utils.translation import (
|
||||||
LANGUAGE_SESSION_KEY, check_for_language, get_language,
|
LANGUAGE_SESSION_KEY, check_for_language, get_language,
|
||||||
)
|
)
|
||||||
from django.core.files.storage import default_storage
|
from django.core.files.storage import default_storage
|
||||||
import datetime
|
|
||||||
|
# import datetime
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import operator
|
import operator
|
||||||
|
|
||||||
def get_weekly_top():
|
def get_weekly_top():
|
||||||
week_ago = datetime.datetime.now() - datetime.timedelta(days=7)
|
week_ago = timezone.now() - timezone.timedelta(days=7)
|
||||||
weekly_flags = CTF_flags.objects.filter(flag_date__gt=week_ago, ctf__disabled=False, ctf__event=None)
|
weekly_flags = CTF_flags.objects.filter(flag_date__gt=week_ago, ctf__disabled=False, ctf__event=None)
|
||||||
scores = defaultdict(int)
|
scores = defaultdict(int)
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ INSTALLED_APPS = [
|
||||||
'resources.apps.ResourcesConfig',
|
'resources.apps.ResourcesConfig',
|
||||||
'django.contrib.sites',
|
'django.contrib.sites',
|
||||||
'api.apps.ApiConfig',
|
'api.apps.ApiConfig',
|
||||||
|
'django.contrib.sitemaps',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
from django.contrib import sitemaps
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
class StaticViewSitemap(sitemaps.Sitemap):
|
||||||
|
priority = 0.5
|
||||||
|
changefreq = 'monthly'
|
||||||
|
i18n = True
|
||||||
|
def items(self):
|
||||||
|
return ['resources:about', 'resources:howToStart', 'resources:contribute', 'resources:becomeMember']
|
||||||
|
|
||||||
|
def location(self, item):
|
||||||
|
return reverse(item)
|
|
@ -3,34 +3,34 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% get_current_language as lang %}
|
{% get_current_language as lang %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% load i18n %}
|
<div class="col-12 ctf-head">
|
||||||
{% get_current_language as lang %}
|
<h1>{% trans "About 42ctf" %}</h1>
|
||||||
<div class="col-sm-12">
|
</div>
|
||||||
<div class="ctf-block">
|
<div class="col-sm-12">
|
||||||
<div class="ctf-head">
|
<div class="ctf-block">
|
||||||
<center><h3>{% trans "What is 42CTF ?" %}</h3></center>
|
<div class="ctf-head text-center">
|
||||||
</div>
|
<h1>{% trans "What is 42CTF ?" %}</h1>
|
||||||
<div class="ctf-body">
|
</div>
|
||||||
<h4>{% trans "A short introduction to CTF" %}</h4>
|
<div class="ctf-body">
|
||||||
{% trans "CTF stands for Capture The Flag. It is a cybersecurity competition, where participants have to solve challenges of various categories to gain points and progress on the scoreboard." %}
|
<h4>{% trans "A short introduction to CTF" %}</h4>
|
||||||
{% blocktranslate %}The challenges require participants to find sort of passwords called "flags" and to submit them on the platform.{% endblocktranslate %}
|
{% trans "CTF stands for Capture The Flag. It is a cybersecurity competition, where participants have to solve challenges of various categories to gain points and progress on the scoreboard." %}
|
||||||
<br><br>
|
{% blocktranslate %}The challenges require participants to find sort of passwords called "flags" and to submit them on the platform.{% endblocktranslate %}
|
||||||
|
<br><br>
|
||||||
<h4>{% trans "Functionment of 42CTF" %}</h4>
|
|
||||||
{% trans "42CTF is what we call a permanent CTF." %}<br>
|
<h4>{% trans "Functionment of 42CTF" %}</h4>
|
||||||
{% trans "Except from the" %} <a href="{% url 'events:events' %}">{% translate "events" %}</a>, {% trans "challenges are available on the platform without time limitations." %}
|
{% trans "42CTF is what we call a permanent CTF." %}<br>
|
||||||
{% trans "The registration on 42CTF is open to everyone, 42 students or not." %}<br>
|
{% trans "Except from the" %} <a href="{% url 'events:events' %}">{% translate "events" %}</a>, {% trans "challenges are available on the platform without time limitations." %}
|
||||||
{% trans "Events may or may not be open. If you would like to organize an event on 42CTF, feel free to contact us." %}<br>
|
{% trans "The registration on 42CTF is open to everyone, 42 students or not." %}<br>
|
||||||
<br><br>
|
{% trans "Events may or may not be open. If you would like to organize an event on 42CTF, feel free to contact us." %}<br>
|
||||||
|
<br><br>
|
||||||
<h4>{% trans "42CTF Team" %}</h4>
|
|
||||||
{% trans "42CTF is managed by 42 students." %}<br>
|
<h4>{% trans "42CTF Team" %}</h4>
|
||||||
{% trans "You can meet the team on" %} <a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30"></a>.<br>
|
{% trans "42CTF is managed by 42 students." %}<br>
|
||||||
{% trans "Challenges are created by various contributors, not necessarily 42 students."%}<br>
|
{% trans "You can meet the team on" %} <a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30"></a>.<br>
|
||||||
{% trans "Anyone is welcome to submit their own challenges, either on the permanent CTF or for a specific event." %}
|
{% trans "Challenges are created by various contributors, not necessarily 42 students."%}<br>
|
||||||
</div>
|
{% trans "Anyone is welcome to submit their own challenges, either on the permanent CTF or for a specific event." %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
</div>
|
||||||
</div>
|
{% endblock %}
|
|
@ -4,8 +4,8 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% get_current_language as lang %}
|
{% get_current_language as lang %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12 ctf-head">
|
||||||
<h3>{% trans "Become a 42CTF member" %}</h3>
|
<h1>{% trans "Become a 42CTF member" %}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="ctf-block text-center">
|
<div class="ctf-block text-center">
|
||||||
|
@ -43,6 +43,7 @@
|
||||||
<div class="ctf-head text-center">
|
<div class="ctf-head text-center">
|
||||||
<h4>{% trans "What do I get ?" %}</h4>
|
<h4>{% trans "What do I get ?" %}</h4>
|
||||||
</div>
|
</div>
|
||||||
|
<br><br>
|
||||||
{% blocktranslate %}
|
{% blocktranslate %}
|
||||||
- A <span class='is-member'>different color</span> for your pseudo in the scoreboard, to let everyone know you're a member.<br>
|
- A <span class='is-member'>different color</span> for your pseudo in the scoreboard, to let everyone know you're a member.<br>
|
||||||
- The possibility to play past CTF, with challenges no longer available, in the form of private events with the people of your choice.<br>
|
- The possibility to play past CTF, with challenges no longer available, in the form of private events with the people of your choice.<br>
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% get_current_language as lang %}
|
{% get_current_language as lang %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-12 ctf-head">
|
||||||
|
<h1>{% trans "Contribute to 42ctf" %}</h1>
|
||||||
|
</div>
|
||||||
{% block donate %}
|
{% block donate %}
|
||||||
{% include "./donate.html" %}
|
{% include "./donate.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
{% get_current_language as lang %}
|
{% get_current_language as lang %}
|
||||||
<div class="col-sm-12 col-md-6">
|
<div class="col-sm-12 col-md-6">
|
||||||
<div class="ctf-block">
|
<div class="ctf-block">
|
||||||
<div class="ctf-head">
|
<div class="ctf-head text-center">
|
||||||
<center><h3>{% trans "Create new challenges" %}</h3></center>
|
<h3>{% trans "Create new challenges" %}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="ctf-body">
|
<div class="ctf-body">
|
||||||
{% trans "If you want to create new challenges for 42CTF, send us a message on " %}<a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30"></a> !<br><br>
|
{% trans "If you want to create new challenges for 42CTF, send us a message on " %}<a class="footer_imgs" href="https://discord.gg/DwZqPpA" target="_blank"><img src="/static/img/discord.png" width="30"></a> !<br><br>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% get_current_language as lang %}
|
{% get_current_language as lang %}
|
||||||
<div class="col-sm-12 col-md-6">
|
<div class="col-sm-12">
|
||||||
<div class="ctf-block">
|
<div class="ctf-block">
|
||||||
<div class="ctf-head">
|
<div class="ctf-head text-center">
|
||||||
<center><h3>{% trans "Edit this page" %}</h3></center>
|
<h3>{% trans "Edit this page" %}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="ctf-body">
|
<div class="ctf-body">
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% get_current_language as lang %}
|
{% get_current_language as lang %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-12 ctf-head">
|
||||||
|
<h1>{% trans "Beginner guide" %}</h1>
|
||||||
|
</div>
|
||||||
{% block tools %}
|
{% block tools %}
|
||||||
{% include "./tools.html" %}
|
{% include "./tools.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% get_current_language as lang %}
|
{% get_current_language as lang %}
|
||||||
<div class="col-sm-12">
|
<div class="col-12">
|
||||||
<div class="ctf-block">
|
<div class="ctf-block">
|
||||||
<div class="ctf-head">
|
<div class="ctf-head">
|
||||||
<center><h3>{% trans "Recommended Tools" %}</h3></center>
|
<h3>{% trans "Recommended Tools" %}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="ctf-body">
|
<div class="ctf-body">
|
||||||
{% trans "To get you started, we built a VM that you can simply import in" %} <a href="https://www.virtualbox.org/wiki/Downloads">Virtual Box</a> {% trans "with a bunch of useful tools." %}<br>
|
{% trans "To get you started, we built a VM that you can simply import in" %} <a href="https://www.virtualbox.org/wiki/Downloads">Virtual Box</a> {% trans "with a bunch of useful tools." %}<br>
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
|
from django.contrib.sitemaps.views import sitemap
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from . import views
|
from . import views
|
||||||
|
from .sitemaps import StaticViewSitemap
|
||||||
|
|
||||||
app_name = "resources"
|
app_name = "resources"
|
||||||
|
sitemaps = {
|
||||||
|
'static': StaticViewSitemap(),
|
||||||
|
}
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('about', views.about, name='about'),
|
path('about', views.about, name='about'),
|
||||||
path('how-to-start', views.howToStart, name='howToStart'),
|
path('how-to-start', views.howToStart, name='howToStart'),
|
||||||
path('contribute', views.contribute, name='contribute'),
|
path('contribute', views.contribute, name='contribute'),
|
||||||
path('become-member', views.becomeMember, name='becomeMember'),
|
path('become-member', views.becomeMember, name='becomeMember'),
|
||||||
|
path('sitemap.xml', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,30 +1,62 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% load key_value %}
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-12 ctf-head">
|
||||||
|
<h1>{% trans "42Network Scoreboard" %}</h1>
|
||||||
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div>
|
<div class="row justify-content-md-center justify-content-sm-center">
|
||||||
<h4>Scoreboard</h4>
|
<div class="col-4 col-sm-3 col-md-2 podium podium-two text-center">
|
||||||
<table class="table table-dark">
|
<img src="{{ top3.1.0.logo }}" alt="{{ top3.1.0 }}" width="100%"/>
|
||||||
<thead>
|
<h3>#2 :</h3>
|
||||||
<tr>
|
<p>
|
||||||
<th scope="col">{% trans "Rank" %}</th>
|
Score : {{ top3.1.1 }}
|
||||||
<th scope="col">{% trans "Campus" %}</th>
|
<br>
|
||||||
<th scope="col">{% trans "Score" %}</th>
|
{{ top3.1.0 }}
|
||||||
</tr>
|
</p>
|
||||||
</thead>
|
</div>
|
||||||
<tbody>
|
<div class="col-4 col-sm-3 col-md-2 podium podium-one text-center">
|
||||||
{% for name, score in scores.items %}
|
<img src="{{ top3.0.0.logo }}" alt="{{ top3.0.0 }}" width="100%"/>
|
||||||
|
<h3>#1 : </h3>
|
||||||
|
<p>
|
||||||
|
Score : {{ top3.0.1 }}
|
||||||
|
<br>
|
||||||
|
{{ top3.0.0 }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-4 col-sm-3 col-md-2 podium podium-three text-center">
|
||||||
|
<img src="{{ top3.2.0.logo }}" alt="{{ top3.2.0 }}" width="100%"/>
|
||||||
|
<h3>#3 : </h3>
|
||||||
|
<p>
|
||||||
|
Score : {{ top3.2.1 }}
|
||||||
|
<br>
|
||||||
|
{{ top3.2.0 }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<table class="table table-dark">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">{% trans "Rank" %}</th>
|
||||||
|
<th scope="col">{% trans "Campus" %}</th>
|
||||||
|
<th scope="col">{% trans "Score" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for name, score in scores.items %}
|
||||||
|
{% if forloop.counter0 > 2 %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"># {{ forloop.counter0|add:1 }}</th>
|
<th scope="row"># {{ forloop.counter0|add:1 }}</th>
|
||||||
<th><a class="profile_link {{is_member}}" href="{% url 'scoreboard:campus' campus=name %}"> {{ name }}</a></th>
|
<th><a href="{% url 'scoreboard:campus' campus=name %}"> {{ name }}</a></th>
|
||||||
<td>{{ score}}</td>
|
<td>{{ score}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endif %}
|
||||||
</tbody>
|
{% endfor %}
|
||||||
</table>
|
</tbody>
|
||||||
</div>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -3,42 +3,44 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% load is_member %}
|
{% load is_member %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-12 ctf-head">
|
||||||
|
<h1>{% trans "Global Scoreboard" %}</h1>
|
||||||
|
</div>
|
||||||
|
<table class="table table-dark">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">{% trans "Rank" %}</th>
|
||||||
|
<th scope="col">{% trans "Username" %}</th>
|
||||||
|
<th scope="col">{% trans "Website" %}</th>
|
||||||
|
<th scope="col">{% trans "Campus" %}</th>
|
||||||
|
<th scope="col">{% trans "Score" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for s in scores %}
|
||||||
|
{% ismember s.user.userprofileinfo as is_member %}
|
||||||
|
<tr>
|
||||||
|
<th scope="row"># {{ forloop.counter0|add:scores.start_index }}</th>
|
||||||
|
<th><a class="profile_link {{is_member}}" href="{% url 'accounts:profile' user_name=s.user.username %}"> {{ s.user.username }}</a></th>
|
||||||
|
<td>
|
||||||
|
{% if s.user.userprofileinfo.portfolio_site %}
|
||||||
|
<a href="{{ s.user.userprofileinfo.portfolio_site }}" target="_blank">{{ s.user.userprofileinfo.portfolio_site }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if s.user.userprofileinfo.campus %}
|
||||||
|
<a href="{% url 'scoreboard:campus' campus=s.user.userprofileinfo.campus %}">
|
||||||
|
{{ s.user.userprofileinfo.campus }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>{{ s.user.userprofileinfo.score }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div>
|
<div>
|
||||||
<h4>Scoreboard</h4>
|
|
||||||
<table class="table table-dark">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">{% trans "Rank" %}</th>
|
|
||||||
<th scope="col">{% trans "Username" %}</th>
|
|
||||||
<th scope="col">{% trans "Website" %}</th>
|
|
||||||
<th scope="col">{% trans "Campus" %}</th>
|
|
||||||
<th scope="col">{% trans "Score" %}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for s in scores %}
|
|
||||||
{% ismember s.user.userprofileinfo as is_member %}
|
|
||||||
<tr>
|
|
||||||
<th scope="row"># {{ forloop.counter0|add:scores.start_index }}</th>
|
|
||||||
<th><a class="profile_link {{is_member}}" href="{% url 'accounts:profile' user_name=s.user.username %}"> {{ s.user.username }}</a></th>
|
|
||||||
<td>
|
|
||||||
{% if s.user.userprofileinfo.portfolio_site %}
|
|
||||||
<a href="{{ s.user.userprofileinfo.portfolio_site }}" target="_blank">{{ s.user.userprofileinfo.portfolio_site }}</a>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% if s.user.userprofileinfo.campus %}
|
|
||||||
<a href="{% url 'scoreboard:campus' campus=s.user.userprofileinfo.campus %}">
|
|
||||||
{{ s.user.userprofileinfo.campus }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>{{ s.user.userprofileinfo.score }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<span class="step-links">
|
<span class="step-links">
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from accounts.models import UserProfileInfo, Campus
|
from accounts.models import UserProfileInfo, Campus
|
||||||
|
import itertools
|
||||||
|
|
||||||
def scoreboard(request):
|
def scoreboard(request):
|
||||||
scores = UserProfileInfo.objects.filter(score__gt=0).select_related().order_by('-score', 'last_submission_date', 'user__username')
|
scores = UserProfileInfo.objects.filter(score__gt=0).select_related().order_by('-score', 'last_submission_date', 'user__username')
|
||||||
|
@ -19,12 +20,12 @@ def campus(request, campus):
|
||||||
def network(request):
|
def network(request):
|
||||||
campuses = Campus.objects.all()
|
campuses = Campus.objects.all()
|
||||||
scores = {}
|
scores = {}
|
||||||
|
|
||||||
for campus in campuses:
|
for campus in campuses:
|
||||||
users = UserProfileInfo.objects.filter(score__gt=0, campus__name__exact=campus).select_related().order_by('-score', 'last_submission_date', 'user__username')[:10]
|
users = UserProfileInfo.objects.filter(score__gt=0, campus__name__exact=campus).select_related().order_by('-score', 'last_submission_date', 'user__username')[:10]
|
||||||
scores[campus] = sum([u.score for u in users])
|
scores[campus] = sum([u.score for u in users])
|
||||||
|
|
||||||
sorted_scores = {k: v for k, v in sorted(scores.items(), key=lambda item: item[1], reverse=True)}
|
sorted_scores = {k: v for k, v in sorted(scores.items(), key=lambda item: item[1], reverse=True)}
|
||||||
return render(request, 'scoreboard/network.html', {'scores':sorted_scores})
|
top3 = list(itertools.islice(sorted_scores.items(), 3))
|
||||||
|
return render(request, 'scoreboard/network.html', {'scores':sorted_scores, 'top3': top3})
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
|
@ -88,9 +88,14 @@ pre {
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ctf-head h1 {
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
.ctf-block {
|
.ctf-block {
|
||||||
background-color: #1d1d1d;
|
background-color: #1d1d1d;
|
||||||
min-height: 30vh;
|
min-height: 35vh;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
@ -308,3 +313,20 @@ footer {
|
||||||
color: #a9a9a9;
|
color: #a9a9a9;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.podium{
|
||||||
|
margin-top:80px;
|
||||||
|
margin-bottom:30px;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
.podium h3 {margin-top:-5%;}
|
||||||
|
.podium img{position:relative;top: -55px}
|
||||||
|
.podium-one{
|
||||||
|
background-color: #313131;
|
||||||
|
height: 25vh;}
|
||||||
|
.podium-two{
|
||||||
|
background-color: #252525;
|
||||||
|
height: 20vh;margin-top:auto;}
|
||||||
|
.podium-three{
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
height: 15vh;margin-top:auto;}
|
|
@ -29,6 +29,8 @@
|
||||||
<meta property="twitter:description" content="42CTF is a cybersecurity challenges platform created by School 42 students.">
|
<meta property="twitter:description" content="42CTF is a cybersecurity challenges platform created by School 42 students.">
|
||||||
<meta property="twitter:image" content="{% static "img/42ctf_logo.png" %}">
|
<meta property="twitter:image" content="{% static "img/42ctf_logo.png" %}">
|
||||||
|
|
||||||
|
<link rel="canonical" href="https://www.42ctf.org/{{ request.path }}">
|
||||||
|
|
||||||
<meta name="Description" content="42CTF is a cybersecurity challenges platform created by School 42 students.">
|
<meta name="Description" content="42CTF is a cybersecurity challenges platform created by School 42 students.">
|
||||||
<meta name="keywords" content="42, cybersécurité, cybersecurity, hack, hacking, challenge, solution, exercice, hacking challenge, hack challenge, exercice hack, exercice hacking, capture the flag, CTF, security, sécurité, Documentation,Applicatif,Cryptologie,Challenges,Outils,Réseaux,CrackinWebW Client,Programmation,Cryptanaly,Application,Présentation,Réseau,Stéganographie,Web Serveur,Cracking,Classement,Challenges, Informatique,Capture The Flag,Forensic,Web," />
|
<meta name="keywords" content="42, cybersécurité, cybersecurity, hack, hacking, challenge, solution, exercice, hacking challenge, hack challenge, exercice hack, exercice hacking, capture the flag, CTF, security, sécurité, Documentation,Applicatif,Cryptologie,Challenges,Outils,Réseaux,CrackinWebW Client,Programmation,Cryptanaly,Application,Présentation,Réseau,Stéganographie,Web Serveur,Cracking,Classement,Challenges, Informatique,Capture The Flag,Forensic,Web," />
|
||||||
</head>
|
</head>
|
||||||
|
@ -63,7 +65,7 @@
|
||||||
{% trans "Scoreboard" %}
|
{% trans "Scoreboard" %}
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
<a class="dropdown-item" href="{% url 'scoreboard:main' %}">{% trans "Main" %}</a>
|
<a class="dropdown-item" href="{% url 'scoreboard:main' %}">{% trans "Global" %}</a>
|
||||||
<a class="dropdown-item" href="{% url 'scoreboard:network' %}">{% trans "42 Network" %}</a>
|
<a class="dropdown-item" href="{% url 'scoreboard:network' %}">{% trans "42 Network" %}</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -86,7 +88,7 @@
|
||||||
{% ismember request.user.userprofileinfo as is_member %}
|
{% ismember request.user.userprofileinfo as is_member %}
|
||||||
{% if not is_member %}
|
{% if not is_member %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link nav-distinguish" href="{% url 'resources:becomeMember' %}">{% translate "Become a member" %}</a>
|
<a class="nav-link nav-distinguish text-center" href="{% url 'resources:becomeMember' %}">{% translate "Become a member" %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
|
|
Loading…
Reference in New Issue