Skip to content
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

Replace import * with explicit imports #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Cabalist
Copy link

@Cabalist Cabalist commented Apr 18, 2021

Hey there,

I'm working on a project where I am deciphering some ESB packets. I found this library after some googling and it seems alot of the work has already been done for me! This is a very cool project. As I was using this library I noticed a ton of import * and was having a really hard time tracing what was using what. I've gone through and replaced these with explicit imports.

Do the extensive use of import * the public API as it was is probably completely different. There are some changes I would suggest to make that more explicit. For example using ble/__init__.py to explictly import from things from submodules in libs.ble. This is not included in this patch because I'm unclear what was intentionally part of the public API and what was vacuumed in from the wildcard imports.

There are also some pretty intense import statements. (libs/ble.py being the worst offender with now 162 lines of imports.) This can be remedied by using

from mirage.libs.ble_utils import packets

instead of the current

from mirage.libs.ble_utils.packets import <a_bunch_of_things...>

I opted for the second way to try and keep this massive PR only in the imports instead of throughout the codebase.

I believe this fixed multiple bugs. There were places where scapy's Packet class was overriding mirage.libs.wireless_utils.packets or where libraries were being overwritten by local variables and then possibly being imported further down the line.

There are a number of other possible bugs and improvements I'd like to address but given the size of the delta here I wanted to make sure I didn't go too far afield before checking back in. :)

Thanks for all your hard work on this project and I look forward to using it to decipher my little pet project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant