fix: fixing revshell example and its routes

This commit is contained in:
Andrew Rioux
2023-05-12 01:16:52 -04:00
parent 4123175eda
commit 5ab43a10fe
4 changed files with 30 additions and 9 deletions

View File

@@ -122,7 +122,10 @@ impl Link {
impl Debug for Link {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Link").field("name", &self.name()).finish()
f.debug_struct("Link")
.field("name", &self.name())
.field("ifindex", &self.ifindex())
.finish()
}
}
@@ -174,6 +177,14 @@ pub fn get_macs_and_src_for_ip(
let link = netlink::get_link_by_index(links, link_ind)?;
let neighs_ = neighs.iter().collect::<Vec<_>>();
dbg!(neighs_.len());
for neigh in neighs_.iter() {
println!("Neigh: {:?} -> {:?} ({})", neigh.lladdr(), neigh.dst(), neigh.ifindex());
}
let neigh = neighs.iter().find(|n| n.ifindex() == link.ifindex())?;
let srcip = addrs.iter().find(|a| a.ifindex() == link.ifindex())?;