-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclap_subcommand.rs
More file actions
88 lines (86 loc) · 3.3 KB
/
clap_subcommand.rs
File metadata and controls
88 lines (86 loc) · 3.3 KB
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
use clap::{Arg, Command, value_parser};
fn main() {
let matches = Command::new("myapp").about("PicoDuckey Payload Generator")
.subcommand(
Command::new("w7")
.about("Windows 7 Payload Generator")
.arg(
Arg::new("wordlist")
.short('w')
.long("wordlist")
.required(true)
.value_parser(value_parser!(String))
.help("Set Wordlist"),
)
.arg(
Arg::new("delay")
.short('d')
.long("delay")
.value_parser(value_parser!(String))
.help("Set Delay Time In Seconds")
.default_value("20"),),
)
.subcommand(
Command::new("w8")
.about("Windows 8 Payload Generator")
.arg(
Arg::new("wordlist")
.short('w')
.long("wordlist")
.required(true)
.value_parser(value_parser!(String))
.help("Set Wordlist"),
)
.arg(
Arg::new("delay")
.short('d')
.long("delay")
.value_parser(value_parser!(String))
.help("Set Delay Time In Seconds")
.default_value("20"),),
)
.subcommand(
Command::new("w10")
.about("Windows 10 Payload Generator")
.arg(
Arg::new("wordlist")
.short('w')
.long("wordlist")
.required(true)
.value_parser(value_parser!(String))
.help("Set Wordlist"),
)
.arg(
Arg::new("delay")
.short('d')
.long("delay")
.value_parser(value_parser!(String))
.help("Set Delay Time In Seconds")
.default_value("20"),),
)
.subcommand(
Command::new("w11")
.about("Windows 11 Payload Generator")
.arg(
Arg::new("wordlist")
.short('w')
.long("wordlist")
.required(true)
.value_parser(value_parser!(String))
.help("Set Wordlist"),
)
.arg(
Arg::new("delay")
.short('d')
.long("delay")
.value_parser(value_parser!(String))
.help("Set Delay Time In Seconds")
.default_value("20"),),
).get_matches();
if let Some(sub_matches) = matches.subcommand_matches("w7") {
let wordlist = sub_matches.get_one::<String>("wordlist").unwrap();
let delay = sub_matches.get_one::<String>("delay").unwrap();
println!("Delay: {}", delay);
let greeting = format!("wordlist: {}!", wordlist);
println!("{}", greeting);}
}