added logic to save and come back to a password
spray.
This commit is contained in:
@@ -362,7 +362,7 @@ pub fn password_spray_help(project: &Project, season: String, lseason: String, y
|
||||
password_spray_file.push("password_spray.md");
|
||||
println!("{}", password_spray_file.display());
|
||||
let mut password_spray_string = String::new();
|
||||
let password_spray_read_result = fs::read_to_string(password_spray_file);
|
||||
let password_spray_read_result = fs::read_to_string(&password_spray_file);
|
||||
if password_spray_read_result.is_err(){
|
||||
println!("error reading password spray file!!!");
|
||||
return;
|
||||
@@ -405,6 +405,7 @@ pub fn password_spray_help(project: &Project, season: String, lseason: String, y
|
||||
"2\n" => outline = msolspray_config(tools_dir),
|
||||
_ => println!("unkown tool to use, try again...")
|
||||
}
|
||||
let mut sprayed_passwords = Vec::new();
|
||||
for password in &passwords{
|
||||
let mut _spraycontinue = String::new();
|
||||
let mut printline = outline.replace("||PASSWORD||", password);
|
||||
@@ -412,8 +413,37 @@ pub fn password_spray_help(project: &Project, season: String, lseason: String, y
|
||||
printline = printline.replace("-p useraspass", "--UserAsPass")
|
||||
}
|
||||
println!("\n{}\n", printline);
|
||||
println!("press enter to start timer");
|
||||
println!("enter s to save an return to main menu, or just enter to start timer");
|
||||
stdin().read_line(&mut _spraycontinue).unwrap();
|
||||
sprayed_passwords.push(password.to_owned());
|
||||
if _spraycontinue.contains("s"){
|
||||
let new_spray_file = fs::OpenOptions::new().write(true).truncate(true).open(&password_spray_file);
|
||||
if new_spray_file.is_err(){
|
||||
println!("error saving progress, please make note of where you are and update the file accordingly");
|
||||
}
|
||||
else{
|
||||
let mut open_spray_file = new_spray_file.unwrap();
|
||||
let mut new_file_text = String::new();
|
||||
for sprayed_pass in &sprayed_passwords{
|
||||
new_file_text = format!("{}\n- [x] {}", new_file_text, sprayed_pass);
|
||||
}
|
||||
for password in &passwords{
|
||||
if sprayed_passwords.contains(password) == false{
|
||||
new_file_text = format!("{}\n- [ ] {}", new_file_text, password);
|
||||
}
|
||||
}
|
||||
let save_result = open_spray_file.write_all(new_file_text.as_bytes());
|
||||
if save_result.is_err(){
|
||||
println!("saving failed!\nplease copy the below lines into your password spray notes!");
|
||||
println!("{}", new_file_text);
|
||||
}
|
||||
else{
|
||||
println!("password saved complete!!!");
|
||||
println!("returning to main menu...");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("waiting for {} minutes...", wait_dur.as_secs());
|
||||
thread::sleep(wait_dur * 60);
|
||||
let (_stream, stream_handle) = OutputStream::try_default().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user