Added a correct checksum print
This commit is contained in:
parent
9bb93ca47c
commit
276bc6d174
|
|
@ -112,7 +112,7 @@ fn main() {
|
|||
// Send the ping request to the specified destination IP address.
|
||||
let dest_addr = SocketAddr::new(IpAddr::V4(dest_ip), 0);
|
||||
println!("[SENDING ICMP DATA]\n");
|
||||
println!("CHECKSUM: [{:04x}]",checksum);
|
||||
println!("CHECKSUM: {:02x} {:02x}", (checksum&0xff00)>>8, (checksum)&0xff);
|
||||
println!("{}",rhexdump::hexdump(&buf));
|
||||
|
||||
// Starting the timer
|
||||
|
|
@ -150,8 +150,8 @@ fn main() {
|
|||
|
||||
// Print the parsed response.
|
||||
println!("\n[ANALYSIS] \n");
|
||||
// println!("CHECKSUM: {:02x} {:02x}",(icmp_checksum<<8)&0x00ff, icmp_checksum&0xff);
|
||||
println!("CHECKSUM: [{:04x}]",icmp_checksum);
|
||||
println!("CHECKSUM: {:02x} {:02x}", (icmp_checksum&0xff00)>>8, (icmp_checksum)&0xff);
|
||||
// println!("CHECKSUM: [{:04x}]",icmp_checksum);
|
||||
println!("{}",rhexdump::hexdump(&buf));
|
||||
println!(" > {} bytes recv over the socket in {:.2} milliseconds", bytes_recv, (elapsed.as_micros() as f64)/1000.);
|
||||
println!(" > icmp_type = {:width$} icmp_code = {:width$}", icmp_type, icmp_code, width=2);
|
||||
|
|
|
|||
Loading…
Reference in New Issue