misc python code

This commit is contained in:
ys
2024-12-20 21:50:09 +00:00
parent 6dc40ba6af
commit d3dc84416d
44 changed files with 24998 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<title>Admin Dashboard</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1 class="mt-5">Admin Dashboard</h1>
<a href="{{ url_for('admin_logout') }}" class="btn btn-danger float-right">Logout</a>
<h2 class="mt-4">Pending Requests</h2>
<table class="table table-bordered mt-3">
<thead>
<tr>
<th>URL/Domain</th>
<th>Reason</th>
<th>Status</th>
<th>Date & Time</th>
<th>IP Address</th>
<th>MAC Address</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for req in requests %}
<tr>
<td>{{ req.url }}</td>
<td>{{ req.reason }}</td>
<td>{{ req.status }}</td>
<td>{{ req.timestamp }}</td>
<td>{{ req.ip_address }}</td>
<td>{{ req.mac_address }}</td>
<td>
<form method="post" class="d-inline">
<input type="hidden" name="url" value="{{ req.url }}">
<input type="hidden" name="action" value="approve">
<button type="submit" class="btn btn-success btn-sm">Approve</button>
</form>
<form method="post" class="d-inline">
<input type="hidden" name="url" value="{{ req.url }}">
<input type="hidden" name="action" value="reject">
<button type="submit" class="btn btn-danger btn-sm">Reject</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<h2 class="mt-4">Whitelisted URLs/Domains</h2>
<ul class="list-group mt-3">
{% for url in whitelist %}
<li class="list-group-item">
{{ url.url }}
<form method="post" class="d-inline float-right">
<input type="hidden" name="url" value="{{ url.url }}">
<input type="hidden" name="action" value="revoke">
<button type="submit" class="btn btn-warning btn-sm">Revoke</button>
</form>
</li>
{% endfor %}
</ul>
</div>
<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>

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<title>Admin Login</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1 class="mt-5">Admin Login</h1>
<form method="post" class="mt-3">
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-primary">Login</button>
</form>
</div>
<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>

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Change Password</title>
</head>
<body>
<h1>Change Password</h1>
<form method="POST">
<label for="new_password">New Password:</label>
<input type="password" name="new_password" id="new_password" required>
<br>
<button type="submit">Change Password</button>
</form>
</body>
</html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Whitelist Request</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h1 class="mb-4">Request to Whitelist a URL</h1>
<form action="/whitelist" method="post">
<div class="form-group">
<label for="url">URL:</label>
<input type="text" class="form-control" id="url" name="url" required>
</div>
<div class="form-group">
<label for="reason">Reason:</label>
<textarea class="form-control" id="reason" name="reason" rows="3" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<form method="POST">
<label for="username">Username:</label>
<input type="text" name="username" id="username" required>
<br>
<label for="password">Password:</label>
<input type="password" name="password" id="password" required>
<br>
<button type="submit">Login</button>
</form>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
</body>
</html>

View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Request Whitelist</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1 class="mt-5">Request URL/Domain Whitelisting</h1>
<form method="post" class="mt-3">
<div class="form-group">
<label for="url">URL/Domain</label>
<input type="text" class="form-control" id="url" name="url" required>
</div>
<div class="form-group">
<label for="reason">Reason</label>
<input type="text" class="form-control" id="reason" name="reason" required>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<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>

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<title>Set Admin Password</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1 class="mt-5">Set Admin Password</h1>
<form method="post" class="mt-3">
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-primary">Set Password</button>
</form>
</div>
<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>

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<title>Whitelisted URLs</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h1 class="mb-4">Whitelisted URLs</h1>
<a href="{{ url_for('admin') }}" class="btn btn-secondary mb-4">Back to Admin</a>
<table class="table table-bordered">
<thead class="thead-dark">
<tr>
<th>URL</th>
</tr>
</thead>
<tbody>
{% for url in approved_urls %}
<tr>
<td>{{ url[0] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</body>
</html>