@@ -63,105 +63,111 @@ pub enum ScriptType {
63
63
) ]
64
64
pub enum Opts {
65
65
#[ structopt( about = "Create a lua example code based on the type of scan" ) ]
66
- NEW {
67
- #[ structopt( short = "-s" , long, parse( try_from_str = get_script_type) ) ]
68
- scan_type : ScriptType ,
69
- #[ structopt( short = "f" , long) ]
70
- file_name : PathBuf ,
71
- } ,
66
+ NEW ( NewOpts ) ,
72
67
#[ structopt( about = "Use CVE, VULN scripts to scan the given URLs" ) ]
73
- URLS {
74
- // redirects limit
75
- #[ structopt(
76
- short,
77
- long,
78
- default_value = "10" ,
79
- help = "Number of allowed http redirects"
80
- ) ]
81
- redirects : u32 ,
82
- #[ structopt(
83
- long = "fuzz-workers" ,
84
- default_value = "15" ,
85
- help = "The number of workers who will be involved in the fuzzing process"
86
- ) ]
87
- fuzz_workers : usize ,
68
+ URLS ( UrlsOpts ) ,
69
+ }
70
+
71
+ #[ derive( Debug , StructOpt ) ]
72
+ pub struct NewOpts {
73
+ #[ structopt( short = "-s" , long, parse( try_from_str = get_script_type) ) ]
74
+ pub scan_type : ScriptType ,
75
+ #[ structopt( short = "f" , long) ]
76
+ pub file_name : PathBuf ,
77
+ }
78
+
79
+ #[ derive( Debug , StructOpt ) ]
80
+ pub struct UrlsOpts {
81
+ // redirects limit
82
+ #[ structopt(
83
+ short,
84
+ long,
85
+ default_value = "10" ,
86
+ help = "Number of allowed http redirects"
87
+ ) ]
88
+ pub redirects : u32 ,
89
+ #[ structopt(
90
+ long = "fuzz-workers" ,
91
+ default_value = "15" ,
92
+ help = "The number of workers who will be involved in the fuzzing process"
93
+ ) ]
94
+ pub fuzz_workers : usize ,
88
95
89
- // threads
90
- #[ structopt(
91
- short = "w" ,
92
- long = "workers" ,
93
- default_value = "10" ,
94
- help = "Number of workers"
95
- ) ]
96
- workers : usize ,
97
- #[ structopt(
98
- short = "v" ,
99
- long = "verbose" ,
100
- help = "verbose mode (show sending requests)"
101
- ) ]
102
- verbose : bool ,
96
+ // threads
97
+ #[ structopt(
98
+ short = "w" ,
99
+ long = "workers" ,
100
+ default_value = "10" ,
101
+ help = "Number of workers"
102
+ ) ]
103
+ pub workers : usize ,
104
+ #[ structopt(
105
+ short = "v" ,
106
+ long = "verbose" ,
107
+ help = "verbose mode (show sending requests)"
108
+ ) ]
109
+ pub verbose : bool ,
103
110
104
- #[ structopt(
105
- short = "sw" ,
106
- long = "scripts-worker" ,
107
- default_value = "10" ,
108
- help = "How many scripts to run at the same time for one url"
109
- ) ]
110
- scripts_workers : usize ,
111
+ #[ structopt(
112
+ short = "sw" ,
113
+ long = "scripts-worker" ,
114
+ default_value = "10" ,
115
+ help = "How many scripts to run at the same time for one url"
116
+ ) ]
117
+ pub scripts_workers : usize ,
111
118
112
- // timeout
113
- #[ structopt(
114
- short = "t" ,
115
- long = "timeout" ,
116
- default_value = "10" ,
117
- help = "Connection timeout"
118
- ) ]
119
- timeout : u64 ,
119
+ // timeout
120
+ #[ structopt(
121
+ short = "t" ,
122
+ long = "timeout" ,
123
+ default_value = "10" ,
124
+ help = "Connection timeout"
125
+ ) ]
126
+ pub timeout : u64 ,
120
127
121
- /// Input file
122
- #[ structopt( parse( from_os_str) , help = "Scripts path" ) ]
123
- script_path : PathBuf ,
128
+ /// Input file
129
+ #[ structopt( parse( from_os_str) , help = "Scripts path" ) ]
130
+ pub script_path : PathBuf ,
124
131
125
- /// Output file, stdout if not present
126
- #[ structopt(
127
- short = "o" ,
128
- long = "output" ,
129
- parse( from_os_str) ,
130
- help = "output json file"
131
- ) ]
132
- output : Option < PathBuf > ,
132
+ /// Output file, stdout if not present
133
+ #[ structopt(
134
+ short = "o" ,
135
+ long = "output" ,
136
+ parse( from_os_str) ,
137
+ help = "output json file"
138
+ ) ]
139
+ pub output : Option < PathBuf > ,
133
140
134
- #[ structopt(
135
- short = "p" ,
136
- long = "proxy" ,
137
- help = "Set http proxy for all connections"
138
- ) ]
139
- proxy : Option < String > ,
140
- #[ structopt(
141
- long = "requests-limit" ,
142
- help = "requests limit" ,
143
- default_value = "2000"
144
- ) ]
145
- requests_limit : i32 ,
146
- #[ structopt( long = "delay" , help = "sleeping dalay" , default_value = "5" ) ]
147
- delay : u64 ,
141
+ #[ structopt(
142
+ short = "p" ,
143
+ long = "proxy" ,
144
+ help = "Set http proxy for all connections"
145
+ ) ]
146
+ pub proxy : Option < String > ,
147
+ #[ structopt(
148
+ long = "requests-limit" ,
149
+ help = "requests limit" ,
150
+ default_value = "2000"
151
+ ) ]
152
+ pub requests_limit : i32 ,
153
+ #[ structopt( long = "delay" , help = "sleeping dalay" , default_value = "5" ) ]
154
+ pub delay : u64 ,
148
155
149
- #[ structopt( long = "log" , help = "Saving Lotus Logs for debugging" ) ]
150
- log : Option < PathBuf > ,
151
- #[ structopt(
152
- long = "urls" ,
153
- help = "Reading urls from text file" ,
154
- parse( from_os_str)
155
- ) ]
156
- urls : Option < PathBuf > ,
156
+ #[ structopt( long = "log" , help = "Saving Lotus Logs for debugging" ) ]
157
+ pub log : Option < PathBuf > ,
158
+ #[ structopt(
159
+ long = "urls" ,
160
+ help = "Reading urls from text file" ,
161
+ parse( from_os_str)
162
+ ) ]
163
+ pub urls : Option < PathBuf > ,
157
164
158
- #[ structopt( long = "headers" , parse( try_from_str = parse_headers) , required = false , default_value = "{}" , help = "Default Headers (eg: '{\" X-API\" :\" 123\" }')" ) ]
159
- headers : HeaderMap ,
160
- #[ structopt(
161
- long = "exit-after-errors" ,
162
- default_value = "2000" ,
163
- help = "Exit after X number of script errors"
164
- ) ]
165
- exit_after : i32 ,
166
- } ,
165
+ #[ structopt( long = "headers" , parse( try_from_str = parse_headers) , required = false , default_value = "{}" , help = "Default Headers (eg: '{\" X-API\" :\" 123\" }')" ) ]
166
+ pub headers : HeaderMap ,
167
+ #[ structopt(
168
+ long = "exit-after-errors" ,
169
+ default_value = "2000" ,
170
+ help = "Exit after X number of script errors"
171
+ ) ]
172
+ pub exit_after : i32 ,
167
173
}
0 commit comments