1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
use std::time::Duration;
use anyhow::Context;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(
name = "auger",
version,
about = "Load test, discover and inspect HTTP endpoints"
)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
/// Emit machine-readable JSON to stdout instead of the table
#[arg(global = true, long, id = "json_out")]
pub json: bool,
}
#[derive(Subcommand)]
pub enum Commands {
/// Run a load test against a URL
Run(RunArgs),
/// Probe a wordlist against a base URL to discover endpoints
Scan(ScanArgs),
/// Inspect a URL: status, HTTP version and security headers
Check(CheckArgs),
/// Show the TLS certificate for a host
Cert(CertArgs),
/// Print a saved report
Report {
json: String,
/// Also write latencies as CSV
#[arg(long)]
csv: Option<String>,
/// Print the report as a markdown table
#[arg(long)]
markdown: bool,
},
/// Export a saved report to a self-contained HTML file
Html {
json: String,
#[arg(short, long, default_value = "report.html")]
out: String,
},
/// Compare two saved reports
Compare { before: String, after: String },
}
#[derive(clap::Args)]
pub struct HttpOptions {
#[arg(short = 'k', long)]
pub insecure: bool,
/// HTTP proxy, e.g. http://127.0.0.1:8080
#[arg(short, long)]
pub proxy: Option<String>,
#[arg(short, long, default_value_t = 30)]
pub timeout: u64,
#[arg(short = 'A', long)]
pub user_agent: Option<String>,
/// Request header, repeatable: -H "X-Token: abc"
#[arg(short = 'H', long = "header")]
pub headers: Vec<String>,
/// Use HTTP/2 only
#[arg(long)]
pub http2: bool,
/// Disable connection keep-alive
#[arg(long)]
pub no_keepalive: bool,
}
#[derive(clap::Args)]
pub struct RunArgs {
pub url: String,
#[arg(short, long, default_value_t = 20)]
pub concurrency: u32,
/// How long to run, e.g. 5s, 30s, 2m
#[arg(short, long, default_value = "5s")]
pub duration: String,
#[arg(short, long, default_value = "GET")]
pub method: String,
/// Save the raw result to a JSON file, usable as a baseline
#[arg(short, long)]
pub save: Option<String>,
/// Compare against a saved baseline and flag regressions
#[arg(long)]
pub compare: Option<String>,
/// Flag a regression when a percentile is slower by more than this factor
#[arg(long, default_value_t = 1.1)]
pub threshold: f64,
/// Rotate between common user agents per worker
#[arg(long)]
pub random_ua: bool,
/// Basic auth in the form user:pass
#[arg(long)]
pub basic: Option<String>,
/// Send an Authorization: Bearer token
#[arg(long)]
pub token: Option<String>,
/// Run a fixed number of requests instead of by time
#[arg(short = 'n', long)]
pub requests: Option<u64>,
/// Ramp up concurrency over this duration, e.g. 30s
#[arg(long)]
pub ramp: Option<String>,
/// Cap total requests per second
#[arg(long)]
pub rps: Option<u64>,
/// Read the request body from a file
#[arg(long)]
pub body_file: Option<String>,
/// Send this string as the request body (for POST/PUT)
#[arg(long)]
pub body: Option<String>,
/// Suppress the per-second progress line
#[arg(long)]
pub quiet: bool,
#[command(flatten)]
pub http: HttpOptions,
}
#[derive(clap::Args)]
pub struct ScanArgs {
/// Base URL to probe, e.g. https://target.com/
pub url: String,
#[arg(short, long)]
pub wordlist: String,
/// Append these extensions when the word has none, e.g. php,html
#[arg(short, long)]
pub extensions: Option<String>,
#[arg(short, long, default_value_t = 20)]
pub concurrency: u32,
#[arg(short, long)]
pub output: Option<String>,
/// Show the <title> of 2xx pages
#[arg(long)]
pub title: bool,
/// Only show these status codes, comma separated
#[arg(long)]
pub match_status: Option<String>,
/// Delay in ms between requests per worker
#[arg(long, default_value_t = 0)]
pub delay: u64,
/// Also probe paths found in robots.txt and sitemap.xml
#[arg(short = 'R', long)]
pub robots: bool,
#[command(flatten)]
pub http: HttpOptions,
}
#[derive(clap::Args)]
pub struct CertArgs {
/// Host or URL, e.g. example.com:8443
pub target: String,
}
#[derive(clap::Args)]
pub struct CheckArgs {
pub url: String,
/// Read URLs from a file, one per line
#[arg(short = 'f', long)]
pub file: Option<String>,
#[command(flatten)]
pub http: HttpOptions,
}
pub fn parse_duration(raw: &str) -> anyhow::Result<Duration> {
let raw = raw.trim();
let (num, unit) = raw.split_at(raw.len().saturating_sub(1));
let n: u64 = num
.trim()
.parse()
.with_context(|| format!("bad duration '{}'", raw))?;
let secs = match unit {
"s" => n,
"m" => n * 60,
"h" => n * 3600,
_ => anyhow::bail!("unknown duration unit in '{}', use 5s, 2m or 1h", raw),
};
Ok(Duration::from_secs(secs))
}