Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated dependencies #33

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions =2.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Requirement already satisfied: Flask==2.0.2 in /Users/danielarad/Documents/venv/redeyevenv/lib/python3.12/site-packages (2.0.2)
Requirement already satisfied: Jinja2==3.0.3 in /Users/danielarad/Documents/venv/redeyevenv/lib/python3.12/site-packages (3.0.3)
Requirement already satisfied: Werkzeug in /Users/danielarad/Documents/venv/redeyevenv/lib/python3.12/site-packages (3.0.3)
Requirement already satisfied: itsdangerous>=2.0 in /Users/danielarad/Documents/venv/redeyevenv/lib/python3.12/site-packages (from Flask==2.0.2) (2.2.0)
Requirement already satisfied: click>=7.1.2 in /Users/danielarad/Documents/venv/redeyevenv/lib/python3.12/site-packages (from Flask==2.0.2) (8.1.7)
Requirement already satisfied: MarkupSafe>=2.0 in /Users/danielarad/Documents/venv/redeyevenv/lib/python3.12/site-packages (from Jinja2==3.0.3) (2.1.5)
116 changes: 0 additions & 116 deletions Report/report_gen.py

This file was deleted.

32 changes: 19 additions & 13 deletions redeye.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from re import M
import eventlet
eventlet.monkey_patch()
from flask import Flask, request, render_template, session, request, redirect, abort, make_response, url_for, send_from_directory, jsonify
from flask_jsglue import JSGlue
import jwt
Expand All @@ -9,11 +7,11 @@
import os
from RedDB import db
from Parse import Parse as parse
from Report import report_gen as report
import Redhelper as helper
import collections
import csv
from datetime import datetime, timedelta
from datetime import timedelta
import datetime
from uuid import uuid4
from collections import defaultdict
import urllib.parse
Expand All @@ -32,18 +30,19 @@
import json

app = Flask(__name__, template_folder="templates")
jsglue = JSGlue()
jsglue.init_app(app)

from Routes.api.v1 import api_route
app.register_blueprint(api_route)

jsglue = JSGlue(app)
socketio = SocketIO(app, cors_allowed_origins="http://localhost")
socketio = SocketIO(app, async_mode='threading', cors_allowed_origins="http://localhost")

# Connect to redeye
sio = client_socket.Client()

app.config['SESSION_COOKIE_NAME'] = "RedSession"
app.secret_key = str(uuid4()) # Nice
app.secret_key = 'try'#str(uuid4()) # Nice

clients = {} #key: username; value: list of sockets
#/SocketIO
Expand Down Expand Up @@ -1797,10 +1796,13 @@ def login():
session["profile"] = db.get_profilePicture_by_id(check_id)[0][0]
session["project"] = helper.get_project_name(projects, session["project"])
clients[session["uid"]] = socketio
token = jwt.encode({'user': "{}-{}".format(creds['username'],check_id), 'exp': datetime.utcnow(
) + timedelta(hours=2)}, app.secret_key)
resp = make_response(index(token.decode('UTF-8')))
resp.set_cookie('reduser', token.decode('UTF-8'))
token = jwt.encode({'user': "{}-{}".format(creds['username'],check_id), 'exp': datetime.datetime.now(datetime.UTC) + timedelta(hours=2)}, app.secret_key, algorithm="HS256")
print("TOKEN ------------")
print(token)
print(jwt.decode(token, app.secret_key, algorithms=["HS256"]))
print("----------------")
resp = make_response(index(token))
resp.set_cookie('reduser', token)
return resp

# If the user is not authenticated
Expand Down Expand Up @@ -1847,11 +1849,14 @@ def refresh_projects():
def is_logged(logged=False):
try:
token = request.cookies['reduser']
data = jwt.decode(token, app.secret_key)
print("Token - ", token)
data = jwt.decode(token, app.secret_key, algorithms=["HS256"])
print("Data - ", data)
return True
except Exception:
print("EXCEPTION")
try:
data = jwt.decode(logged, app.secret_key)
data = jwt.decode(logged, app.secret_key, algorithms=["HS256"])
return True
except:
return False
Expand Down Expand Up @@ -1956,6 +1961,7 @@ def add_header(response):
@app.route('/')
def index(logged=False):
if not is_logged(logged):
print("NOT LOGGED !!!!!!!")
return render_template('login.html', projects=projects, show_create_project=IS_ENV_SAFE)

comments = db.get_all_comments(session["db"])
Expand Down
54 changes: 25 additions & 29 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
bidict==0.22.0
certifi==2021.10.8
charset-normalizer==2.0.12
click==8.1.0
dnspython==2.2.1
docxcompose==1.3.4
docxtpl==0.15.2
eventlet==0.33.0
fire==0.4.0
Flask==2.0.3
Flask-JSGlue==0.3.1
Flask-SocketIO==5.1.1
greenlet==1.1.2
idna==3.3
itsdangerous==2.1.2
Jinja2==3.0.3
lxml==4.8.0
MarkupSafe==2.1.1
PyJWT==1.7.1
python-docx==0.8.11
python-engineio==4.3.1
python-socketio==5.5.2
requests==2.27.1
bidict==0.23.1
blinker==1.8.2
cffi==1.17.0
click==8.1.7
cryptography==43.0.0
dnspython==2.6.1
fire==0.6.0
Flask==3.0.3
Flask-JSGlue @ git+https://github.com/sisitrs2/flask-jsglue.git
Flask-SocketIO==5.3.6
h11==0.14.0
itsdangerous==2.2.0
Jinja2==3.1.4
markup==0.2.2
MarkupSafe==2.1.5
neo4j==5.23.1
pycparser==2.22
PyJWT==2.9.0
python-engineio==4.9.1
python-socketio==5.11.3
pytz==2024.1
simple-websocket==1.0.0
six==1.16.0
termcolor==1.1.0
urllib3==1.26.9
websocket-client==1.3.2
Werkzeug==2.1.0
neo4j==4.4.2
flask-restful==0.3.9
termcolor==2.4.0
Werkzeug==3.0.3
wsproto==1.2.0
Loading