Files
tetanus/default-modules/print_host_discovery/script.rhai
T

29 lines
858 B
Plaintext

let ips = [];
let scope_path = find_scope_file(project.notes);
let scope_text = open_file(scope_path);
for line in scope_text.split("\n"){
if line.contains("|") && !line.contains("//"){
let cols = line.split("|");
let data = cols[1];
if data.len() > 0{
for host in expand_target(data){
ips.push(host);
}
}
}
}
let output = project.files.display + "/host_discovery_targets.txt";
let ip_string = "";
for ip in ips{
ip_string = ip + "\n" + ip_string;
}
if write_file(output, ip_string){
let out_string = "Upload " + output + " to the target host then run the following command:\nfor /f %i in (host_discovery_targets.txt) do @ping -n 1 -w 1000 %i | find \"TTL=\" > nul && echo %i>>alive.txt";
return out_string;
}
else{
return "Error writing host_target file!";
}