first commit
This commit is contained in:
33
app/templates/base.html
Normal file
33
app/templates/base.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>{{ app_name }} {{ app_version }}</title>
|
||||
<link rel="stylesheet" href="https://unpkg.com/sanitize.css" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>{{ app_name }} {{ app_version }}</h1>
|
||||
</header>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<ul class="flash">
|
||||
{% for category, message in messages %}
|
||||
<li class="{{ category }}">{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<main>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<small>{{ app_name }} - A self-hosted URL analysis sandbox - {{ app_version }}</small>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
149
app/templates/index.html
Normal file
149
app/templates/index.html
Normal file
@@ -0,0 +1,149 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<!-- Analysis Form -->
|
||||
<form id="analyze-form" method="post" action="{{ url_for('main.analyze') }}" class="card">
|
||||
<h2>Analyze a URL</h2>
|
||||
<label for="url">Enter a URL to analyze</label>
|
||||
<input id="url" name="url" type="url" placeholder="https://example.com" required />
|
||||
<button type="submit">Analyze</button>
|
||||
</form>
|
||||
|
||||
<!-- Recent Results (optional; shown only if recent_results provided) -->
|
||||
{% if recent_results %}
|
||||
<div class="card" id="recent-results">
|
||||
<h2>Recent Results</h2>
|
||||
<table class="results-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Timestamp</th>
|
||||
<th>URL</th>
|
||||
<th>UUID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in recent_results %}
|
||||
<tr>
|
||||
<td class="timestamp">
|
||||
{% if r.timestamp %}
|
||||
{{ r.timestamp }}
|
||||
{% else %}
|
||||
N/A
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="url">
|
||||
<a href="{{ url_for('main.view_result', run_uuid=r.uuid) }}">
|
||||
{{ r.final_url or r.submitted_url }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="uuid">
|
||||
<code id="uuid-{{ loop.index }}">{{ r.uuid }}</code>
|
||||
<button
|
||||
type="button"
|
||||
class="copy-btn"
|
||||
data-target="uuid-{{ loop.index }}">
|
||||
📋
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Spinner Modal -->
|
||||
<div id="spinner-modal" style="
|
||||
display:none;
|
||||
opacity:0;
|
||||
position:fixed;
|
||||
top:0;
|
||||
left:0;
|
||||
width:100%;
|
||||
height:100%;
|
||||
background:rgba(0,0,0,0.7);
|
||||
color:#fff;
|
||||
font-size:1.5rem;
|
||||
text-align:center;
|
||||
padding-top:20%;
|
||||
z-index:9999;
|
||||
transition: opacity 0.3s ease;
|
||||
">
|
||||
<div>
|
||||
<div class="loader" style="
|
||||
border: 8px solid #f3f3f3;
|
||||
border-top: 8px solid #1a2535;
|
||||
border-radius: 50%;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto 1rem auto;
|
||||
"></div>
|
||||
Analyzing website…
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
const form = document.getElementById('analyze-form');
|
||||
const modal = document.getElementById('spinner-modal');
|
||||
|
||||
function showModal() {
|
||||
modal.style.display = 'block';
|
||||
requestAnimationFrame(() => {
|
||||
modal.style.opacity = '1';
|
||||
});
|
||||
}
|
||||
|
||||
function hideModal() {
|
||||
modal.style.opacity = '0';
|
||||
modal.addEventListener('transitionend', () => {
|
||||
modal.style.display = 'none';
|
||||
}, { once: true });
|
||||
}
|
||||
|
||||
// Hide spinner on initial load / back navigation
|
||||
window.addEventListener('pageshow', () => {
|
||||
modal.style.opacity = '0';
|
||||
modal.style.display = 'none';
|
||||
});
|
||||
|
||||
form.addEventListener('submit', (e) => {
|
||||
showModal();
|
||||
// Prevent double submission
|
||||
form.querySelector('button').disabled = true;
|
||||
|
||||
// Allow browser to render the modal before submitting
|
||||
requestAnimationFrame(() => form.submit());
|
||||
e.preventDefault();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const buttons = document.querySelectorAll('.copy-btn');
|
||||
buttons.forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
const targetId = btn.getAttribute('data-target');
|
||||
const uuidText = document.getElementById(targetId).innerText;
|
||||
|
||||
navigator.clipboard.writeText(uuidText).then(() => {
|
||||
// Give quick feedback
|
||||
btn.textContent = '✅';
|
||||
setTimeout(() => { btn.textContent = '📋'; }, 1500);
|
||||
}).catch(err => {
|
||||
console.error('Failed to copy UUID:', err);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
268
app/templates/result.html
Normal file
268
app/templates/result.html
Normal file
@@ -0,0 +1,268 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<!-- Top Jump List -->
|
||||
<div class="card" id="top-jump-list">
|
||||
<h2>Jump to Section</h2>
|
||||
<ul>
|
||||
<li><a href="/">Analyse Another Page</a></li>
|
||||
<li><a href="#url-overview">URL Overview</a></li>
|
||||
<li><a href="#enrichment">Enrichment</a></li>
|
||||
<li><a href="#redirects">Redirects</a></li>
|
||||
<li><a href="#forms">Forms</a></li>
|
||||
<li><a href="#scripts">Suspicious Scripts</a></li>
|
||||
<li><a href="#screenshot">Screenshot</a></li>
|
||||
<li><a href="#source">Source</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- URL Overview -->
|
||||
<div class="card" id="url-overview">
|
||||
<h2>URL Overview</h2>
|
||||
<p><strong>Submitted URL:</strong> {{ submitted_url }}</p>
|
||||
<p><strong>Final URL:</strong> <a href="{{ final_url }}" target="_blank">{{ final_url }}</a></p>
|
||||
<p><strong>Permalink:</strong>
|
||||
<a href="{{ url_for('main.view_result', run_uuid=uuid, _external=True) }}">
|
||||
{{ request.host_url }}results/{{ uuid }}
|
||||
</a>
|
||||
</p>
|
||||
<p><a href="#top-jump-list">Back to top</a></p>
|
||||
</div>
|
||||
|
||||
<!-- Enrichment -->
|
||||
<div class="card" id="enrichment">
|
||||
<h2>Enrichment</h2>
|
||||
|
||||
<!-- WHOIS -->
|
||||
{% if enrichment.whois %}
|
||||
<h3>WHOIS</h3>
|
||||
<table class="enrichment-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for k, v in enrichment.whois.items() %}
|
||||
<tr>
|
||||
<td>{{ k.replace('_', ' ').title() }}</td>
|
||||
<td>{{ v }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if enrichment.raw_whois %}
|
||||
<h3>Raw WHOIS</h3>
|
||||
<pre class="code">{{ enrichment.raw_whois }}</pre>
|
||||
{% endif %}
|
||||
|
||||
<!-- GeoIP / IP-API -->
|
||||
{% if enrichment.geoip %}
|
||||
<h3>GeoIP</h3>
|
||||
{% for ip, info in enrichment.geoip.items() %}
|
||||
<details class="card" style="padding:0.5rem; margin-bottom:0.5rem;">
|
||||
<summary>{{ ip }}</summary>
|
||||
<table class="enrichment-table">
|
||||
<tbody>
|
||||
{% for key, val in info.items() %}
|
||||
<tr>
|
||||
<td>{{ key.replace('_', ' ').title() }}</td>
|
||||
<td>{{ val }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</details>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<!-- BEC Words -->
|
||||
{% if enrichment.bec_words %}
|
||||
<h3>BEC Words Detected</h3>
|
||||
<table class="enrichment-table">
|
||||
<thead>
|
||||
<tr><th>Word</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for word in enrichment.bec_words %}
|
||||
<tr><td>{{ word }}</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if not enrichment.whois and not enrichment.raw_whois and not enrichment.geoip and not enrichment.bec_words %}
|
||||
<p>No enrichment data available.</p>
|
||||
{% endif %}
|
||||
|
||||
<p><a href="#top-jump-list">Back to top</a></p>
|
||||
</div>
|
||||
|
||||
<!-- Redirects -->
|
||||
<div class="card" id="redirects">
|
||||
<h2>Redirects</h2>
|
||||
{% if redirects %}
|
||||
<table class="enrichment-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<th>URL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in redirects %}
|
||||
<tr>
|
||||
<td>{{ r.status }}</td>
|
||||
<td><a href="{{ r.url }}" target="_blank">{{ r.url }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>No redirects detected.</p>
|
||||
{% endif %}
|
||||
<p><a href="#top-jump-list">Back to top</a></p>
|
||||
</div>
|
||||
|
||||
<!-- Forms -->
|
||||
<div class="card" id="forms">
|
||||
<h2>Forms</h2>
|
||||
{% if forms %}
|
||||
{% for form in forms %}
|
||||
<details class="card {% if form.flagged %}flagged{% endif %}" style="padding:0.5rem; margin-bottom:0.5rem;">
|
||||
<summary>{{ form.status }} — Action: {{ form.action }} ({{ form.method | upper }})</summary>
|
||||
<table class="enrichment-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Input Name</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for inp in form.inputs %}
|
||||
<tr>
|
||||
<td>{{ inp.name }}</td>
|
||||
<td>{{ inp.type }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if form.flagged %}
|
||||
<p><strong>Flag Reasons:</strong></p>
|
||||
<ul>
|
||||
{% for reason in form.flag_reasons %}
|
||||
<li>{{ reason }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</details>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p>No forms detected.</p>
|
||||
{% endif %}
|
||||
<p><a href="#top-jump-list">Back to top</a></p>
|
||||
</div>
|
||||
|
||||
<!-- Suspicious Scripts -->
|
||||
<div class="card" id="scripts">
|
||||
<h2>Suspicious Scripts</h2>
|
||||
|
||||
{% if suspicious_scripts %}
|
||||
<table class="enrichment-table scripts-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Source URL</th>
|
||||
<th>Content Snippet</th>
|
||||
<th>Matches (Rules & Heuristics)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for s in suspicious_scripts %}
|
||||
<tr>
|
||||
<!-- Type -->
|
||||
<td>{{ s.type or 'unknown' }}</td>
|
||||
|
||||
<!-- Source URL -->
|
||||
<td>
|
||||
{% if s.src %}
|
||||
<a href="{{ s.src }}" target="_blank">{{ s.src }}</a>
|
||||
{% else %}
|
||||
N/A
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Inline content snippet (collapsible) -->
|
||||
<td>
|
||||
{% if s.content_snippet %}
|
||||
<details>
|
||||
<summary>View snippet</summary>
|
||||
<pre class="code">{{ s.content_snippet }}</pre>
|
||||
</details>
|
||||
{% else %}
|
||||
N/A
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Rules & Heuristics -->
|
||||
<td>
|
||||
{% set has_rules = s.rules and s.rules|length > 0 %}
|
||||
{% set has_heur = s.heuristics and s.heuristics|length > 0 %}
|
||||
|
||||
{% if has_rules %}
|
||||
<strong>Rules</strong>
|
||||
<ul>
|
||||
{% for r in s.rules %}
|
||||
<li title="{{ r.description or '' }}">
|
||||
{{ r.name }}
|
||||
{% if r.description %}
|
||||
<small>— {{ r.description }}</small>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if has_heur %}
|
||||
<strong>Heuristics</strong>
|
||||
<ul>
|
||||
{% for h in s.heuristics %}
|
||||
<li>{{ h }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if not has_rules and not has_heur %}
|
||||
N/A
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>No suspicious scripts detected.</p>
|
||||
{% endif %}
|
||||
|
||||
<p><a href="#top-jump-list">Back to top</a></p>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Screenshot -->
|
||||
<div class="card" id="screenshot">
|
||||
<h2>Screenshot</h2>
|
||||
<img src="{{ url_for('main.artifacts', run_uuid=uuid, filename='screenshot.png') }}" alt="Screenshot">
|
||||
<p><a href="#top-jump-list">Back to top</a></p>
|
||||
</div>
|
||||
|
||||
<!-- Source -->
|
||||
<div class="card" id="source">
|
||||
<h2>Source</h2>
|
||||
<p><a href="{{ url_for('main.artifacts', run_uuid=uuid, filename='source.txt') }}" target="_blank">View Source</a></p>
|
||||
<p><a href="#top-jump-list">Back to top</a></p>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user