- Add SSL/TLS intelligence pipeline:
- crt.sh lookup with expired-filtering and root-domain wildcard resolution
- live TLS version/cipher probe with weak/legacy flags and probe notes
- UI: card + matrix rendering, raw JSON toggle, and host/wildcard cert lists
- Front page: checkbox to optionally fetch certificate/CT data
- Introduce `URLNormalizer` with punycode support and typo repair
- Auto-prepend `https://` for bare domains (e.g., `google.com`)
- Optional quick HTTPS reachability + `http://` fallback
- Provide singleton via function-cached `@singleton_loader`:
- `get_url_normalizer()` reads defaults from Settings (if present)
- Standardize function-rule return shape to `(bool, dict|None)` across
`form_*` and `script_*` rules; include structured payloads (`note`, hosts, ext, etc.)
- Harden `FunctionRuleAdapter`:
- Coerce legacy returns `(bool)`, `(bool, str)` → normalized outputs
- Adapt non-dict inputs to facts (category-aware and via provided adapter)
- Return `(True, dict)` on match, `(False, None)` on miss
- Bind-time logging with file:line + function id for diagnostics
- `RuleEngine`:
- Back rules by private `self._rules`; `rules` property returns copy
- Idempotent `add_rule(replace=False)` with in-place replace and regex (re)compile
- Fix AttributeError from property assignment during `__init__`
- Replace hidden singleton factory with explicit builder + global state:
- `app/rules/factory.py::build_rules_engine()` builds and logs totals
- `app/state.py` exposes `set_rules_engine()` / `get_rules_engine()` as the SOF
- `app/wsgi.py` builds once at preload and publishes via `set_rules_engine()`
- Add lightweight debug hooks (`SS_DEBUG_RULES=1`) to trace engine id and rule counts
- Unify logging wiring:
- `wire_logging_once(app)` clears and attaches a single handler chain
- Create two named loggers: `sneakyscope.app` and `sneakyscope.engine`
- Disable propagation to prevent dupes; include pid/logger name in format
- Remove stray/duplicate handlers and import-time logging
- Optional dedup filter for bursty repeats (kept off by default)
- Gunicorn: enable `--preload` in entrypoint to avoid thread races and double registration
- Documented foreground vs background log “double consumer” caveat (attach vs `compose logs`)
- Jinja: replace `{% return %}` with structured `if/elif/else` branches
- Add toggle button to show raw JSON for TLS/CT section
- Consumers should import the rules engine via:
- `from app.state import get_rules_engine`
- Use `build_rules_engine()` **only** during preload/init to construct the instance,
then publish with `set_rules_engine()`. Do not call old singleton factories.
- New/changed modules (high level):
- `app/utils/urltools.py` (+) — URLNormalizer + `get_url_normalizer()`
- `app/rules/function_rules.py` (±) — normalized payload returns
- `engine/function_rule_adapter.py` (±) — coercion, fact adaptation, bind logs
- `app/utils/rules_engine.py` (±) — `_rules`, idempotent `add_rule`, fixes
- `app/rules/factory.py` (±) — pure builder; totals logged post-registration
- `app/state.py` (+) — process-global rules engine
- `app/logging_setup.py` (±) — single chain, two named loggers
- `app/wsgi.py` (±) — preload build + `set_rules_engine()`
- `entrypoint.sh` (±) — add `--preload`
- templates (±) — TLS card, raw toggle; front-page checkbox
Closes: flaky rule-type warnings, duplicate logs, and multi-worker race on rules init.
473 lines
14 KiB
CSS
473 lines
14 KiB
CSS
/* ==========================================================================
|
|
SneakyScope Stylesheet
|
|
Consolidated + Commented
|
|
========================================================================== */
|
|
|
|
/* ==========================================================================
|
|
0) Theme Variables
|
|
-------------------------------------------------------------------------- */
|
|
:root {
|
|
/* Typography */
|
|
--font-sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
|
|
|
|
/* Colors (derived from your current palette) */
|
|
--bg: #0b0f14;
|
|
--text: #e6edf3;
|
|
--header-bg: #0f1720;
|
|
--card-bg: #111826;
|
|
--border: #1f2a36; /* darker border */
|
|
--border-2: #243041; /* lighter border used on inputs/tables */
|
|
--input-bg: #0b1220;
|
|
|
|
--link: #7dd3fc;
|
|
--link-hover: #38bdf8;
|
|
|
|
/* Accents */
|
|
--accent-pill-bg: rgba(59,130,246,.18);
|
|
--accent-pill-bd: rgba(59,130,246,.45);
|
|
|
|
/* Radius & Shadows */
|
|
--radius: 12px;
|
|
}
|
|
|
|
/* ==========================================================================
|
|
1) Base / Reset
|
|
-------------------------------------------------------------------------- */
|
|
html { scroll-behavior: smooth; }
|
|
|
|
:root { font-family: var(--font-sans); }
|
|
|
|
body {
|
|
margin: 0;
|
|
background: var(--bg);
|
|
color: var(--text);
|
|
}
|
|
|
|
a {
|
|
color: var(--link);
|
|
text-decoration: underline;
|
|
}
|
|
a:hover { color: var(--link-hover); }
|
|
|
|
img {
|
|
max-width: 100%;
|
|
height: auto;
|
|
border-radius: 8px;
|
|
border: 1px solid var(--border-2);
|
|
}
|
|
|
|
/* ==========================================================================
|
|
2) Layout (header/footer/main/cards)
|
|
-------------------------------------------------------------------------- */
|
|
header, footer {
|
|
padding: 1rem 1.25rem;
|
|
background: var(--header-bg);
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
|
|
main {
|
|
/* full-width layout */
|
|
padding: 1.5rem 2rem;
|
|
max-width: 100%;
|
|
width: 100%;
|
|
margin: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.card {
|
|
background: var(--card-bg);
|
|
padding: 1rem;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
margin-bottom: 1rem;
|
|
/* anchors don't hide under sticky nav */
|
|
scroll-margin-top: 72px;
|
|
}
|
|
|
|
/* ==========================================================================
|
|
3) Form Controls & Buttons
|
|
-------------------------------------------------------------------------- */
|
|
label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
input[type="url"] {
|
|
width: 100%;
|
|
padding: 0.7rem;
|
|
border-radius: 8px;
|
|
border: 1px solid var(--border-2);
|
|
background: var(--input-bg);
|
|
color: var(--text);
|
|
}
|
|
|
|
button, .button {
|
|
display: inline-block;
|
|
margin-top: 0.75rem;
|
|
padding: 0.6rem 1rem;
|
|
border-radius: 8px;
|
|
border: 1px solid var(--border-2);
|
|
background: #1a2535;
|
|
color: var(--text);
|
|
text-decoration: none;
|
|
cursor: pointer;
|
|
}
|
|
button:hover, .button:hover { filter: brightness(1.05); }
|
|
|
|
/* Flash messages */
|
|
.flash { list-style: none; padding: 0.5rem 1rem; }
|
|
.flash .error { color: #ff6b6b; }
|
|
|
|
/* Simple grid utility */
|
|
.grid {
|
|
display: grid;
|
|
grid-template-columns: 150px 1fr;
|
|
gap: 0.5rem 1rem;
|
|
}
|
|
|
|
/* ==========================================================================
|
|
4) Code Blocks & Details/Accordion
|
|
-------------------------------------------------------------------------- */
|
|
pre.code {
|
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
font-size: 0.9rem;
|
|
white-space: pre-wrap; /* wrap long lines */
|
|
word-break: break-all;
|
|
background: var(--input-bg);
|
|
padding: 0.75rem;
|
|
border-radius: 8px;
|
|
border: 1px solid var(--border-2);
|
|
}
|
|
|
|
details summary {
|
|
cursor: pointer;
|
|
padding: 0.5rem;
|
|
font-weight: bold;
|
|
border-radius: 8px;
|
|
background: var(--card-bg);
|
|
border: 1px solid var(--border);
|
|
margin-bottom: 0.5rem;
|
|
transition: background 0.3s ease;
|
|
}
|
|
details[open] summary { background: #1a2535; }
|
|
|
|
/* inner spacing when expanded */
|
|
details > ul,
|
|
details > table { padding-left: 1rem; margin: 0.5rem 0; }
|
|
|
|
/* flagged state */
|
|
details.flagged summary { border-left: 4px solid #ff6b6b; }
|
|
|
|
/* gentle transitions */
|
|
details ul, details p { transition: all 0.3s ease; }
|
|
|
|
/* readable expanded code without blowing layout */
|
|
details pre.code {
|
|
white-space: pre-wrap;
|
|
word-break: break-word;
|
|
max-height: 18rem;
|
|
overflow: auto;
|
|
}
|
|
|
|
/* ==========================================================================
|
|
5) Tables — Enrichment (generic)
|
|
-------------------------------------------------------------------------- */
|
|
.enrichment-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-bottom: 1rem;
|
|
}
|
|
.enrichment-table th,
|
|
.enrichment-table td {
|
|
border: 1px solid var(--border-2);
|
|
padding: 0.5rem;
|
|
vertical-align: top;
|
|
}
|
|
.enrichment-table th {
|
|
background: var(--card-bg);
|
|
text-align: left;
|
|
}
|
|
.enrichment-table td {
|
|
width: auto;
|
|
word-break: break-word;
|
|
}
|
|
.enrichment-table tbody tr:hover { background: #1f2a36; }
|
|
.enrichment-table thead th { border-bottom: 2px solid var(--border-2); }
|
|
/* ensure nested tables don't overflow cards */
|
|
.card table { table-layout: auto; word-break: break-word; }
|
|
|
|
/* ==========================================================================
|
|
6) Tables — Shared Rules (Scripts & Forms)
|
|
-------------------------------------------------------------------------- */
|
|
.scripts-table,
|
|
.forms-table {
|
|
table-layout: fixed;
|
|
width: 100%;
|
|
}
|
|
.scripts-table td ul,
|
|
.forms-table td ul {
|
|
margin: 0.25rem 0 0.25rem 1rem;
|
|
padding-left: 1rem;
|
|
}
|
|
.scripts-table td small,
|
|
.forms-table td small { opacity: 0.85; }
|
|
/* ellipsize by default */
|
|
.scripts-table td, .scripts-table th,
|
|
.forms-table td, .forms-table th {
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
/* allow wrapping inside expanded blocks */
|
|
.scripts-table details,
|
|
.forms-table details { white-space: normal; }
|
|
.scripts-table details > pre.code,
|
|
.forms-table details > pre.code {
|
|
white-space: pre-wrap;
|
|
max-height: 28rem;
|
|
overflow: auto;
|
|
}
|
|
|
|
/* ==========================================================================
|
|
7) Scripts Table (columns & tweaks)
|
|
-------------------------------------------------------------------------- */
|
|
/* compact inline snippet */
|
|
.scripts-table pre.code { margin: 0; padding: 0.25rem; font-size: 0.9rem; }
|
|
|
|
/* columns: Type | Source URL | Snippet | Matches */
|
|
.scripts-table th:nth-child(1) { width: 8rem; }
|
|
.scripts-table th:nth-child(2) { width: 32rem; }
|
|
.scripts-table th:nth-child(3) { width: 24rem; }
|
|
.scripts-table th:nth-child(4) { width: auto; }
|
|
|
|
/* ==========================================================================
|
|
8) Forms Table (columns & helpers)
|
|
-------------------------------------------------------------------------- */
|
|
/* columns: Action | Method | Inputs | Matches | Form Snippet */
|
|
.forms-table th:nth-child(1) { width: 15rem; } /* Action */
|
|
.forms-table th:nth-child(2) { width: 5rem; } /* Method */
|
|
.forms-table th:nth-child(3) { width: 15rem; } /* Inputs */
|
|
.forms-table th:nth-child(5) { width: 24rem; } /* Snippet */
|
|
.forms-table th:nth-child(4) { width: auto; } /* Matches grows */
|
|
|
|
/* input chips layout inside cells */
|
|
.forms-table .chips {
|
|
display: flex;
|
|
gap: 0.25rem;
|
|
flex-wrap: wrap;
|
|
white-space: normal;
|
|
}
|
|
|
|
/* ==========================================================================
|
|
9) Results Table (Recent runs list)
|
|
-------------------------------------------------------------------------- */
|
|
.results-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
background: var(--card-bg);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
overflow: hidden;
|
|
table-layout: auto;
|
|
}
|
|
.results-table thead th {
|
|
padding: 0.6rem 0.75rem;
|
|
background: var(--header-bg);
|
|
border-bottom: 1px solid var(--border);
|
|
text-align: left;
|
|
font-weight: 600;
|
|
white-space: nowrap;
|
|
}
|
|
.results-table tbody td {
|
|
padding: 0.6rem 0.75rem;
|
|
border-top: 1px solid var(--border);
|
|
vertical-align: top;
|
|
text-align: left;
|
|
}
|
|
.results-table tbody tr:nth-child(odd) { background: #0d1522; }
|
|
.results-table a { text-decoration: underline; }
|
|
|
|
/* column-specific helpers */
|
|
.results-table td.url,
|
|
.results-table td.url a {
|
|
overflow-wrap: anywhere;
|
|
word-break: break-word;
|
|
}
|
|
.results-table td.uuid {
|
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
word-break: break-all;
|
|
max-width: 28ch;
|
|
}
|
|
.results-table td.timestamp {
|
|
text-align: right;
|
|
white-space: nowrap;
|
|
}
|
|
.results-table tbody tr:first-child { box-shadow: inset 0 0 0 1px var(--border-2); }
|
|
.results-table .copy-btn {
|
|
margin-left: 0.4rem;
|
|
padding: 0.2rem 0.45rem;
|
|
border-radius: 6px;
|
|
border: 1px solid var(--border-2);
|
|
background: #1a2535;
|
|
color: var(--text);
|
|
cursor: pointer;
|
|
line-height: 1;
|
|
font-size: 0.9rem;
|
|
}
|
|
.results-table .copy-btn:hover { filter: brightness(1.1); }
|
|
|
|
/* ==========================================================================
|
|
10) Utilities (chips, badges, helpers)
|
|
-------------------------------------------------------------------------- */
|
|
.breakable { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
|
|
|
|
/* Generic badge + severities */
|
|
.badge {
|
|
display: inline-block;
|
|
padding: 0.1rem 0.4rem;
|
|
margin-left: 0.35rem;
|
|
border-radius: 0.4rem;
|
|
font-size: 0.75rem;
|
|
line-height: 1;
|
|
vertical-align: middle;
|
|
user-select: none;
|
|
border: 1px solid transparent; /* individual severities add their borders */
|
|
}
|
|
.sev-high { background: #fdecea; color: #b71c1c; border-color: #f5c6c4; }
|
|
.sev-medium { background: #fff8e1; color: #8a6d3b; border-color: #ffe0a3; }
|
|
.sev-low { background: #e8f5e9; color: #1b5e20; border-color: #b9e6be; }
|
|
|
|
/* Tag chips */
|
|
.chips { display: flex; gap: 0.25rem; flex-wrap: wrap; }
|
|
.chip {
|
|
display: inline-block;
|
|
padding: 0.1rem 0.35rem;
|
|
border-radius: 999px;
|
|
font-size: 0.7rem;
|
|
line-height: 1;
|
|
background: #eef2f7;
|
|
color: #425466;
|
|
border: 1px solid #d9e2ec;
|
|
}
|
|
|
|
.checkbox-row {
|
|
display: flex; align-items: center; gap: .5rem;
|
|
margin: .5rem 0 1rem;
|
|
}
|
|
|
|
/* ==========================================================================
|
|
11) Sticky Top Jump Navigation
|
|
-------------------------------------------------------------------------- */
|
|
.top-jump-nav {
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 50;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: .5rem .75rem;
|
|
padding: .5rem 1rem;
|
|
margin: 0 0 1rem 0;
|
|
|
|
background: var(--card-bg);
|
|
border: 1px solid rgba(255,255,255,.08);
|
|
box-shadow: 0 4px 14px rgba(0,0,0,.25);
|
|
border-radius: 10px;
|
|
|
|
overflow-x: auto;
|
|
white-space: nowrap;
|
|
-webkit-overflow-scrolling: touch;
|
|
}
|
|
.top-jump-nav a {
|
|
display: inline-block;
|
|
padding: .4rem .75rem;
|
|
border: 1px solid rgba(255,255,255,.12);
|
|
border-radius: 999px;
|
|
text-decoration: none;
|
|
font-size: .95rem;
|
|
line-height: 1;
|
|
color: inherit;
|
|
opacity: .95;
|
|
}
|
|
.top-jump-nav a:hover,
|
|
.top-jump-nav a:focus {
|
|
opacity: 1;
|
|
background: rgba(255,255,255,.06);
|
|
outline: none;
|
|
}
|
|
.top-jump-nav a.active {
|
|
background: var(--accent-pill-bg);
|
|
border-color: var(--accent-pill-bd);
|
|
box-shadow: inset 0 0 0 1px rgba(59,130,246,.25);
|
|
}
|
|
|
|
/* --- Titles and structure --- */
|
|
.card-title { margin: 0 0 .5rem; font-size: 1.1rem; }
|
|
.section { margin-top: 1rem; }
|
|
.section-header { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
|
|
|
|
/* --- Divider --- */
|
|
.divider { border: 0; border-top: 1px solid #1f2a36; margin: 1rem 0; }
|
|
|
|
/* --- Badges / Chips --- */
|
|
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .75rem; border: 1px solid transparent; }
|
|
.badge-ok { background: #0e3820; border-color: #2c6e49; color: #bff3cf; }
|
|
.badge-warn { background: #3d290e; border-color: #9a6b18; color: #ffe2a8; }
|
|
.badge-danger { background: #401012; border-color: #a33a42; color: #ffc1c5; }
|
|
.badge-muted { background: #111826; border-color: #273447; color: #9fb0c3; }
|
|
|
|
.chip { display: inline-block; padding: .1rem .4rem; border: 1px solid #273447; border-radius: 8px; font-size: .75rem; margin-right: .25rem; }
|
|
.chip-warn { border-color: #9a6b18; }
|
|
|
|
/* --- Text helpers --- */
|
|
.muted { color: #9fb0c3; }
|
|
.small { font-size: .8rem; }
|
|
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
|
|
.prewrap { white-space: pre-wrap; }
|
|
|
|
/* --- Lists / details --- */
|
|
.list { margin: .5rem 0; padding-left: 1.1rem; }
|
|
.details summary { cursor: pointer; }
|
|
|
|
/* --- Grid --- */
|
|
.grid.two { display: grid; grid-template-columns: 1fr; gap: 1rem; }
|
|
@media (min-width: 900px) {
|
|
.grid.two { grid-template-columns: 1fr 1fr; }
|
|
}
|
|
|
|
/* --- TLS Matrix --- */
|
|
.tls-matrix { border: 1px solid #1f2a36; border-radius: 10px; overflow: hidden; }
|
|
.tls-matrix-row { display: grid; grid-template-columns: 120px 140px 1fr 100px; gap: .5rem; align-items: center;
|
|
padding: .5rem .75rem; border-bottom: 1px solid #1f2a36; }
|
|
.tls-matrix-row:last-child { border-bottom: none; }
|
|
|
|
.tls-cell.version { font-weight: 600; }
|
|
.tls-cell.status {}
|
|
.tls-cell.cipher {}
|
|
.tls-cell.latency { text-align: right; }
|
|
|
|
|
|
/* ==========================================================================
|
|
12) Responsive Tweaks
|
|
-------------------------------------------------------------------------- */
|
|
@media (max-width: 1200px) {
|
|
.forms-table th:nth-child(1) { width: 22rem; }
|
|
.forms-table th:nth-child(3) { width: 16rem; }
|
|
.forms-table th:nth-child(5) { width: 18rem; }
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
main { padding: 1rem; }
|
|
|
|
.enrichment-table,
|
|
.results-table {
|
|
display: block;
|
|
overflow-x: auto;
|
|
white-space: nowrap;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 640px) {
|
|
.top-jump-nav { padding: .4rem .6rem; gap: .4rem .5rem; }
|
|
.top-jump-nav a { padding: .35rem .6rem; font-size: .9rem; }
|
|
}
|