Skip to content

Commit 4061b8b

Browse files
authored
Merge pull request #28 from FuzzingLabs/feat/detectors-help
Add a flag to list all available detectors
2 parents d951037 + 85853f8 commit 4061b8b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ cargo run -- -f ./examples/sierra/fib_unary.sierra --callgraph --function 'examp
9898

9999
```
100100
cargo run -- -f ./examples/sierra/fib_array.sierra -d
101+
102+
// Print all available detectors with their description
103+
cargo run -- --detector-help
101104
```
102105

103106
<p align="center">

bin/sierra-decompiler/src/main.rs

+24
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,22 @@ struct Args {
7272
/// Run sierra-analyzer in a repo that uses Scarb
7373
#[clap(long)]
7474
scarb: bool,
75+
76+
/// List all available detector names
77+
#[clap(long)]
78+
detector_help: bool,
7579
}
7680

7781
#[tokio::main]
7882
async fn main() {
7983
let args = Args::parse();
8084

85+
// Handle the --detector-help flag
86+
if args.detector_help {
87+
print_available_detectors();
88+
return;
89+
}
90+
8191
// Ensure either remote, Sierra file, or scarb is provided
8292
if args.remote.is_empty() && args.sierra_file.is_none() && !args.scarb {
8393
eprintln!("Error: Either remote, Sierra file, or --scarb flag must be provided");
@@ -377,3 +387,17 @@ fn handle_detectors(decompiler: &mut Decompiler, detector_names: Vec<String>) {
377387
println!("{}", output.trim());
378388
}
379389
}
390+
391+
/// Print all available detector names with their types and descriptions
392+
fn print_available_detectors() {
393+
let detectors = get_detectors();
394+
println!("Available detectors:");
395+
for detector in detectors {
396+
println!(
397+
"- [{}] {} : {}",
398+
detector.detector_type().as_str(),
399+
detector.id(),
400+
detector.description()
401+
);
402+
}
403+
}

0 commit comments

Comments
 (0)