Update main.rs

updated to fix the install, and to add a few more notes that I use in internal projects
This commit is contained in:
Pyro57000
2023-11-30 10:27:19 -06:00
committed by GitHub
parent 136793698a
commit ad3f854011

View File

@@ -4,13 +4,25 @@ Purpose: To automate setting up my notes at the start of a pentest project
Install Instructions: Change the "Pentest_notes" variable below to the directory you keep your pentest notes in. Then run cargo build to compile and copy the binary at ./target/debug/start_pentest to something like /usr/bin Install Instructions: Change the "Pentest_notes" variable below to the directory you keep your pentest notes in. Then run cargo build to compile and copy the binary at ./target/debug/start_pentest to something like /usr/bin
some special instructions for the file formats some special instructions for the file formats
the scope.txt file should be in the following format the scope.txt file should be in the following formats
EXTERNAL:
host 3rd_party approval host 3rd_party approval
example:
INTERNAL:
network environment inscope?
examples:
External:
192.168.1.1 no yes 192.168.1.1 no yes
192.168.1.2 yes no 192.168.1.2 yes no
etc etc. etc etc.
Internal:
192.168.1.0/24 servers yes
192.168.2.0/24 workstations yes
192.168.3.0/24 ICS no
*/ */
use std::fs; use std::fs;
use std::env; use std::env;
@@ -153,6 +165,7 @@ fn internal(project_folder_path: String, comapny_name: &String, project_name: &S
let mut creds_notes = fs::File::create(format!("{}/creds.md", &loot_folder)).expect("error creating creds note"); let mut creds_notes = fs::File::create(format!("{}/creds.md", &loot_folder)).expect("error creating creds note");
let mut todo_notes = fs::File::create(format!("{}/todo.md", &project_folder_path)).expect("error creating todo notes"); let mut todo_notes = fs::File::create(format!("{}/todo.md", &project_folder_path)).expect("error creating todo notes");
let mut cleanup_notes = fs::File::create(format!("{}/cleanup.md", &project_folder_path)).expect("error creating cleanup notes"); let mut cleanup_notes = fs::File::create(format!("{}/cleanup.md", &project_folder_path)).expect("error creating cleanup notes");
let mut password_spray = fs::File::create(format!("{}/password_spray.md", &project_folder_path)).expect("error creating password spray notes");
// for tagging notes // for tagging notes
let oyear = project_name.split("_").collect::<Vec<&str>>()[0]; let oyear = project_name.split("_").collect::<Vec<&str>>()[0];
let year = format!("year-{}", oyear); let year = format!("year-{}", oyear);
@@ -164,6 +177,7 @@ fn internal(project_folder_path: String, comapny_name: &String, project_name: &S
writeln!(&mut todo_notes, "#{} #{} #{} #todo", comapny_name, project_type, year).expect("error writing tag line on todo"); writeln!(&mut todo_notes, "#{} #{} #{} #todo", comapny_name, project_type, year).expect("error writing tag line on todo");
writeln!(&mut finding_notes, "#{} #{} #{} #findings", comapny_name, project_type, year).expect("error writing tags line on findings"); writeln!(&mut finding_notes, "#{} #{} #{} #findings", comapny_name, project_type, year).expect("error writing tags line on findings");
writeln!(&mut systeminfo, "#{} #{} #{} #general", comapny_name, project_type, year).expect("error writing tag line for system info"); writeln!(&mut systeminfo, "#{} #{} #{} #general", comapny_name, project_type, year).expect("error writing tag line for system info");
writeln!(&mut systeminfo, "#{} #{} #{} #Password_sprays", comapny_name, project_type, year).expect("error writing tag line for password spraying");
writeln!(&mut netsta, "#{} #{} #{} #general", comapny_name, project_type, year).expect("error writing tagline in the netstat file"); writeln!(&mut netsta, "#{} #{} #{} #general", comapny_name, project_type, year).expect("error writing tagline in the netstat file");
writeln!(&mut creds_notes, "| System | username | password |").expect("error writing creds notes"); writeln!(&mut creds_notes, "| System | username | password |").expect("error writing creds notes");
writeln!(&mut creds_notes, "| ------ | -------- | -------- |").expect("error writing creds notes"); writeln!(&mut creds_notes, "| ------ | -------- | -------- |").expect("error writing creds notes");
@@ -270,12 +284,16 @@ powerup.ps1/sharpup.exe notes.
").expect("error writing to findings notes on internal"); ").expect("error writing to findings notes on internal");
write!(&mut todo_notes, " write!(&mut todo_notes, "
- [ ] local checks - [ ] local checks
- [ ] find shares - [ ] find shares
- [ ] snaffle - [ ] snaffle
- [ ] bloodhound - [ ] bloodhound
- [ ] admin or RDP? - [ ] admin or RDP?
- [ ] certify - [ ] certify
- [ ] portscan
- [ ] sql stuff
- [ ] passwords in AD Descriptions?
- [ ] password spray - [ ] password spray
").expect("error writing todo list"); ").expect("error writing todo list");
write!(&mut netsta," write!(&mut netsta,"
@@ -286,6 +304,29 @@ write!(&mut systeminfo,"
``` ```
```").expect("error writing code block to system info"); ```").expect("error writing code block to system info");
write!(&mut password_spray, "
- [ ] useraspass
- [ ] Seasonyear!
- [ ] Seasonyear
- [ ] seasonyear!
- [ ] seasonyear
- [ ] {comapny_name}year!
- [ ] {company_name}year
- [ ] {comapny_name}foundingyear!
- [ ] {company_name}foundingyear
- [ ] {company_name}streetnumber!
- [ ] {company_name}streetnumber
- [ ] Password
- [ ] P@ssw0rd
- [ ] Password1!
- [ ] Passwordyear!
- [ ] P@55w0rd
- [ ] P@$$w0rd
- [ ] Service
- [ ] Service!
- [ ] Serviceyear!
", company_name=comapny_name).expect("error writing password spray check list");
} }
fn main() { fn main() {
@@ -322,16 +363,17 @@ start_pentest ./scope.txt victim_company_incorporated 2022_external_pentest
if config_string.contains("folder_path") && config_string.contains("notes_path"){ if config_string.contains("folder_path") && config_string.contains("notes_path"){
let config_string_vec: Vec<&str> = config_string.split("\n").collect(); let config_string_vec: Vec<&str> = config_string.split("\n").collect();
for line in config_string_vec{ for line in config_string_vec{
if line.contains("folder"){ if line.contains("project_folder_path"){
let line_vec: Vec<&str> = line.split(":").collect(); let line_vec: Vec<&str> = line.split(":").collect();
project_files = line_vec[1].to_owned(); project_files = line_vec[1].to_owned();
} }
else if line.contains("notes"){ else if line.contains("project_notes_path"){
let line_vec: Vec<&str> = line.split(":").collect(); let line_vec: Vec<&str> = line.split(":").collect();
pentest_notes = line_vec[1].to_owned(); pentest_notes = line_vec[1].to_owned();
} }
} }
} }
println!("Project files path: {}\nProject Notes path: {}", project_files, pentest_notes);
if args.len() == 4{ if args.len() == 4{
// the following two lines make the scope a vector // the following two lines make the scope a vector
let scope_content = fs::read_to_string(&args[1]).expect("Error reading scope file"); let scope_content = fs::read_to_string(&args[1]).expect("Error reading scope file");