-
Notifications
You must be signed in to change notification settings - Fork 155
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
Speed enhancements #63
base: master
Are you sure you want to change the base?
Conversation
It would appear that my editor has removed spaces on blank lines. It makes the diff hard to read, apologies for that... |
else: | ||
return None | ||
|
||
return channelToFreq.get(str(channelNumber)) |
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.
The get method for a dict will return None if it is not found.
p_stationcount = re.compile('.*station count: ([0-9]+)') | ||
p_utilization = re.compile('.*channel utilisation: ([0-9]+)/255') | ||
|
||
def regexCompiler(self): |
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.
This is where we save cycles. We create it once and be done with it via instantiation of the Class.
def run(self): | ||
|
||
## Grab the wireless engine | ||
wEng = WirelessEngine() |
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.
Instantiated for regex storage versus compilation everytime.
Hi stryngs, thanks for the PR. Looks good, except with the addition of the requirements.txt file I wonder if == on the versions could break installs on some systems? Maybe we separate out the requirements.txt PR from the other changes? |
Hi @ghostop14 -- You can remove the == if you just want pip to grab the newest version and not be tied to a specific one. It is more for a 100% approach with regards to knowing that X packages with version Y allow a successful program run. I think >= works as well, but have never used. |
GitHub has a hide whitespace changes feature. adding https://github.com/ghostop14/sparrow-wifi/pull/63/files?diff=unified&w=1 |
This PR serves to deal with regex and how iw is used. At some point I aim to PR a full scapy functionality, but for now I need to learn how this repo works and so I'm eyeballing and shooting from the hip on general patches that can be done in the name of speed.
Before this patch re.compile() was called everytime that iw would scan. This patch removes that and makes it compile only once, saving cycles.
Testing shows that the threads are safe and the GUI updates as expected.