Replace import *
with explicit imports
#22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 usingble/__init__.py
to explictly import from things from submodules inlibs.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 usingfrom 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.