MCPcopy Create free account
hub / github.com/Nariod/RustPacker / args_checker

Function args_checker

src/arg_parser.rs:170–254  ·  view source on GitHub ↗
(args: ArgMatches)

Source from the content-addressed store, hash-verified

168}
169
170fn args_checker(args: ArgMatches) -> Order {
171 let sp: String = args
172 .get_one::<String>("Path to shellcode file")
173 .unwrap()
174 .clone();
175 let shellcode_path = absolute_path(PathBuf::from(sp)).expect("Invalid shellcode path");
176
177 let encryption: Encryption = match args
178 .get_one::<String>("Encryption / encoding method")
179 .unwrap()
180 .as_str()
181 {
182 "xor" => Encryption::Xor,
183 "aes" => Encryption::Aes,
184 "uuid" => Encryption::Uuid,
185 _ => unreachable!("clap validates encryption values"),
186 };
187
188 let sandbox: Option<String> = args
189 .get_one::<String>("Sandbox Check")
190 .map(|s| s.to_string());
191
192 let execution: Execution = match args
193 .get_one::<String>("Execution technique")
194 .unwrap()
195 .as_str()
196 {
197 "ntapc" => Execution::NtQueueUserAPC,
198 "ntcrt" => Execution::NtCreateRemoteThread,
199 "syscrt" => Execution::SysCreateRemoteThread,
200 "wincrt" => Execution::WinCreateRemoteThread,
201 "winfiber" => Execution::WinFiber,
202 "ntfiber" => Execution::NtFiber,
203 "sysfiber" => Execution::SysFiber,
204 "earlycascade" => Execution::EarlyCascade,
205 _ => unreachable!("clap validates execution values"),
206 };
207
208 let format: Format = match args
209 .get_one::<String>("Binary output format")
210 .unwrap()
211 .as_str()
212 {
213 "exe" => Format::Exe,
214 "dll" => Format::Dll,
215 _ => unreachable!("clap validates format values"),
216 };
217
218 let target_process = args
219 .get_one::<String>("Target process")
220 .map(|s| s.to_string())
221 .unwrap_or_else(|| "dllhost.exe".to_string());
222
223 let output = args.get_one::<String>("Output path").map(|path| {
224 absolute_path(PathBuf::from(path)).expect("Invalid output path")
225 });
226
227 let proxy_dll = args.get_one::<String>("DLL Proxy").map(|path| {

Callers 1

parse_argsFunction · 0.85

Calls 2

absolute_pathFunction · 0.85
is_self_injectionMethod · 0.80

Tested by

no test coverage detected