Articles tagged #ethernet

Page 1
The thumbnail for this page

Crafting ARP packets to find a remote host's MAC address

Dec 12, 2019
16 min #networking · #rust · #win32 · #ffi · #arp · #ethernet · #parsing

Alright. ALRIGHT. I know, we’re all excited, but let’s think about what we’re doing again.

So we’ve managed to look at real network traffic and parse it completely. We’ve also taken some ICMP packets, parsed them, and then serialized them right back and we got the exact same result.

So I know what you’re thinking - let’s just move our way down the stack again - stuff that ICMP packet in an IP packet, then in an Ethernet frame, and then serialize the whole thing.

Read more
The thumbnail for this page

Consuming Ethernet frames with the nom crate

Nov 05, 2019
23 min #networking · #ethernet · #rust · #assembly · #parsing

Now that we’ve found the best way to find the “default network interface”… what can we do with that interface?

Well, listen for network traffic of course!

use rawsock::open_best_library; use std::time::Instant; fn main() -> Result<(), Error> { let lib = open_best_library()?; let iface_name = format!(r#"\Device\NPF_{}"#, netinfo::default_nic_guid()?); let iface = lib.open_interface(&iface_name)?; println!("Listening for packets..."); // doing some low-cost logging over here let start = Instant::now(); iface.loop_infinite_dyn(&mut |packet| { println!( "{:?} | received {} bytes", start.elapsed(), packet.len() ); })?; Ok(()) }
Read more
Page 1

Go back to the homepage.

Ko-fi GitHub Sponsors Patreon
Bluesky Mastodon YouTube
TikTok Instagram RSS
About Legal Notice Privacy Policy Terms and Conditions