pub enum Stmt {
Show 37 variants
Name(String),
Description(String),
Impact(String),
Severity(Severity),
Author(String),
Cve(String),
Cwe(String),
Reference(String),
Cvss(String),
CvssScore(String),
Mitigation(String),
Tag(String),
Version(String),
Family(String),
Set {
name: String,
value: Value,
},
ForIn {
item: String,
list: ListSource,
body: Vec<Stmt>,
},
Http {
name: String,
items: Vec<HttpItem>,
},
Dns(SocketProbe),
Tcp(SocketProbe),
Udp(SocketProbe),
Send {
probe: String,
payload: Option<Vec<u8>>,
},
Break,
Match(QualifiedMatch),
MatchAll(Vec<QualifiedMatch>),
MatchAny(Vec<QualifiedMatch>),
Assert(QualifiedMatch),
Extract {
name: String,
source: ExtractSource,
},
If {
condition: QualifiedMatch,
body: Vec<Stmt>,
},
Save {
request: String,
alias: String,
},
Evidence(EvidenceKind),
Stop,
Fail,
Continue,
Exit,
Retry {
request: String,
count: u32,
},
RetryDelay(String),
Sleep(String),
}Expand description
One statement of a script.
The first group of variants is metadata — declarations that describe the
check rather than doing anything — and is recognized by
Stmt::is_metadata. The rest define probes, control flow, matching, and
the finding the check emits.
Variants§
Name(String)
name "…" — the finding’s title.
Description(String)
description "…" — what the check looks for.
Impact(String)
impact "…" — what an affected target is exposed to.
Severity(Severity)
severity … — the finding’s severity; defaults to info when absent.
Author(String)
author "…" — who wrote the check.
Cve(String)
cve "…" — a CVE id the check detects. May be repeated.
Cwe(String)
cwe "…" — a CWE id for the weakness class. May be repeated.
Reference(String)
reference "…" — a supporting URL. May be repeated.
Cvss(String)
cvss "…" — a CVSS vector string. May be repeated.
CvssScore(String)
cvss_score "…" — a numeric CVSS score. May be repeated.
Mitigation(String)
mitigation "…" — how to fix the issue.
Tag(String)
tag "…" — a search tag in the registry. May be repeated.
Version(String)
version "…" — the check’s own version.
Family(String)
family "…" — the family the check belongs to, as used by
ruso scan --family.
Set
set <name> = <value> — bind a variable.
ForIn
for <item> in <list> { … } — iterate, rebinding item each pass.
Fields
list: ListSourceWhat is iterated.
Http
http <name> { … } — define an HTTP probe.
Fields
Dns(SocketProbe)
dns <name> { … } — define a DNS probe.
Tcp(SocketProbe)
tcp <name> { … } — define a TCP probe.
Udp(SocketProbe)
udp <name> { … } — define a UDP probe.
Send
send <probe> — fire a defined probe, optionally overriding its body.
Fields
Break
break — leave the enclosing for.
Match(QualifiedMatch)
match … — evaluate one condition; a false result clears the run’s
match state so no finding is emitted, but execution continues.
MatchAll(Vec<QualifiedMatch>)
match_all [ … ] — true only if every condition holds.
MatchAny(Vec<QualifiedMatch>)
match_any [ … ] — true if any condition holds.
Assert(QualifiedMatch)
assert … — like match, but a false result aborts the script.
Extract
extract <name> from … — bind part of a response to a variable.
Fields
source: ExtractSourceWhere the value comes from: a body regex or a named header.
If
if <condition> { … } — run the body only when the condition holds.
Save
save <request> as <alias> — make a response reachable under a second
name, so a later matcher can refer to an earlier probe’s result.
Fields
Evidence(EvidenceKind)
evidence <probe>.body | .response | .header "…" — attach proof to the
finding, optionally narrowed by a regex.
Stop
stop — end the run without emitting a finding.
Fail
fail — end the run and mark it failed.
Continue
continue — skip to the next iteration of the enclosing for.
Exit
exit — end the run immediately.
Retry
retry <request> <count> — re-send a probe while it keeps failing.
RetryDelay(String)
retry_delay "<duration>" — wait between retry attempts.
Sleep(String)
sleep "<duration>" — pause the run.
Implementations§
Source§impl Stmt
impl Stmt
Sourcepub fn is_metadata(&self) -> bool
pub fn is_metadata(&self) -> bool
Whether this statement only describes the check (its name, severity, references, …) rather than doing anything at run time.
The compiler collects these into the program’s metadata instead of emitting instructions for them.
Sourcepub fn is_probe_definition(&self) -> bool
pub fn is_probe_definition(&self) -> bool
Whether this statement defines a probe (http, dns, tcp, udp).
Probe definitions go into the program’s probe table; they do not run
until a send names them.