mirror of
https://github.com/ivre/masscanned.git
synced 2025-10-02 14:48:22 +00:00
Rename options for IP (self and remote) for more clarity
This commit is contained in:
parent
e541d1f5ee
commit
bad2c5e02c
15 changed files with 116 additions and 113 deletions
|
@ -38,7 +38,7 @@ pub fn repl<'a, 'b>(
|
||||||
masscanned.log.arp_recv(arp_req);
|
masscanned.log.arp_recv(arp_req);
|
||||||
let ip = IpAddr::V4(arp_req.get_target_proto_addr());
|
let ip = IpAddr::V4(arp_req.get_target_proto_addr());
|
||||||
/* Ignore ARP requests for IP addresses not handled by masscanned */
|
/* Ignore ARP requests for IP addresses not handled by masscanned */
|
||||||
if let Some(ip_addr_list) = masscanned.ip_addresses {
|
if let Some(ip_addr_list) = masscanned.self_ip_list {
|
||||||
if !ip_addr_list.contains(&ip) {
|
if !ip_addr_list.contains(&ip) {
|
||||||
masscanned.log.arp_drop(arp_req);
|
masscanned.log.arp_drop(arp_req);
|
||||||
return None;
|
return None;
|
||||||
|
@ -83,8 +83,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let mut arp_req =
|
let mut arp_req =
|
||||||
|
|
|
@ -113,7 +113,7 @@ pub fn reply<'a, 'b>(
|
||||||
* is authorized to answer to (avoid answering to packets addressed to
|
* is authorized to answer to (avoid answering to packets addressed to
|
||||||
* other machines)
|
* other machines)
|
||||||
**/
|
**/
|
||||||
if !get_authorized_eth_addr(&masscanned.mac, masscanned.ip_addresses)
|
if !get_authorized_eth_addr(&masscanned.mac, masscanned.self_ip_list)
|
||||||
.contains(ð_req.get_destination())
|
.contains(ð_req.get_destination())
|
||||||
{
|
{
|
||||||
masscanned.log.eth_drop(eth_req, &client_info);
|
masscanned.log.eth_drop(eth_req, &client_info);
|
||||||
|
@ -225,8 +225,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: mac,
|
mac: mac,
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
for proto in [EtherTypes::Ipv4, EtherTypes::Ipv6, EtherTypes::Arp] {
|
for proto in [EtherTypes::Ipv4, EtherTypes::Ipv6, EtherTypes::Arp] {
|
||||||
|
@ -264,8 +264,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let mut eth_req = MutableEthernetPacket::owned(vec![
|
let mut eth_req = MutableEthernetPacket::owned(vec![
|
||||||
|
|
|
@ -47,18 +47,18 @@ pub fn repl<'a, 'b>(
|
||||||
* check that the dest. IP address of the packet is one of
|
* check that the dest. IP address of the packet is one of
|
||||||
* those handled by masscanned - otherwise, drop the packet.
|
* those handled by masscanned - otherwise, drop the packet.
|
||||||
**/
|
**/
|
||||||
if let Some(ip_addr_list) = masscanned.ip_addresses {
|
if let Some(ip_addr_list) = masscanned.self_ip_list {
|
||||||
if !ip_addr_list.contains(&IpAddr::V4(ip_req.get_destination())) {
|
if !ip_addr_list.contains(&IpAddr::V4(ip_req.get_destination())) {
|
||||||
masscanned.log.ipv4_drop(&ip_req, &client_info);
|
masscanned.log.ipv4_drop(&ip_req, &client_info);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If masscanned is configured with ignored IP addresses, then
|
/* If masscanned is configured with a remote ip deny list, then
|
||||||
* check if the src. IP address of the packet is one of
|
* check if the src. IP address of the packet is one of
|
||||||
* those ignored by masscanned - if so, drop the packet.
|
* those ignored by masscanned - if so, drop the packet.
|
||||||
**/
|
**/
|
||||||
if let Some(ignored_ip_addr_list) = masscanned.ignored_ip_addresses {
|
if let Some(remote_ip_deny_list) = masscanned.remote_ip_deny_list {
|
||||||
if ignored_ip_addr_list.contains(&IpAddr::V4(ip_req.get_source())) {
|
if remote_ip_deny_list.contains(&IpAddr::V4(ip_req.get_source())) {
|
||||||
masscanned.log.ipv4_drop(&ip_req, &client_info);
|
masscanned.log.ipv4_drop(&ip_req, &client_info);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -202,8 +202,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
for proto in [
|
for proto in [
|
||||||
|
@ -253,8 +253,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: Some(&blacklist_ips),
|
remote_ip_deny_list: Some(&blacklist_ips),
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let mut ip_req =
|
let mut ip_req =
|
||||||
|
|
|
@ -45,7 +45,7 @@ pub fn repl<'a, 'b>(
|
||||||
* check that the dest. IP address of the packet is one of
|
* check that the dest. IP address of the packet is one of
|
||||||
* those handled by masscanned - otherwise, drop the packet.
|
* those handled by masscanned - otherwise, drop the packet.
|
||||||
**/
|
**/
|
||||||
if let Some(ip_addr_list) = masscanned.ip_addresses {
|
if let Some(ip_addr_list) = masscanned.self_ip_list {
|
||||||
if !ip_addr_list.contains(&IpAddr::V6(dst))
|
if !ip_addr_list.contains(&IpAddr::V6(dst))
|
||||||
&& ip_req.get_next_header() != IpNextHeaderProtocols::Icmpv6
|
&& ip_req.get_next_header() != IpNextHeaderProtocols::Icmpv6
|
||||||
{
|
{
|
||||||
|
@ -53,12 +53,12 @@ pub fn repl<'a, 'b>(
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If masscanned is configured with ignored IP addresses, then
|
/* If masscanned is configured with a remote ip deny list, then
|
||||||
* check if the src. IP address of the packet is one of
|
* check if the src. IP address of the packet is one of
|
||||||
* those ignored by masscanned - if so, drop the packet.
|
* those ignored by masscanned - if so, drop the packet.
|
||||||
**/
|
**/
|
||||||
if let Some(ignored_ip_addr_list) = masscanned.ignored_ip_addresses {
|
if let Some(remote_ip_deny_list) = masscanned.remote_ip_deny_list {
|
||||||
if ignored_ip_addr_list.contains(&IpAddr::V6(src)) {
|
if remote_ip_deny_list.contains(&IpAddr::V6(src)) {
|
||||||
masscanned.log.ipv6_drop(ip_req, client_info);
|
masscanned.log.ipv6_drop(ip_req, client_info);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -215,8 +215,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
for proto in [
|
for proto in [
|
||||||
|
@ -270,8 +270,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: Some(&blacklist_ips),
|
remote_ip_deny_list: Some(&blacklist_ips),
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let mut ip_req =
|
let mut ip_req =
|
||||||
|
|
|
@ -80,8 +80,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let mut icmp_req =
|
let mut icmp_req =
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub fn nd_ns_repl<'a, 'b>(
|
||||||
* check that the dest. IP address of the packet is one of
|
* check that the dest. IP address of the packet is one of
|
||||||
* those handled by masscanned - otherwise, drop the packet.
|
* those handled by masscanned - otherwise, drop the packet.
|
||||||
**/
|
**/
|
||||||
if let Some(addresses) = masscanned.ip_addresses {
|
if let Some(addresses) = masscanned.self_ip_list {
|
||||||
if !addresses.contains(&IpAddr::V6(nd_ns_req.get_target_addr())) {
|
if !addresses.contains(&IpAddr::V6(nd_ns_req.get_target_addr())) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -172,8 +172,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
/* Legitimate solicitation */
|
/* Legitimate solicitation */
|
||||||
|
@ -246,8 +246,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let mut icmpv6_echo_req = MutableIcmpv6Packet::owned(vec![
|
let mut icmpv6_echo_req = MutableIcmpv6Packet::owned(vec![
|
||||||
|
|
|
@ -145,8 +145,8 @@ mod tests {
|
||||||
fn test_tcp_fin_ack() {
|
fn test_tcp_fin_ack() {
|
||||||
let masscanned = Masscanned {
|
let masscanned = Masscanned {
|
||||||
mac: MacAddr(0, 0, 0, 0, 0, 0),
|
mac: MacAddr(0, 0, 0, 0, 0, 0),
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
synack_key: [0x06a0a1d63f305e9b, 0xd4d4bcbb7304875f],
|
synack_key: [0x06a0a1d63f305e9b, 0xd4d4bcbb7304875f],
|
||||||
iface: None,
|
iface: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
|
@ -197,8 +197,8 @@ mod tests {
|
||||||
fn test_tcp_fin_ack_wrap() {
|
fn test_tcp_fin_ack_wrap() {
|
||||||
let masscanned = Masscanned {
|
let masscanned = Masscanned {
|
||||||
mac: MacAddr(0, 0, 0, 0, 0, 0),
|
mac: MacAddr(0, 0, 0, 0, 0, 0),
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
synack_key: [0x06a0a1d63f305e9b, 0xd4d4bcbb7304875f],
|
synack_key: [0x06a0a1d63f305e9b, 0xd4d4bcbb7304875f],
|
||||||
iface: None,
|
iface: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
|
@ -249,8 +249,8 @@ mod tests {
|
||||||
fn test_synack_cookie_ipv4() {
|
fn test_synack_cookie_ipv4() {
|
||||||
let masscanned = Masscanned {
|
let masscanned = Masscanned {
|
||||||
mac: MacAddr(0, 0, 0, 0, 0, 0),
|
mac: MacAddr(0, 0, 0, 0, 0, 0),
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
synack_key: [0x06a0a1d63f305e9b, 0xd4d4bcbb7304875f],
|
synack_key: [0x06a0a1d63f305e9b, 0xd4d4bcbb7304875f],
|
||||||
iface: None,
|
iface: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
|
@ -300,8 +300,8 @@ mod tests {
|
||||||
fn test_synack_cookie_ipv6() {
|
fn test_synack_cookie_ipv6() {
|
||||||
let masscanned = Masscanned {
|
let masscanned = Masscanned {
|
||||||
mac: MacAddr(0, 0, 0, 0, 0, 0),
|
mac: MacAddr(0, 0, 0, 0, 0, 0),
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
synack_key: [0x06a0a1d63f305e9b, 0xd4d4bcbb7304875f],
|
synack_key: [0x06a0a1d63f305e9b, 0xd4d4bcbb7304875f],
|
||||||
iface: None,
|
iface: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
|
|
|
@ -56,8 +56,8 @@ pub struct Masscanned<'a> {
|
||||||
pub mac: MacAddr,
|
pub mac: MacAddr,
|
||||||
/* iface is an Option to make tests easier */
|
/* iface is an Option to make tests easier */
|
||||||
pub iface: Option<&'a NetworkInterface>,
|
pub iface: Option<&'a NetworkInterface>,
|
||||||
pub ip_addresses: Option<&'a HashSet<IpAddr>>,
|
pub self_ip_list: Option<&'a HashSet<IpAddr>>,
|
||||||
pub ignored_ip_addresses: Option<&'a HashSet<IpAddr>>,
|
pub remote_ip_deny_list: Option<&'a HashSet<IpAddr>>,
|
||||||
/* loggers */
|
/* loggers */
|
||||||
pub log: MetaLogger,
|
pub log: MetaLogger,
|
||||||
}
|
}
|
||||||
|
@ -123,27 +123,29 @@ fn main() {
|
||||||
.num_args(1),
|
.num_args(1),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("ipfile")
|
Arg::new("selfipfile")
|
||||||
.long("ip-addr-file")
|
.long("self-ip-file")
|
||||||
.help("File with the list of IP addresses to impersonate")
|
.help("File with the list of IP addresses handled by masscanned")
|
||||||
.num_args(1),
|
.num_args(1),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("iplist")
|
Arg::new("selfiplist")
|
||||||
.long("ip-addr")
|
.long("self-ip-list")
|
||||||
.help("Inline list of IP addresses to impersonate, comma-separated")
|
.help("Inline list of IP addresses handled by masscanned, comma-separated")
|
||||||
.num_args(1),
|
.num_args(1),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("ignoredipfile")
|
Arg::new("remoteipdenyfile")
|
||||||
.long("ignored-ip-addr-file")
|
.long("remote-ip-deny-file")
|
||||||
.help("File with the list of IP addresses to NOT respond to")
|
.help(
|
||||||
|
"File with the list of IP addresses from which masscanned will ignore packets",
|
||||||
|
)
|
||||||
.num_args(1),
|
.num_args(1),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("ignorediplist")
|
Arg::new("remoteipdenylist")
|
||||||
.long("ignored-ip-addr")
|
.long("remote-ip-deny-list")
|
||||||
.help("Inline list of IP addresses to NOT respond to, comma-separated")
|
.help("Inline list of IP addresses from which masscanned will ignore packets")
|
||||||
.num_args(1),
|
.num_args(1),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -207,9 +209,9 @@ fn main() {
|
||||||
};
|
};
|
||||||
/* Parse ip address file specified */
|
/* Parse ip address file specified */
|
||||||
/* FIXME: .and_then(|path| File::open(path).map(|file| )).unwrap_or_default() ? */
|
/* FIXME: .and_then(|path| File::open(path).map(|file| )).unwrap_or_default() ? */
|
||||||
let mut ip_list = if let Some(ref path) = args.get_one::<String>("ipfile") {
|
let mut ip_list = if let Some(ref path) = args.get_one::<String>("selfipfile") {
|
||||||
if let Ok(file) = File::open(path) {
|
if let Ok(file) = File::open(path) {
|
||||||
info!("parsing ip address file: {}", &path);
|
info!("parsing self ip file: {}", &path);
|
||||||
file.extract_ip_addresses_only(None)
|
file.extract_ip_addresses_only(None)
|
||||||
} else {
|
} else {
|
||||||
HashSet::new()
|
HashSet::new()
|
||||||
|
@ -217,10 +219,10 @@ fn main() {
|
||||||
} else {
|
} else {
|
||||||
HashSet::new()
|
HashSet::new()
|
||||||
};
|
};
|
||||||
if let Some(ip_inline_list) = args.get_one::<String>("iplist") {
|
if let Some(ip_inline) = args.get_one::<String>("selfiplist") {
|
||||||
ip_list.extend(ip_inline_list.extract_ip_addresses_only(None));
|
ip_list.extend(ip_inline.extract_ip_addresses_only(None));
|
||||||
}
|
}
|
||||||
let ip_addresses = if !ip_list.is_empty() {
|
let self_ip_list = if !ip_list.is_empty() {
|
||||||
for ip in &ip_list {
|
for ip in &ip_list {
|
||||||
info!("binding........{}", ip);
|
info!("binding........{}", ip);
|
||||||
}
|
}
|
||||||
|
@ -230,9 +232,10 @@ fn main() {
|
||||||
info!("binding........::");
|
info!("binding........::");
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
let mut ignored_ip_list = if let Some(ref path) = args.get_one::<String>("ignoredipfile") {
|
/* Parse remote ip deny file specified */
|
||||||
|
let mut ip_list = if let Some(ref path) = args.get_one::<String>("remoteipdenyfile") {
|
||||||
if let Ok(file) = File::open(path) {
|
if let Ok(file) = File::open(path) {
|
||||||
info!("parsing ignored ip address file: {}", &path);
|
info!("parsing remote ip deny file: {}", &path);
|
||||||
file.extract_ip_addresses_only(None)
|
file.extract_ip_addresses_only(None)
|
||||||
} else {
|
} else {
|
||||||
HashSet::new()
|
HashSet::new()
|
||||||
|
@ -240,14 +243,14 @@ fn main() {
|
||||||
} else {
|
} else {
|
||||||
HashSet::new()
|
HashSet::new()
|
||||||
};
|
};
|
||||||
if let Some(ignored_ip_inline_list) = args.get_one::<String>("ignorediplist") {
|
if let Some(ip_inline) = args.get_one::<String>("remoteipdenylist") {
|
||||||
ignored_ip_list.extend(ignored_ip_inline_list.extract_ip_addresses_only(None));
|
ip_list.extend(ip_inline.extract_ip_addresses_only(None));
|
||||||
}
|
}
|
||||||
let ignored_ip_addresses = if !ignored_ip_list.is_empty() {
|
let remote_ip_deny_list = if !ip_list.is_empty() {
|
||||||
for ip in &ignored_ip_list {
|
for ip in &ip_list {
|
||||||
info!("ignoring.......{}", ip);
|
info!("ignoring.......{}", ip);
|
||||||
}
|
}
|
||||||
Some(&ignored_ip_list)
|
Some(&ip_list)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
@ -256,8 +259,8 @@ fn main() {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac,
|
mac,
|
||||||
iface: Some(&iface),
|
iface: Some(&iface),
|
||||||
ip_addresses,
|
self_ip_list,
|
||||||
ignored_ip_addresses,
|
remote_ip_deny_list,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
info!("interface......{}", masscanned.iface.unwrap().name);
|
info!("interface......{}", masscanned.iface.unwrap().name);
|
||||||
|
|
|
@ -292,8 +292,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let client_info = ClientInfo::new();
|
let client_info = ClientInfo::new();
|
||||||
|
@ -316,8 +316,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let client_info = ClientInfo::new();
|
let client_info = ClientInfo::new();
|
||||||
|
@ -341,8 +341,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let client_info = ClientInfo::new();
|
let client_info = ClientInfo::new();
|
||||||
|
@ -366,8 +366,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let client_info = ClientInfo::new();
|
let client_info = ClientInfo::new();
|
||||||
|
|
|
@ -628,8 +628,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let mut client_info = ClientInfo::new();
|
let mut client_info = ClientInfo::new();
|
||||||
|
|
|
@ -238,8 +238,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let ip_src = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));
|
let ip_src = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));
|
||||||
|
@ -306,8 +306,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let client_info = ClientInfo::new();
|
let client_info = ClientInfo::new();
|
||||||
|
|
|
@ -215,8 +215,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
/***** TEST STUN - MAGIC *****/
|
/***** TEST STUN - MAGIC *****/
|
||||||
|
@ -276,8 +276,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
/***** TEST SSH *****/
|
/***** TEST SSH *****/
|
||||||
|
@ -318,8 +318,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
/***** TEST GHOST *****/
|
/***** TEST GHOST *****/
|
||||||
|
@ -352,8 +352,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
/***** TEST COMPLETE REQUEST *****/
|
/***** TEST COMPLETE REQUEST *****/
|
||||||
|
@ -374,8 +374,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let mut client_info = ClientInfo::new();
|
let mut client_info = ClientInfo::new();
|
||||||
|
|
|
@ -1199,8 +1199,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let client_info = ClientInfo::new();
|
let client_info = ClientInfo::new();
|
||||||
|
@ -1268,8 +1268,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let client_info = ClientInfo::new();
|
let client_info = ClientInfo::new();
|
||||||
|
@ -1332,8 +1332,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let client_info = ClientInfo::new();
|
let client_info = ClientInfo::new();
|
||||||
|
@ -1394,8 +1394,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
mac: MacAddr::from_str("00:00:00:00:00:00").expect("error parsing default MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: None,
|
self_ip_list: None,
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let client_info = ClientInfo::new();
|
let client_info = ClientInfo::new();
|
||||||
|
|
|
@ -442,8 +442,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let payload_resp = if let Some(r) = repl(payload, &masscanned, &mut client_info, None) {
|
let payload_resp = if let Some(r) = repl(payload, &masscanned, &mut client_info, None) {
|
||||||
|
@ -503,8 +503,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
client_info.ip.src = Some(IpAddr::V6(test_ip_addr));
|
client_info.ip.src = Some(IpAddr::V6(test_ip_addr));
|
||||||
|
@ -556,8 +556,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
client_info.ip.src = Some(IpAddr::V4(test_ip_addr));
|
client_info.ip.src = Some(IpAddr::V4(test_ip_addr));
|
||||||
|
@ -607,8 +607,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
client_info.ip.src = Some(IpAddr::V4(test_ip_addr));
|
client_info.ip.src = Some(IpAddr::V4(test_ip_addr));
|
||||||
|
|
|
@ -111,8 +111,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let cookie = synackcookie::generate(&client_info, &masscanned.synack_key).unwrap();
|
let cookie = synackcookie::generate(&client_info, &masscanned.synack_key).unwrap();
|
||||||
|
@ -166,8 +166,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let cookie = synackcookie::generate(&client_info, &masscanned.synack_key).unwrap();
|
let cookie = synackcookie::generate(&client_info, &masscanned.synack_key).unwrap();
|
||||||
|
@ -227,8 +227,8 @@ mod tests {
|
||||||
synack_key: [0, 0],
|
synack_key: [0, 0],
|
||||||
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
mac: MacAddr::from_str("00:11:22:33:44:55").expect("error parsing MAC address"),
|
||||||
iface: None,
|
iface: None,
|
||||||
ip_addresses: Some(&ips),
|
self_ip_list: Some(&ips),
|
||||||
ignored_ip_addresses: None,
|
remote_ip_deny_list: None,
|
||||||
log: MetaLogger::new(),
|
log: MetaLogger::new(),
|
||||||
};
|
};
|
||||||
let cookie = synackcookie::generate(&client_info, &masscanned.synack_key).unwrap();
|
let cookie = synackcookie::generate(&client_info, &masscanned.synack_key).unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue