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

Speed enhancements #63

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

Speed enhancements #63

wants to merge 4 commits into from

Conversation

stryngs
Copy link

@stryngs stryngs commented May 20, 2021

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.

@stryngs
Copy link
Author

stryngs commented May 20, 2021

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))
Copy link
Author

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):
Copy link
Author

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()
Copy link
Author

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.

@ghostop14
Copy link
Owner

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?

@stryngs
Copy link
Author

stryngs commented May 24, 2021

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.

@the-j0k3r
Copy link

It would appear that my editor has removed spaces on blank lines. It makes the diff hard to read, apologies for that...

GitHub has a hide whitespace changes feature. adding &w=1 to link or

https://github.com/ghostop14/sparrow-wifi/pull/63/files?diff=unified&w=1

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.

3 participants