mirror of
https://github.com/edu4rdshl/unimap.git
synced 2026-07-17 23:24:49 +00:00
30 lines
723 B
Rust
30 lines
723 B
Rust
lazy_static! {
|
|
static ref SPECIAL_CHARS: Vec<char> = vec![
|
|
'[', ']', '{', '}', '(', ')', '*', '|', ':', '<', '>', '/', '\\', '%', '&', '¿', '?', '¡',
|
|
'!', '#', '\'', ' ', ','
|
|
];
|
|
}
|
|
|
|
pub fn validate_target(target: &str) -> bool {
|
|
!target.starts_with('.')
|
|
&& target.contains('.')
|
|
&& !target.contains(&SPECIAL_CHARS[..])
|
|
&& target.is_ascii()
|
|
}
|
|
|
|
pub fn null_ip_checker(ip: &str) -> String {
|
|
if ip.is_empty() {
|
|
String::from("NULL")
|
|
} else {
|
|
ip.to_string()
|
|
}
|
|
}
|
|
|
|
#[allow(clippy::ptr_arg)]
|
|
pub fn return_ports_string(ports: &Vec<String>) -> String {
|
|
if ports.is_empty() {
|
|
String::from("NULL")
|
|
} else {
|
|
ports.join(";")
|
|
}
|
|
}
|