ystero-dev / scalpel Goto Github PK
View Code? Open in Web Editor NEWPacket Dissection and sculpting in Rust
License: Other
Packet Dissection and sculpting in Rust
License: Other
LLDP is an IEEE 802.1AB protocol.
Building scalpel
with the command wasm-pack build --target web
throws error.
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
Compiling scalpel v0.4.0 (/home/harshit/code/scalpel)
error: feature "wasm" is required for "wasm32" targets.
--> src/lib.rs:45:1
|
45 | compile_error!("feature "wasm" is required for "wasm32" targets.");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0433]: failed to resolve: use of undeclared crate or module wasm_bindgen
--> src/lib.rs:87:5
|
87 | use wasm_bindgen::prelude::*;
| ^^^^^^^^^^^^ use of undeclared crate or module wasm_bindgen
error[E0432]: unresolved imports crate::Layer
, crate::Packet
, crate::ENCAP_TYPE_ETH
, crate::Layer
, crate::Layer
, crate::Layer
, crate::Packet
, crate::ENCAP_TYPE_LINUX_SLL
, crate::Layer
, crate::Packet
, crate::ENCAP_TYPE_LINUX_SLL2
, crate::Layer
, crate::Layer
, crate::Layer
, crate::Layer
, crate::Layer
, crate::Layer
, crate::Layer
, crate::Layer
, crate::Layer
, crate::Layer
, crate::Layer
--> src/layers/ethernet/mod.rs:13:13
|
13 | use crate::{Layer, Packet, ENCAP_TYPE_ETH};
| ^^^^^ ^^^^^^ ^^^^^^^^^^^^^^
|
::: src/layers/ipv4.rs:12:5
|
12 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/ipv6.rs:12:5
|
12 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/linux_sll.rs:8:13
|
8 | use crate::{Layer, Packet, ENCAP_TYPE_LINUX_SLL};
| ^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^
|
::: src/layers/linux_sll2.rs:8:13
|
8 | use crate::{Layer, Packet, ENCAP_TYPE_LINUX_SLL2};
| ^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
|
::: src/layers/tcp.rs:11:5
|
11 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/udp.rs:10:5
|
10 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/dns.rs:11:5
|
11 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/icmp.rs:10:5
|
10 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/icmpv6.rs:10:5
|
10 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/arp.rs:10:5
|
10 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/sctp.rs:12:5
|
12 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/m3ua.rs:10:5
|
10 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/mpls.rs:10:5
|
10 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/layers/vxlan.rs:7:5
|
7 | use crate::Layer;
| ^^^^^^^^^^^^
|
::: src/packet.rs:13:5
|
13 | use crate::Layer;
| ^^^^^^^^^^^^
error: cannot find attribute wasm_bindgen
in this scope
--> src/lib.rs:90:3
|
90 | #[wasm_bindgen]
| ^^^^^^^^^^^^
Some errors have detailed explanations: E0432, E0433.
For more information about an error, try rustc --explain E0432
.
error: could not compile scalpel
(lib) due to 4 previous errors
Error: Compiling your crate to WebAssembly failed
Caused by: Compiling your crate to WebAssembly failed
Caused by: failed to execute cargo build
: exited with exit status: 101
full command: cd "/home/harshit/code/scalpel" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
OS: Ubuntu 20.04
CPU Architecture: x86_64
Rust version: 1.75.0
During dissection of DNS packets, it appears that the packet is alright and data is also available but we get TooShort
Error. Below is the dump of the Error and the data
Err: TooShort { required: 20, available: 9, data: "07080000038400093a800001518000002904d0000000000000" }, data: "000000010006001a9adead05000008004500008eee3240003611927701010101c0a8010b0035c441007a2f68f60c81a300010000000100010a6964656e7469747964620000010001000006000100014e51004001610c726f6f742d73657276657273036e657400056e73746c640c766572697369676e2d67727303636f6d007896689d000007080000038400093a800001518000002904d0000000000000"
Currently the crate supports three features python-bindings
, logging
and (soon) wasm
. Some of these features are mutually incompatible and hence mutually exclusive as well. Handling these features has resulted in code with a large number of #[cfg(...)]
types statement.
This can be perhaps simplified, or the feature level code is kept limited to a couple of files and some simple intuitive macros.
Implementation of dissectors for DHCPv6 as specified in RFC 8415.
Also Rust Doc format documentation to be added to refer to appropriate sections of the RFC.
We should support TCP/UDP Parsing. This should broadly support first level of support required for basic protocol parsing.
Currently we have a support for IP header parsing without IP options. It will be a good idea to support IP options. It's a good idea to support parsing the following options at-least -
Implement a dissection for DHCPv4. Also, the DHCP Options as specified in RFC 2131 for both DHCP Clients and Servers to be supported.
Also, during implementing - add Rust Doc comments to the code,so it is easier to reference the sections of RFC.
Right now most of the scalpel code works assuming std
environment. However, there is no real reason why the same code cannot be adopted for no_std
environment. At least following needs to be kept in mind
hashbrown
instead of std::collections::HashMap
for no-std environmentslock_api
in place of std::sync::
crate::Error
compatible with no_std
environmentFor now for ease, let's simply restructure the use
statements such that parts can be std
and no_std
and then add those one by one.
Functionality provided by lazy_static
is now available as a part of core
and std
as OnceCell
. This can be used in places where we are using lazy_static
.
If the capture is done using the any
device, the packet format is not ethernet but Linux SLL, which has a different header and therefore does not parse correctly.
It would be great if scalpel would also support the Linux SLL format to parse packets captured via the any
device.
Similar to IPv4 implementation, We should be handling parsing of IPv6 headers. For now support for IP Options can be ignored. But a basic Parsing ability needs to be implemented.
We already have types for Ethernet MAC Address (MACAddress
) and Ether Type (EtherType
) defined which work well for us for Debug
and Display
printing and any other custom handling. Along the similar lines, we should be defining -
IPv4
and IPv6
address types.Someone should go through the git log
and try to create release notes of the existing releases, so that this file can be updated with new release.
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.