(Broken state) Added example TOML
- Add example TOML - Fix formatting for print_banner()
This commit is contained in:
parent
a37e9e1d69
commit
2bdeef98c1
|
@ -0,0 +1,7 @@
|
|||
hostname = "mein-iserv.de"
|
||||
session-cookie = "markus"
|
||||
|
||||
[target]
|
||||
ip = 10.0.0.0
|
||||
room = 23
|
||||
compilation = 2
|
18
src/main.rs
18
src/main.rs
|
@ -4,21 +4,21 @@ use clap::Parser;
|
|||
#[clap(author, version, about, long_about = None)]
|
||||
struct Args {
|
||||
#[clap(short, long)]
|
||||
hostname: String,
|
||||
hostname: Option<String>,
|
||||
//example: "IServSAT=mvuvFvCZSlpvuwhk0mmNwF1NKEQypM4d; IServSession=xEPqyJO1a5nsVd34HEpbPqQGMMQKapvw; nav-show-additional-modules=true; PHPSESSID=mchbrl11epjnnp851q0i4rt8rc"
|
||||
#[clap(short, long)]
|
||||
session_cookie: String,
|
||||
session_cookie: Option<String>,
|
||||
#[clap(long)]
|
||||
target_ip: String,
|
||||
target_ip: Option<String>,
|
||||
#[clap(long)]
|
||||
target_room: u16,
|
||||
target_room: Option<u16>,
|
||||
#[clap(long)]
|
||||
target_compilation: Option<u16>,
|
||||
}
|
||||
|
||||
macro_rules! print_banner {
|
||||
($f: expr, $($arg: expr),*) => {
|
||||
println!(concat!("-----------------------------------\n", $f, "\n-----------------------------------"), $($arg),*)
|
||||
println!(concat!("----------------------------------------\n", $f, "\n----------------------------------------"), $($arg),*)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ fn ipad(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
|
|||
let header = ("Cookie", &args.session_cookie);
|
||||
let client = reqwest::blocking::Client::new();
|
||||
let resp = client
|
||||
.get(format!("https://{}/iserv/admin/hosts", args.hostname))
|
||||
.get(format!("https://{}/iserv/admin/hosts", args.hostname.unwrap()))
|
||||
.header(header.0, header.1)
|
||||
.query(¶ms)
|
||||
.send()?;
|
||||
|
@ -55,9 +55,9 @@ fn ipad(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
|
|||
// skip rest of loop when no entry appeared
|
||||
if json_part == "null" {
|
||||
println!(
|
||||
"###################################
|
||||
"########################################
|
||||
No new host: skipping (Retry in 5s)
|
||||
###################################
|
||||
########################################
|
||||
");
|
||||
//sleep for 5 seconds
|
||||
std::thread::sleep(std::time::Duration::from_secs(5));
|
||||
|
@ -76,7 +76,7 @@ No new host: skipping (Retry in 5s)
|
|||
return Ok(())
|
||||
}
|
||||
let plain = &resp.text()?;
|
||||
let mut form_ip: &str = &args.target_ip; //default
|
||||
let mut form_ip: &str = &args.target_ip;
|
||||
let form_name = squeeze_html_form(plain, "name=\"host[name]\"", "value=\"", "\"");
|
||||
let form_tags = squeeze_html_form(plain, "name=\"host[tags][]\"", "value=\"", "\"");
|
||||
let form_mac = squeeze_html_form(plain, "name=\"host[mac]\"", "value=\"", "\"");
|
||||
|
|
Loading…
Reference in New Issue