mirror of
https://github.com/edu4rdshl/unimap.git
synced 2026-07-17 23:24:49 +00:00
Add support for raw and url output formats.
Signed-off-by: Edu4rdSHL <edu4rdshl@protonmail.com>
This commit is contained in:
parent
f20f6d6ce0
commit
8378a29d5d
4 changed files with 56 additions and 2 deletions
|
|
@ -60,6 +60,7 @@ pub fn get_args() -> Args {
|
||||||
fast_scan: matches.is_present("fast-scan"),
|
fast_scan: matches.is_present("fast-scan"),
|
||||||
no_keep_nmap_logs: matches.is_present("no-keep-nmap-logs"),
|
no_keep_nmap_logs: matches.is_present("no-keep-nmap-logs"),
|
||||||
raw_output: matches.is_present("raw-output"),
|
raw_output: matches.is_present("raw-output"),
|
||||||
|
url_output: matches.is_present("url-output"),
|
||||||
files: return_matches_vec(&matches, "files"),
|
files: return_matches_vec(&matches, "files"),
|
||||||
min_rate: value_t!(matches, "min-rate", String).unwrap_or_else(|_| String::new()),
|
min_rate: value_t!(matches, "min-rate", String).unwrap_or_else(|_| String::new()),
|
||||||
resolvers: if matches.is_present("custom-resolvers") {
|
resolvers: if matches.is_present("custom-resolvers") {
|
||||||
|
|
|
||||||
10
src/cli.yml
10
src/cli.yml
|
|
@ -90,3 +90,13 @@ args:
|
||||||
long: raw-output
|
long: raw-output
|
||||||
takes_value: false
|
takes_value: false
|
||||||
multiple: false
|
multiple: false
|
||||||
|
conflicts_with:
|
||||||
|
- url-output
|
||||||
|
|
||||||
|
- url-output:
|
||||||
|
help: Use HOST:IP output format.
|
||||||
|
long: url-output
|
||||||
|
takes_value: false
|
||||||
|
multiple: false
|
||||||
|
conflicts_with:
|
||||||
|
- raw-output
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,53 @@ pub fn parallel_resolver_all(args: &mut Args) -> Result<()> {
|
||||||
"OPEN PORTS",
|
"OPEN PORTS",
|
||||||
"SERVICES"
|
"SERVICES"
|
||||||
]);
|
]);
|
||||||
|
if args.raw_output && !args.quiet_flag {
|
||||||
|
println!("HOST,IP,PORT,SERVICE,VERSION,PRODUCT,OS,EXTRAINFO")
|
||||||
|
} else if args.url_output && !args.quiet_flag {
|
||||||
|
println!("HOST:IP")
|
||||||
|
}
|
||||||
for (target, resolv_data) in &data {
|
for (target, resolv_data) in &data {
|
||||||
if !resolv_data.ip.is_empty() {
|
if !resolv_data.ip.is_empty() {
|
||||||
if args.raw_output {
|
if args.raw_output {
|
||||||
for port_data in &resolv_data.ports_data {
|
for port_data in &resolv_data.ports_data {
|
||||||
println!("{},{},{}", target, resolv_data.ip, port_data.portid)
|
println!(
|
||||||
|
"{},{},{},{},{},{},{},{}",
|
||||||
|
target,
|
||||||
|
resolv_data.ip,
|
||||||
|
port_data.portid,
|
||||||
|
port_data.service.clone().unwrap_or_default().name,
|
||||||
|
port_data
|
||||||
|
.clone()
|
||||||
|
.service
|
||||||
|
.unwrap_or_default()
|
||||||
|
.version
|
||||||
|
.unwrap_or_else(|| "NULL".to_string()),
|
||||||
|
port_data
|
||||||
|
.clone()
|
||||||
|
.service
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_default()
|
||||||
|
.product
|
||||||
|
.unwrap_or_else(|| "NULL".to_string()),
|
||||||
|
port_data
|
||||||
|
.service
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_default()
|
||||||
|
.ostype
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_else(|| "NULL".to_string()),
|
||||||
|
port_data
|
||||||
|
.service
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_default()
|
||||||
|
.extrainfo
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_else(|| "NULL".to_string())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else if args.url_output {
|
||||||
|
for port_data in &resolv_data.ports_data {
|
||||||
|
println!("{}:{}", target, port_data.portid)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let mut services_table = Table::new();
|
let mut services_table = Table::new();
|
||||||
|
|
@ -127,7 +169,7 @@ pub fn parallel_resolver_all(args: &mut Args) -> Result<()> {
|
||||||
args.file_name
|
args.file_name
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if !args.quiet_flag && !args.raw_output {
|
if !args.quiet_flag && !args.raw_output && !args.url_output {
|
||||||
table.printstd();
|
table.printstd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ pub struct Args {
|
||||||
pub no_keep_nmap_logs: bool,
|
pub no_keep_nmap_logs: bool,
|
||||||
pub raw_output: bool,
|
pub raw_output: bool,
|
||||||
pub fast_scan: bool,
|
pub fast_scan: bool,
|
||||||
|
pub url_output: bool,
|
||||||
pub files: Vec<String>,
|
pub files: Vec<String>,
|
||||||
pub resolvers: Vec<String>,
|
pub resolvers: Vec<String>,
|
||||||
pub targets: HashSet<String>,
|
pub targets: HashSet<String>,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue