pub mod resolution {
pub enum HostType {
Target,
Gateway
}
static SEARCH_EMOJI: console::Emoji<'_, '_> = console::Emoji("๐ ", "");
static SUCCESS_EMOJI: console::Emoji<'_, '_> = console::Emoji("โ
", "");
pub fn search(host_type: HostType, ip: std::net::Ipv4Addr) {
let type_name = if matches!(host_type, HostType::Target) { String::from("target") } else { String::from("gateway") };
println!(
"{} {}Resolving the MAC address of the {} ({}) ...",
console::style("[ARP Resolution]").bold().dim(),
SEARCH_EMOJI,
type_name,
ip
);
}
pub fn found(host: crate::arp::ArpHost) {
println!(
"{} {}Found host at {}",
console::style("[ARP Resolution]").bold().dim(),
SUCCESS_EMOJI,
host.mac
);
}
}
pub mod poisoning {
pub enum State {
InProgress,
CleanUp,
Stopped
}
static POISON_EMOJI: console::Emoji<'_, '_> = console::Emoji("๐พ ", "");
static CLEANUP_EMOJI: console::Emoji<'_, '_> = console::Emoji("๐งน ", "");
pub fn state(state: State) {
match state {
State::InProgress => {
println!(
"{} {}Poisoning the target and gateway cache ... (Ctrl-c to interrupt)",
console::style("[ARP Poisoning]").bold().dim(),
POISON_EMOJI
);
},
State::CleanUp => {
println!(
"{} {}Restoring the target and gateway ARP caches ...",
console::style("[ARP Poisoning]").bold().dim(),
CLEANUP_EMOJI
);
},
State::Stopped => {
println!(
"{} {}ARPCache poisoned has stopped, remote caches have been restored.",
console::style("[ARP Poisoning]").bold().dim(),
CLEANUP_EMOJI
);
}
}
}
}