coldfireworks / packet_crafter Goto Github PK
View Code? Open in Web Editor NEWA rust library which consists of tool for creating, manuipulating and parsing data packets
License: MIT License
A rust library which consists of tool for creating, manuipulating and parsing data packets
License: MIT License
Hey @coldFireworks, I've bump into this crate with intention to create a simple ping program.
And with a simple framework ~20 lines of code I decided to try to send a echo request where the packet is build in power of this crate. And then I found out that when we change the playground to not standart I it's not working (at least for me) :).
I piled a packet creation to the internals of this https://docs.rs/ping/0.2.0/ping/index.html library and it was fine.
I started investigation according this issue by comparing the buffers. At once I found out that the checksum is different. Then I get the internals of checksum out and made a compares with internals of the foregoing library. As I can declare the function makes its money.
The issue is in related ti calculation of checksum from its origin.
As I see we should calculate the checksum not only on header but in awareness of playground too wiki
When I did this experiment the buffers were equal.
I would create a PR if the changes haven't been going to hurt the core of the library abstractions I suppose.
Thanks.
PS: I am just a regular guy for sure not an expert (So I might am wrong somewhere). I decided to left my observations just in case :).
Example:
ICMP echo request with the playground filled with 1.
The expectation is based on remote servers responses (google.com
, rust-lang.org
, ...). When we use one from expected section we get response in other way not.
let mut p = Packet::new(vec![Protocol::ICMP]);
p.add_header(headers::IcmpHeader::new(8, 0, 0, 0));
p.extend_payload(vec![1; 24]);
let buf = p.into_vec();
println!("{:?}", buf);
the result [8, 0, 247, 255, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
expected [8, 0, 235, 243, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
I am building a small utility where I send ICMP RA frames.
It looks like there is no Ipv6Header
struct and headers::IpHeader
is v4 only?
Is this correct?
Cheers,
Stefan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.