mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 07:11:28 +02:00
- Store each run's row, first-seen and retired counts (scan_deltas, scan_retired), valid while the revision stamp matches scan_revisions; statement triggers on the seven result tables bump it. Finalize warms, a beat backfill fills the rest, a live run answers from its last count and queues a refresh. /scans 1.5 s -> 43 ms, dashboard overview 5-10 s -> 0.9 s. - lead_cache holds a live scope for 20 s with a stale copy, and every build is single-flight; search pages opt out. - Leads: lowercase subdomain names (CHECK) and LIKE for host:, a guard for empty JSON arrays, branches as MATERIALIZED CTEs read to the cap, every count in one statement. - Addresses and services: the derived CTE as one grouped pass, rows and count in one execution (page_rows), GIN lookups for page hosts, facets through grouping sets. - Correlation carriers counted by EXISTS; takeover latest-sighting in SQL, no silent cap. - Screenshot backfill partial index, nine unused low-cardinality indexes dropped, hostname helpers memoised, vhost names normalised.
110 lines
2.7 KiB
Python
110 lines
2.7 KiB
Python
from .ast import Node, QuerySyntaxError
|
|
from .compiler import QueryContext, compile_query
|
|
from .endpoint_compiler import EndpointQueryContext, compile_endpoint_query
|
|
from .errors import (
|
|
NO_JIT,
|
|
QUERY_SQLSTATES,
|
|
STATEMENT_TIMEOUT,
|
|
query_error_for,
|
|
syntax_error,
|
|
)
|
|
from .evidence import collect as collect_evidence
|
|
from .groups import (
|
|
build_endpoint_groups,
|
|
build_groups,
|
|
build_ip_groups,
|
|
build_secret_groups,
|
|
build_service_groups,
|
|
build_vuln_groups,
|
|
)
|
|
from .ip_compiler import IpQueryContext, compile_ip_query
|
|
from .leads import build_leads, count_queries
|
|
from .paging import page_rows
|
|
from .parser import parse_query
|
|
from .predicates import (
|
|
endpoint_has_baseline,
|
|
endpoint_is_new,
|
|
endpoint_source,
|
|
endpoint_status_class,
|
|
inet_of,
|
|
resolved,
|
|
secret_has_baseline,
|
|
secret_is_new,
|
|
service_has_baseline,
|
|
service_is_new,
|
|
software_has_baseline,
|
|
software_is_new,
|
|
vuln_corroborated,
|
|
vuln_corroborated_ids,
|
|
vuln_evidence,
|
|
vuln_has_baseline,
|
|
vuln_is_new,
|
|
vuln_state,
|
|
vuln_suppressed,
|
|
)
|
|
from .schema import build_schema
|
|
from .scope import QueryScope, ScopeLike, scan_filter, scope_of
|
|
from .secret_compiler import SecretQueryContext, compile_secret_query
|
|
from .service_compiler import ServiceQueryContext, compile_service_query
|
|
from .software_compiler import SoftwareQueryContext, compile_software_query
|
|
from .vuln_compiler import VulnQueryContext, compile_vuln_query
|
|
|
|
__all__ = [
|
|
"NO_JIT",
|
|
"QUERY_SQLSTATES",
|
|
"STATEMENT_TIMEOUT",
|
|
"EndpointQueryContext",
|
|
"IpQueryContext",
|
|
"Node",
|
|
"QueryContext",
|
|
"QueryScope",
|
|
"QuerySyntaxError",
|
|
"ScopeLike",
|
|
"SecretQueryContext",
|
|
"ServiceQueryContext",
|
|
"SoftwareQueryContext",
|
|
"VulnQueryContext",
|
|
"build_endpoint_groups",
|
|
"build_groups",
|
|
"build_ip_groups",
|
|
"build_leads",
|
|
"build_schema",
|
|
"build_secret_groups",
|
|
"build_service_groups",
|
|
"build_vuln_groups",
|
|
"collect_evidence",
|
|
"compile_endpoint_query",
|
|
"compile_ip_query",
|
|
"compile_query",
|
|
"compile_secret_query",
|
|
"compile_service_query",
|
|
"compile_software_query",
|
|
"compile_vuln_query",
|
|
"count_queries",
|
|
"endpoint_has_baseline",
|
|
"endpoint_is_new",
|
|
"endpoint_source",
|
|
"endpoint_status_class",
|
|
"inet_of",
|
|
"page_rows",
|
|
"parse_query",
|
|
"query_error_for",
|
|
"resolved",
|
|
"scan_filter",
|
|
"scope_of",
|
|
"secret_has_baseline",
|
|
"secret_is_new",
|
|
"service_has_baseline",
|
|
"service_is_new",
|
|
"software_has_baseline",
|
|
"software_is_new",
|
|
"syntax_error",
|
|
"vuln_corroborated",
|
|
"vuln_corroborated_ids",
|
|
"vuln_evidence",
|
|
"vuln_has_baseline",
|
|
"vuln_is_new",
|
|
"vuln_state",
|
|
"vuln_suppressed",
|
|
]
|