Webserver init
This commit is contained in:
commit
94c28a75f0
|
@ -0,0 +1,19 @@
|
|||
from flask import Flask, request, redirect
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
app.config.update(
|
||||
DEBUG = False,
|
||||
SECRET_KEY = 'secret_this_wont_be_important'
|
||||
)
|
||||
|
||||
@app.errorhandler(401)
|
||||
def custom_401(error):
|
||||
return redirect("401 please just stop, thanks")
|
||||
|
||||
@app.errorhandler(404)
|
||||
def custom_404(error):
|
||||
return("page not found")
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='185.78.255.231', port=80)
|
|
@ -0,0 +1,65 @@
|
|||
import os, datetime, requests, random, json, time, string
|
||||
from werkzeug.security import generate_password_hash
|
||||
from werkzeug.utils import secure_filename
|
||||
from flask import Flask, request, render_template, redirect, send_file, url_for, jsonify, session, flash, after_this_request
|
||||
from flask_login import current_user, login_user, LoginManager, UserMixin, login_required, login_user, logout_user
|
||||
from flask_mobility import Mobility
|
||||
from flask_caching import Cache
|
||||
from flask_ipban import IpBan
|
||||
from device_detector import DeviceDetector
|
||||
from flask_sslify import SSLify
|
||||
from requests_oauthlib import OAuth2Session
|
||||
from shutil import copyfile
|
||||
from werkzeug.middleware.shared_data import SharedDataMiddleware
|
||||
from oauthlib.oauth2 import WebApplicationClient
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed
|
||||
|
||||
contact_support_dc_webhook = ""
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
app.config.update(
|
||||
DEBUG=False,
|
||||
SECRET_KEY='secret_password_' + ''.join(str(random.choice(string.ascii_lowercase)) for i in range(20))
|
||||
)
|
||||
|
||||
login_manager = LoginManager()
|
||||
login_manager.init_app(app)
|
||||
|
||||
|
||||
class User(UserMixin):
|
||||
def __init__(self, id):
|
||||
self.id = id
|
||||
self.name = "user" + str(id)
|
||||
self.password = self.name + "_secret"
|
||||
|
||||
def __repr__(self):
|
||||
return "%d/%s/%s" % (self.id, self.name, self.password)
|
||||
|
||||
@login_manager.user_loader
|
||||
def load_user(userid):
|
||||
return User(userid)
|
||||
|
||||
|
||||
def get_username(self):
|
||||
return self.username
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def homepage():
|
||||
return redirect("/login")
|
||||
|
||||
|
||||
# Error handling
|
||||
@app.errorhandler(401)
|
||||
def custom_401(error):
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@app.errorhandler(404)
|
||||
def custom_404(error):
|
||||
return redirect("/")
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='185.78.255.231', threaded=True,use_reloader=True, port=443,
|
||||
ssl_context=('/etc/letsencrypt/live/cipherwatch.asdatindustries.com/fullchain.pem', '/etc/letsencrypt/live/cipherwatch.asdatindustries.com/privkey.pem'))
|
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
|
@ -0,0 +1,217 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<!-- Primary Meta Tags -->
|
||||
<title>Invalid!</title>
|
||||
<link rel="icon" href="/static/icon/main_free.png" type="image/png" />
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
color: #6a6f8c;
|
||||
background: #403f3f;
|
||||
font: 600 16px/18px "Open Sans", sans-serif;
|
||||
}
|
||||
*,
|
||||
:after,
|
||||
:before {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.clearfix:after,
|
||||
.clearfix:before {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
.clearfix:after {
|
||||
clear: both;
|
||||
display: block;
|
||||
}
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.login-wrap {
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
max-width: 525px;
|
||||
min-height: 670px;
|
||||
position: relative;
|
||||
background: url(http://cdn.eso.org/images/screen/eso2202a.jpg)
|
||||
no-repeat center;
|
||||
box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.24),
|
||||
0 17px 50px 0 rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
.login-html {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
padding: 90px 70px 50px 70px;
|
||||
background: rgba(40, 57, 101, 0.9);
|
||||
}
|
||||
.login-html .sign-in-htm,
|
||||
.login-html .sign-up-htm {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
transform: rotateY(180deg);
|
||||
backface-visibility: hidden;
|
||||
transition: all 0.4s linear;
|
||||
}
|
||||
.login-html .sign-in,
|
||||
.login-html .sign-up,
|
||||
.login-form .group .check {
|
||||
display: none;
|
||||
}
|
||||
.login-html .tab,
|
||||
.login-form .group .label,
|
||||
.login-form .group .button {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.login-html .tab {
|
||||
font-size: 22px;
|
||||
margin-right: 15px;
|
||||
padding-bottom: 5px;
|
||||
margin: 0 15px 10px 0;
|
||||
display: inline-block;
|
||||
border-bottom: 2px solid transparent;
|
||||
}
|
||||
.login-html .sign-in:checked + .tab,
|
||||
.login-html .sign-up:checked + .tab {
|
||||
color: #fff;
|
||||
border-color: #1161ee;
|
||||
}
|
||||
.login-form {
|
||||
min-height: 345px;
|
||||
position: relative;
|
||||
perspective: 1000px;
|
||||
transform-style: preserve-3d;
|
||||
}
|
||||
.login-form .group {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.login-form .group .label,
|
||||
.login-form .group .input,
|
||||
.login-form .group .button {
|
||||
width: 100%;
|
||||
color: #fff;
|
||||
display: block;
|
||||
}
|
||||
.login-form .group .input,
|
||||
.login-form .group .button {
|
||||
border: none;
|
||||
padding: 15px 20px;
|
||||
border-radius: 25px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.login-form .group input[data-type="password"] {
|
||||
text-security: circle;
|
||||
-webkit-text-security: circle;
|
||||
}
|
||||
.login-form .group .label {
|
||||
color: #aaa;
|
||||
font-size: 12px;
|
||||
}
|
||||
.login-form .group .button {
|
||||
background: #1161ee;
|
||||
}
|
||||
.login-form .group label .icon {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.login-form .group label .icon:before,
|
||||
.login-form .group label .icon:after {
|
||||
content: "";
|
||||
width: 10px;
|
||||
height: 2px;
|
||||
background: #fff;
|
||||
position: absolute;
|
||||
transition: all 0.2s ease-in-out 0s;
|
||||
}
|
||||
.login-form .group label .icon:before {
|
||||
left: 3px;
|
||||
width: 5px;
|
||||
bottom: 6px;
|
||||
transform: scale(0) rotate(0);
|
||||
}
|
||||
.login-form .group label .icon:after {
|
||||
top: 6px;
|
||||
right: 0;
|
||||
transform: scale(0) rotate(0);
|
||||
}
|
||||
.login-form .group .check:checked + label {
|
||||
color: #fff;
|
||||
}
|
||||
.login-form .group .check:checked + label .icon {
|
||||
background: #1161ee;
|
||||
}
|
||||
.login-form .group .check:checked + label .icon:before {
|
||||
transform: scale(1) rotate(45deg);
|
||||
}
|
||||
.login-form .group .check:checked + label .icon:after {
|
||||
transform: scale(1) rotate(-45deg);
|
||||
}
|
||||
.login-html
|
||||
.sign-in:checked
|
||||
+ .tab
|
||||
+ .sign-up
|
||||
+ .tab
|
||||
+ .login-form
|
||||
.sign-in-htm {
|
||||
transform: rotate(0);
|
||||
}
|
||||
.login-html .sign-up:checked + .tab + .login-form .sign-up-htm {
|
||||
transform: rotate(0);
|
||||
}
|
||||
|
||||
.hr {
|
||||
height: 2px;
|
||||
margin: 60px 0 50px 0;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
.foot-lnk {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fancyfont {
|
||||
font-family: roboto;
|
||||
font-size: 15px;
|
||||
}
|
||||
</style>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<div class="login-wrap" style="margin-top: 120px;">
|
||||
<div class="login-html">
|
||||
<input id="tab-1" type="radio" name="tab" class="sign-in" checked><label for="tab-1" class="tab">Error</label>
|
||||
<input id="tab-2" type="radio" name="tab" class="sign-up"><label for="tab-2" class="tab"></label>
|
||||
<div class="login-form" method="post" id="post" autocomplete="off">
|
||||
<div class="sign-in-htm">
|
||||
<div class="group">
|
||||
Sorry, but you seem to have entered invalid credentials!
|
||||
</div>
|
||||
|
||||
<div class="hr"></div>
|
||||
|
||||
<div class="group">
|
||||
<a href="/login">
|
||||
<input class="button fancyfont" style="background-color:rgba(255, 255, 255, 0.696);color: black; text-align: center;" value="Back to Login"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="group">
|
||||
<a href="/">
|
||||
<input class="button fancyfont" style="background-color:rgba(255, 255, 255, 0.696);color: black; text-align: center;" value="Contact / Support"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,219 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<!-- Primary Meta Tags -->
|
||||
<title>Login</title>
|
||||
<link rel="icon" href="/static/icon/main_free.png" type="image/png" />
|
||||
<meta name="title" content="Login CyberRange">
|
||||
<meta name="description" content="learn about Cyber Attacks how you would encounter them!">
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
color: #6a6f8c;
|
||||
background: #403f3f;
|
||||
font: 600 16px/18px "Open Sans", sans-serif;
|
||||
}
|
||||
*,
|
||||
:after,
|
||||
:before {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.clearfix:after,
|
||||
.clearfix:before {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
.clearfix:after {
|
||||
clear: both;
|
||||
display: block;
|
||||
}
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.login-wrap {
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
max-width: 525px;
|
||||
min-height: 670px;
|
||||
position: relative;
|
||||
background: url(http://cdn.eso.org/images/screen/eso2202a.jpg)
|
||||
no-repeat center;
|
||||
box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.24),
|
||||
0 17px 50px 0 rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
.login-html {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
padding: 90px 70px 50px 70px;
|
||||
background: rgba(40, 57, 101, 0.9);
|
||||
}
|
||||
.login-html .sign-in-htm,
|
||||
.login-html .sign-up-htm {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
transform: rotateY(180deg);
|
||||
backface-visibility: hidden;
|
||||
transition: all 0.4s linear;
|
||||
}
|
||||
.login-html .sign-in,
|
||||
.login-html .sign-up,
|
||||
.login-form .group .check {
|
||||
display: none;
|
||||
}
|
||||
.login-html .tab,
|
||||
.login-form .group .label,
|
||||
.login-form .group .button {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.login-html .tab {
|
||||
font-size: 22px;
|
||||
margin-right: 15px;
|
||||
padding-bottom: 5px;
|
||||
margin: 0 15px 10px 0;
|
||||
display: inline-block;
|
||||
border-bottom: 2px solid transparent;
|
||||
}
|
||||
.login-html .sign-in:checked + .tab,
|
||||
.login-html .sign-up:checked + .tab {
|
||||
color: #fff;
|
||||
border-color: #1161ee;
|
||||
}
|
||||
.login-form {
|
||||
min-height: 345px;
|
||||
position: relative;
|
||||
perspective: 1000px;
|
||||
transform-style: preserve-3d;
|
||||
}
|
||||
.login-form .group {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.login-form .group .label,
|
||||
.login-form .group .input,
|
||||
.login-form .group .button {
|
||||
width: 100%;
|
||||
color: #fff;
|
||||
display: block;
|
||||
}
|
||||
.login-form .group .input,
|
||||
.login-form .group .button {
|
||||
border: none;
|
||||
padding: 15px 20px;
|
||||
border-radius: 25px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.login-form .group input[data-type="password"] {
|
||||
text-security: circle;
|
||||
-webkit-text-security: circle;
|
||||
}
|
||||
.login-form .group .label {
|
||||
color: #aaa;
|
||||
font-size: 12px;
|
||||
}
|
||||
.login-form .group .button {
|
||||
background: #1161ee;
|
||||
}
|
||||
.login-form .group label .icon {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.login-form .group label .icon:before,
|
||||
.login-form .group label .icon:after {
|
||||
content: "";
|
||||
width: 10px;
|
||||
height: 2px;
|
||||
background: #fff;
|
||||
position: absolute;
|
||||
transition: all 0.2s ease-in-out 0s;
|
||||
}
|
||||
.login-form .group label .icon:before {
|
||||
left: 3px;
|
||||
width: 5px;
|
||||
bottom: 6px;
|
||||
transform: scale(0) rotate(0);
|
||||
}
|
||||
.login-form .group label .icon:after {
|
||||
top: 6px;
|
||||
right: 0;
|
||||
transform: scale(0) rotate(0);
|
||||
}
|
||||
.login-form .group .check:checked + label {
|
||||
color: #fff;
|
||||
}
|
||||
.login-form .group .check:checked + label .icon {
|
||||
background: #1161ee;
|
||||
}
|
||||
.login-form .group .check:checked + label .icon:before {
|
||||
transform: scale(1) rotate(45deg);
|
||||
}
|
||||
.login-form .group .check:checked + label .icon:after {
|
||||
transform: scale(1) rotate(-45deg);
|
||||
}
|
||||
.login-html
|
||||
.sign-in:checked
|
||||
+ .tab
|
||||
+ .sign-up
|
||||
+ .tab
|
||||
+ .login-form
|
||||
.sign-in-htm {
|
||||
transform: rotate(0);
|
||||
}
|
||||
.login-html .sign-up:checked + .tab + .login-form .sign-up-htm {
|
||||
transform: rotate(0);
|
||||
}
|
||||
|
||||
.hr {
|
||||
height: 2px;
|
||||
margin: 60px 0 50px 0;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
.foot-lnk {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fancyfont {
|
||||
font-family: roboto;
|
||||
font-size: 15px;
|
||||
}
|
||||
</style>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<div class="login-wrap" style="margin-top: 120px;">
|
||||
<div class="login-html">
|
||||
<input id="tab-1" type="radio" name="tab" class="sign-in" checked><label for="tab-1" class="tab">Login</label>
|
||||
<input id="tab-2" type="radio" name="tab" class="sign-up"><label for="tab-2" class="tab">Register</label>
|
||||
<form method="post" id="post" autocomplete="off" class="login-form">
|
||||
<div class="sign-in-htm">
|
||||
<div class="group">
|
||||
<label for="username" class="label fancyfont">Username or Email</label>
|
||||
<input id="username" name="username" type="text" class="input">
|
||||
</div>
|
||||
<div class="group">
|
||||
<label for="password_login" class="label fancyfont">Password</label>
|
||||
<input id="password_login" name="password_login" type="password" class="input" data-type="password">
|
||||
</div>
|
||||
<div class="group">
|
||||
<input type="submit" onclick="document.getElementById('post').submit()" class="button fancyfont" style="background-color:rgba(29, 116, 230, 0.696);color: black" value="Submit"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sign-up-htm">
|
||||
<div class="foot-lnk">
|
||||
<label for="tab-1">Registering is disabled</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue