update
This commit is contained in:
Binary file not shown.
15
app/main.py
15
app/main.py
@@ -1,9 +1,11 @@
|
||||
from fastapi import FastAPI, APIRouter, Request
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from security import security_router
|
||||
import uvicorn
|
||||
|
||||
app = FastAPI()
|
||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||
app.include_router(security_router)
|
||||
|
||||
templates = Jinja2Templates(directory="templates")
|
||||
@@ -11,11 +13,20 @@ templates = Jinja2Templates(directory="templates")
|
||||
|
||||
@app.get("/")
|
||||
async def read_root(request: Request):
|
||||
data = "hi"
|
||||
routes = []
|
||||
for route in request.app.routes:
|
||||
if route.name in ["openapi", "swagger_ui_html", "swagger_ui_redirect", "redoc_html", "static", "read_root"]:
|
||||
continue
|
||||
routes.append({
|
||||
"path": getattr(route, "path", "N/A"),
|
||||
"name": getattr(route, "name", "N/A"),
|
||||
"methods": list(route.methods) if hasattr(route, "methods") else []
|
||||
})
|
||||
|
||||
return templates.TemplateResponse(
|
||||
request=request,
|
||||
name="index.html",
|
||||
contents={"data": data}
|
||||
context={"routes": routes}
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -6,12 +6,7 @@ templates = Jinja2Templates(directory="templates")
|
||||
|
||||
|
||||
@security_router.get("/browser")
|
||||
async def security_check_list(request: Request):
|
||||
async def browser_local_cryptography_strength(request: Request):
|
||||
return templates.TemplateResponse(
|
||||
request=request, name="browser_random_number.html", contents={"rand": "rand"}
|
||||
)
|
||||
|
||||
|
||||
@security_router.get("/browser")
|
||||
async def security_check_browser():
|
||||
return {"message": "checking browser security"}
|
||||
|
||||
BIN
app/static/logo.png
Normal file
BIN
app/static/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 MiB |
@@ -1,5 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link href="https://cdn.jsdelivr.net/npm/flowbite@2.5.2/dist/flowbite.min.css" rel="stylesheet" />
|
||||
@@ -9,24 +10,31 @@
|
||||
{% block css %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<nav class="bg-white border-gray-200 dark:bg-gray-900">
|
||||
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
||||
<a href="https://security.ekstrah.com/" class="flex items-center space-x-3 rtl:space-x-reverse">
|
||||
<img src="https://pics.ekstrah.com/0p36up.png" class="h-8" alt="Flowbite Logo" />
|
||||
<img src="{{ url_for('static', path='logo.png') }}" class="h-24" alt="Flowbite Logo" />
|
||||
</a>
|
||||
<button data-collapse-toggle="navbar-default" type="button" class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" aria-controls="navbar-default" aria-expanded="false">
|
||||
<button data-collapse-toggle="navbar-default" type="button"
|
||||
class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
|
||||
aria-controls="navbar-default" aria-expanded="false">
|
||||
<span class="sr-only">Open main menu</span>
|
||||
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1h15M1 7h15M1 13h15"/>
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M1 1h15M1 7h15M1 13h15" />
|
||||
</svg>
|
||||
</button>
|
||||
<div class="hidden w-full md:block md:w-auto" id="navbar-default">
|
||||
<ul class="font-medium flex flex-col p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 rtl:space-x-reverse md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
|
||||
<ul
|
||||
class="font-medium flex flex-col p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 rtl:space-x-reverse md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
|
||||
<li>
|
||||
<a href="#" class="block py-2 px-3 text-white bg-blue-700 rounded md:bg-transparent md:text-blue-700 md:p-0 dark:text-white md:dark:text-blue-500" aria-current="page">Home</a>
|
||||
<a href="#"
|
||||
class="block py-2 px-3 text-white bg-blue-700 rounded md:bg-transparent md:text-blue-700 md:p-0 dark:text-white md:dark:text-blue-500"
|
||||
aria-current="page">Home</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -38,8 +46,9 @@
|
||||
{% block js %}
|
||||
{% endblock %}
|
||||
<footer class="flex justify-center mt-8">
|
||||
<p>© 2024 EKSTRAH Security Application</p>
|
||||
<p>© 2025 EKSTRAH Security Application</p>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="max-w-scree grid grid-cols-1 items-center divide-y">
|
||||
<div class="flex justify-center pt-6">
|
||||
<div class="flex flex-col justify-center pt-6 text-center">
|
||||
<p class="text-2xl" id="browser-name">Detected Browser: Something</p>
|
||||
<p class="mt-2 text-gray-600 dark:text-gray-400">This visualization demonstrates the strength and uniformity of your
|
||||
browser's random number generator.</p>
|
||||
</div>
|
||||
<div class="flex justify-center pt-6">
|
||||
<canvas id="randNumCanvas" width="1000" height="1000"></canvas>
|
||||
|
||||
@@ -3,8 +3,34 @@
|
||||
{% block title %}Home Page{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h1>Hello World</h1>
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
<h1 class="text-3xl font-bold text-gray-900 dark:text-white mb-6">Available Endpoints</h1>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{% for route in routes %}
|
||||
<div
|
||||
class="bg-white dark:bg-gray-800 rounded-lg shadow-md hover:shadow-lg transition-shadow duration-300 overflow-hidden border border-gray-200 dark:border-gray-700">
|
||||
<div class="p-6">
|
||||
<h2 class="text-xl font-semibold text-gray-900 dark:text-white mb-2">{{ route.name }}</h2>
|
||||
<div class="mb-4">
|
||||
<span
|
||||
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300">
|
||||
{{ route.methods | join(', ') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex items-center justify-between">
|
||||
<code
|
||||
class="text-sm text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded">{{ route.path }}</code>
|
||||
{% if 'GET' in route.methods %}
|
||||
<a href="{{ route.path }}"
|
||||
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800">
|
||||
Visit
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -4,4 +4,7 @@ services:
|
||||
user: 1000:1000 # should be owner of volumes
|
||||
ports:
|
||||
- 35050:35050
|
||||
volumes:
|
||||
- ./app:/code/app
|
||||
command: fastapi dev main.py --host 0.0.0.0 --port 35050
|
||||
restart: unless-stopped
|
||||
|
||||
Reference in New Issue
Block a user