-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Added support of usbmon
.
#3666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Added support of usbmon
.
#3666
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3666 +/- ##
==========================================
- Coverage 84.57% 84.56% -0.01%
==========================================
Files 296 296
Lines 62214 62342 +128
==========================================
+ Hits 52616 52721 +105
- Misses 9598 9621 +23
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allowing to use KS-compiled specs
Katai structs are far from being flexible enough to really be used within Scapy.
Scapy spec DSL is somehow inferior to the one provided by KS
You're probably using it wrong.
To be honnest, there are quite a bunch of issues in this PR, i noted a few but please note this will need a major refactor.
Thanks a lot for your interest in Scapy and your time
class SetupSetup(Packet): | ||
name = "Setup" | ||
|
||
class PcapUsbSetup(Packet): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We typically don't do Packets in Packets
] | ||
|
||
fields_desc = [ | ||
PacketLenField("s", None, PcapUsbSetup, length_from=lambda pkt: 8), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use PacketField
here. Since your sub-packet has a static size, it's not useful to use PacketLenField
. This applies everywhere else.
Also what's with the name "s" ?
|
||
@staticmethod | ||
def _getSize(*_args): | ||
return 12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You likely don't need that + it's really not scapy-alike.
@@ -59,6 +59,9 @@ def process_ignore_tags(buffer): | |||
'sphinx>=3.0.0', | |||
'sphinx_rtd_theme>=0.4.3', | |||
'tox>=3.0.0' | |||
], | |||
'usbmon': [ | |||
'enum34 ; python_version < "3.5"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't include this and don't use Python 34 enums, but keep Scapy's dict for now. (Sure it would be nice to use Python 34+ enums everywhere... cf #3665)
# we have to do it since when using `PacketLenField`: | ||
# `.parent` is not populated | ||
# alternatives are always evaluated no matter what | ||
# no way to provide parameters even with severe perversions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're likely doing something wrong here
Rebased upon that branch.
I guess we can delay landing this untill depending on
It seems that just
I know, though I'm not sure is that keeping everything flat is the right approach, since using nesting allows to decompose tasks. This perversion with copying fields into different types was caused by:
We need to invent a more sensigle name, I don't remember why I have chosen that one, but I haven't utilized this field (and the whole |
39057be
to
58e1038
Compare
Checklist:
tox
or,cd test && ./run_tests_py2, cd test && ./run_tests_py3
) - haven't. And these instructions are just incorrect.Adds USBMon support. It may look somehow alien since I have compiled it from my Kaitai Struct spec into Construct target, then rewritten it into primitives used in Scapy and then there was a long way of fighting with it because Scapy spec DSL is somehow inferior to the one provided by KS. I think that Scapy needs a major version upgrade reducing the gap, and maybe even allowing to use KS-compiled specs by just adding them into a certain dir.