-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Oneloutre/dev-add-proxy
🔥 Fixing auth - adding proxy method - added requirements.txt - a…
- Loading branch information
Showing
17 changed files
with
313 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
bcrypt==4.1.2 | ||
blinker==1.7.0 | ||
certifi==2024.2.2 | ||
charset-normalizer==3.3.2 | ||
click==8.1.7 | ||
cloudscraper==1.2.71 | ||
Flask==3.0.3 | ||
Flask-JWT-Extended==4.6.0 | ||
idna==3.7 | ||
itsdangerous==2.2.0 | ||
Jinja2==3.1.3 | ||
MarkupSafe==2.1.5 | ||
PyJWT==2.8.0 | ||
pyparsing==3.1.2 | ||
requests==2.31.0 | ||
requests-toolbelt==1.0.0 | ||
urllib3==2.2.1 | ||
Werkzeug==3.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import cloudscraper | ||
from flask import render_template, request, redirect, url_for, make_response, jsonify, session | ||
|
||
scraper = cloudscraper.create_scraper() | ||
|
||
def proxy_add_new(csrf_access_token): | ||
error = None | ||
if request.method == 'POST': | ||
if csrf_access_token != request.form['csrf_token']: | ||
return jsonify({'error': 'Invalid CSRF token'}), 400 | ||
else: | ||
url_form = request.form['target'] | ||
url = url_form.strip() | ||
if not url: | ||
error = 'URL is required.' | ||
return render_template('misc/add_proxy.html', error=error) | ||
else: | ||
if validate(url): | ||
pass | ||
else: | ||
url = 'http://' + url | ||
try: | ||
response = timeout_checker(url) | ||
if response == "Host seems up and running !": | ||
return render_template('misc/add_proxy.html', success='Host seems up and running.') | ||
elif response == "Timeout Error": | ||
error = 'Timeout Error' | ||
else: | ||
error = 'Error fetching the URL' | ||
except: | ||
error = '' | ||
return render_template('misc/add_proxy.html', error=error) | ||
|
||
def validate(url): | ||
if not (url.startswith('http://') or url.startswith('https://')): | ||
return False | ||
else: | ||
return True | ||
|
||
|
||
#def check_proxy_validity(url, timeout=5): | ||
|
||
|
||
def timeout_checker(url, timeout=5): | ||
try: | ||
response = scraper.get(url, timeout=timeout) | ||
response.raise_for_status() | ||
return 'Host seems up and running !' | ||
except Exception as e: | ||
print(e) | ||
if "Read timed out" in str(e): | ||
return 'Timeout Error' | ||
else: | ||
return 'Error' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
body { | ||
background-color: #1e2124; | ||
} | ||
|
||
.container { | ||
background-color: #282b30; | ||
border-radius: 10px; | ||
padding: 20px; | ||
margin-top: 50px; | ||
} | ||
|
||
.text-white { | ||
color: white; | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
body { | ||
background-color: #1e2124; | ||
color: #ffffff; /* Text color */ | ||
} | ||
|
||
.container { | ||
background-color: #282b30; | ||
padding: 20px; | ||
border-radius: 10px; | ||
margin-top: 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
body { | ||
background-color: #1e2124; | ||
} | ||
|
||
.img-fluid{ | ||
margin-top: 60px; | ||
margin-left: -2px; | ||
max-width: 100px; | ||
max-height: 400px; | ||
} | ||
|
||
.card { | ||
background-color: #282b30; | ||
color: #ffffff; | ||
border-radius: 5px; | ||
width: 600px; | ||
margin-top: 50px; | ||
} | ||
|
||
.card-header { | ||
background-color: #282b30; | ||
text-align: center; | ||
border-bottom: 1px solid #ffffff; | ||
} | ||
|
||
.btn-primary { | ||
background-color: #007bff; | ||
border-color: #007bff; | ||
} | ||
|
||
.btn-primary:hover { | ||
background-color: #007bff; | ||
border-color: #007bff; | ||
} | ||
|
||
.btn-success { | ||
background-color: #007bff; | ||
border-color: #007bff; | ||
} | ||
|
||
.btn-success:hover { | ||
background-color: #007bff; | ||
border-color: #007bff; | ||
} | ||
|
||
.error { | ||
color: red; | ||
font-size: 15px; | ||
} | ||
|
||
.success { | ||
color: green; | ||
font-size: 15px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Already Registered</title> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"> | ||
<link rel="stylesheet" href="/static/already_registered.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="row justify-content-center"> | ||
<div class="col-md-6"> | ||
<div class="banner"> | ||
<img src="static/Assets/BannerNginxPM2.png" class="img-fluid banner-img" alt="Bannière"> | ||
</div> | ||
<h1 class="text-center text-white mt-5">Already Registered !</h1> | ||
<p class="text-center text-white mt-3">You are already registered. Please login, or head up to the dashboard.</p> | ||
<div class="text-center mt-4"> | ||
<a href="/dashboard" class="btn btn-primary">Go to Dashboard</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Dashboard</title> | ||
<!-- Bootstrap CSS --> | ||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"> | ||
<!-- Custom CSS --> | ||
<link href="static/dashboard/style.css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
|
||
<div class="container"> | ||
<h1>Dashboard</h1> | ||
<div class="row"> | ||
<div class="col-md-4"> | ||
<div class="card bg-dark text-white"> | ||
<div class="card-body"> | ||
<h5 class="card-title">Card 1</h5> | ||
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-md-4"> | ||
<div class="card bg-dark text-white"> | ||
<div class="card-body"> | ||
<h5 class="card-title">Card 2</h5> | ||
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-md-4"> | ||
<div class="card bg-dark text-white"> | ||
<div class="card-body"> | ||
<h5 class="card-title">Card 3</h5> | ||
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
<!-- Bootstrap JS and dependencies (not required for styling) --> | ||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script> | ||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> | ||
|
||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.