Skip to content

btle: Add definitions for Bluetooth 5.0 control PDUs #3037

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

Merged
merged 2 commits into from
Jan 10, 2021

Conversation

rugeGerritsen
Copy link
Contributor

@rugeGerritsen rugeGerritsen commented Dec 28, 2020

The changes only support using scapy as a packet builder.
Dissection is not yet implemented.

I've used #2215 by @Matheus-Garbelini as a starting point.

closes #2215

@codecov
Copy link

codecov bot commented Dec 28, 2020

Codecov Report

Merging #3037 (cd9a08d) into master (27545d8) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3037      +/-   ##
==========================================
- Coverage   85.37%   85.36%   -0.01%     
==========================================
  Files         255      256       +1     
  Lines       53971    54113     +142     
==========================================
+ Hits        46076    46196     +120     
- Misses       7895     7917      +22     
Impacted Files Coverage Δ
scapy/layers/bluetooth4LE.py 96.10% <100.00%> (+4.21%) ⬆️
scapy/layers/can.py 94.63% <0.00%> (-1.45%) ⬇️
scapy/arch/windows/__init__.py 68.25% <0.00%> (-0.58%) ⬇️
scapy/data.py 87.85% <0.00%> (-0.52%) ⬇️
scapy/contrib/automotive/gm/gmlanutils.py 88.26% <0.00%> (-0.50%) ⬇️
scapy/contrib/automotive/gm/gmlan.py 92.33% <0.00%> (-0.36%) ⬇️
scapy/utils.py 78.60% <0.00%> (-0.31%) ⬇️
scapy/fields.py 91.20% <0.00%> (-0.29%) ⬇️
scapy/layers/dot11.py 90.53% <0.00%> (-0.04%) ⬇️
scapy/layers/dhcp.py 87.34% <0.00%> (ø)
... and 8 more

@Matheus-Garbelini
Copy link
Contributor

@rugeGerritsen thanks a lot. Dissection may be implemented after adding def dissection_done to the BTLE_DATA class as suggested by @guedou here: #2192 (comment)
In short, it appears empty PDUs or packets with no attributes cannot be dissected if they are empty. One workaround is to forcibly call the lines bellow:

p = conf.raw_layer(s, _internal=1, _underlayer=self)
self.add_payload(p)

I couldn't confirm this at the time so feel free to try this out.
Thanks a lot for following up on this PR.

The changes only support using scapy as a packet builder.
Dissection is not yet implemented.

Co-authored-by: Rubin Gerritsen <[email protected]>
@rugeGerritsen rugeGerritsen force-pushed the add_ble_control_procs branch from aaafacf to 9350d16 Compare January 1, 2021 15:37
@rugeGerritsen
Copy link
Contributor Author

@Matheus-Garbelini , thanks for your feedback. I will leave the dissection as is for now. The last push only initializes the base class of BTLEPhysField in a more pythonic way. Unfortunately it still fails with:

Expression "(super(BTLEPhysField, self).__init__(name, default, -8, ['phy_1m', 'phy_2m', 'phy_coded']), )" is assigned to nothing

I'm familiar enough with pylint to understand what is wrong here

Copy link
Member

@gpotter2 gpotter2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from two minor cosmetic comments (that you can probably ignore), this LGTM !
Thanks for the PR

@rugeGerritsen
Copy link
Contributor Author

@gpotter2 , thanks for your review!

@gpotter2 gpotter2 merged commit a436560 into secdev:master Jan 10, 2021
bzalkilani pushed a commit to bzalkilani/scapy that referenced this pull request Jun 12, 2022
* btle: Add definitions for Bluetooth 5.0 control PDUs

The changes only support using scapy as a packet builder.
Dissection is not yet implemented.

Co-authored-by: Rubin Gerritsen <[email protected]>

* Minor cosmetics changes

Co-authored-by: Matheus Garbelini <[email protected]>
Co-authored-by: Gabriel <[email protected]>
bzalkilani pushed a commit to bzalkilani/scapy that referenced this pull request Jun 14, 2022
* btle: Add definitions for Bluetooth 5.0 control PDUs

The changes only support using scapy as a packet builder.
Dissection is not yet implemented.

Co-authored-by: Rubin Gerritsen <[email protected]>

* Minor cosmetics changes

Co-authored-by: Matheus Garbelini <[email protected]>
Co-authored-by: Gabriel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants