Restart ^^

This commit is contained in:
Michel V 2020-06-23 19:23:57 +02:00
parent a46facb5bb
commit 1fbefd13b2
12 changed files with 51 additions and 22 deletions

15
Files/Chrys/AES.txt Normal file
View File

@ -0,0 +1,15 @@
https://youtu.be/O4xNJsjtN6E
https://youtu.be/6KfJXl-Kvws
dV1M7Z5int2+QgRtDrQJRedIk+6lp3O8GoVBOzvq9zNUsIT7yvz43duMKygPZw== (64)
dV1M7Z5int2+QgRtDrQJRedIk+6lp3O8GoVBOzvq
9zNUsIT7yvz43duMKygPZw== (F7 33 54 B0 84 FB CA FC F8 DD DB 8C 2B 28 0F 67)
1~15 : 24
16~31 : 44
/!\ --->{32~47 : 64}<--- /!\
01110101 01011101 01001100 11101101 10011110 01100010 10011110 11011101 10111110 01000010 00000100 01101101 00001110 10110100 00001001 01000101 11100111 01001000 10010011 11101110 10100101 10100111 01110011 10111100 00011010 10000101 01000001 00111011 00111011 11101010 11110111 00110011 01010100 10110000 10000100 11111011 11001010 11111100 11111000 11011101 11011011 10001100 00101011 00101000 00001111 01100111
dV1M7Z5int2+QgRtDrQJRedIk+6lp3O8GoVBOzvq9zNUsIT7yvz43duMKygPZw==

15
Files/SuperUser/AES.txt Normal file
View File

@ -0,0 +1,15 @@
https://youtu.be/O4xNJsjtN6E
https://youtu.be/6KfJXl-Kvws
dV1M7Z5int2+QgRtDrQJRedIk+6lp3O8GoVBOzvq9zNUsIT7yvz43duMKygPZw== (64)
dV1M7Z5int2+QgRtDrQJRedIk+6lp3O8GoVBOzvq
9zNUsIT7yvz43duMKygPZw== (F7 33 54 B0 84 FB CA FC F8 DD DB 8C 2B 28 0F 67)
1~15 : 24
16~31 : 44
/!\ --->{32~47 : 64}<--- /!\
01110101 01011101 01001100 11101101 10011110 01100010 10011110 11011101 10111110 01000010 00000100 01101101 00001110 10110100 00001001 01000101 11100111 01001000 10010011 11101110 10100101 10100111 01110011 10111100 00011010 10000101 01000001 00111011 00111011 11101010 11110111 00110011 01010100 10110000 10000100 11111011 11001010 11111100 11111000 11011101 11011011 10001100 00101011 00101000 00001111 01100111
dV1M7Z5int2+QgRtDrQJRedIk+6lp3O8GoVBOzvq9zNUsIT7yvz43duMKygPZw==

View File

@ -1,2 +0,0 @@
# Pycloud

BIN
app.db

Binary file not shown.

View File

@ -18,6 +18,7 @@ words = {
'nameLogin' : 'Login',
'nameRegister' : 'Register',
'termLogout' : 'Logout',
'termChoose' : 'Choose a directory',
'termSubmit' : 'Submit',
'termUsername' : 'Username',
'termPassword' : 'Password',

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,8 @@
from flask_login import current_user
from app import words
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileRequired
from wtforms import SubmitField, PasswordField, StringField, BooleanField
from wtforms import SubmitField, PasswordField, StringField, BooleanField, SelectField
from wtforms.validators import DataRequired, EqualTo, ValidationError
from app.models import User

View File

@ -4,7 +4,7 @@ from flask import render_template, redirect, url_for, flash, send_from_directory
from app.forms import UploadForm, LoginForm, RegisterForm
from werkzeug.utils import secure_filename
from flask_login import current_user, login_user, logout_user
from app.models import User
from app.models import User, File
# ===================================================
# How to use the render_template in this application:
@ -63,6 +63,7 @@ def register():
user.set_password(form.password.data)
db.session.add(user)
db.session.commit()
os.mkdir(os.path.join(app.config['FILES_DIR'], form.username.data))
flash(words['termRegistered'] + form.username.data)
return redirect(url_for('home'))
return render_template('register.html', title=words['nameRegister'], dico=words, form=form, userloged=current_user)
@ -80,28 +81,26 @@ def upload():
if form.validate_on_submit():
f = form.uploadfile.data
filename = secure_filename(f.filename)
f.save(os.path.join(app.config['FILES_DIR'], filename))
f.save(os.path.join(app.config['FILES_DIR'], current_user.username, filename))
filetodb = File(name=filename, user=current_user)
db.session.add(filetodb)
db.session.commit()
return redirect(url_for('home'))
return render_template('upload.html', title=words['nameUpload'], dico=words, form=form, userloged=current_user)
# Admin's download pages
# Use it to download a file
# Redirect automatically to the home page if the user isn't logged in or isn't an Admin
# If the user or the id is'nt reconized, redirect automatically to the home page
@app.route('/downloadAdmin/<user>/<id>')
def downloadAdmin(user, id):
if not current_user.is_authenticated:
return redirect(url_for('home'))
if current_user.isAdmin == False:
return redirect(url_for('home'))
# Users' download pages
# Use it to download a file
# Redirect automatically to the home page if the user isn't logged in or is an Admin
# Redirect automatically to the home page if the user isn't logged in
# If the id is'nt reconized, redirect automatically to the home page
@app.route('/downloadUser/<id>')
def downloadUser(id):
# If the file don't belong to the requested user, redirect automatically to the home page
@app.route('/download/<id>')
def download(id):
if not current_user.is_authenticated:
return redirect(url_for('home'))
if current_user.isAdmin == True:
filetodb = File.query.filter_by(id=id).first()
if not filetodb:
return redirect(url_for('home'))
if filetodb.user == current_user or current_user.isAdmin == True:
return send_from_directory(os.path.join(app.config['FILES_DIR'], filetodb.user.username), filetodb.name, as_attachment=True)
else:
return redirect(url_for('home'))

View File

@ -14,11 +14,11 @@
<a href="{{ url_for('login') }}">{{ dico['nameLogin'] }}</a>
{% else %}
<a href="{{ url_for('upload') }}">{{ dico['nameUpload'] }}</a>
<a href="{{ url_for('logout') }}">{{ dico['termLogout'] }}</a>
{% endif %}
{% if userloged.isAdmin == True %}
<a href="{{ url_for('register') }}">{{ dico['nameRegister'] }}</a>
{% endif %}
<a href="{{ url_for('logout') }}">{{ dico['termLogout'] }}</a>
{% endif %}
{{ userloged.username }}
<hr>
{% with messages = get_flashed_messages() %}