derv82 / wifite2

Rewrite of the popular wireless network auditor, "wifite"
GNU General Public License v2.0
6.42k stars 1.32k forks source link

Wifite with pypy #194

Open RChadwick7 opened 5 years ago

RChadwick7 commented 5 years ago

I'm trying to run wifite on a Raspberry Pi, but it's painfully slow. It looked like the main culprit was Python, so I tried running wifite with pypy. Unfortunately, it's not working:

root@kali:/# pypy  /usr/sbin/wifite
Traceback (most recent call last):
  File "/usr/sbin/wifite", line 3, in <module>
    from wifite import __main__
ImportError: No module named wifite

Any Ideas?

RaduNico commented 5 years ago

I've tested on my local system and running the command 'pypy /usr/sbin/wifite' fails with the very same error. I think the issue comes from the fact that wifite is not installed for pypy as explained here. I might be wrong here so feel free to correct me - I've never played with pypy so far.

If you download the repository and run with 'pypy Wifite.py' I think it will work. It works on my laptop, so I can't tell for sure on a raspberry - I can test in 1-2 days when I get to my raspberry.

RChadwick7 commented 5 years ago

I gave it a try downloading the repository, and it almost works! Almost. After it finds it's first handshake, and it's trying to crack it with the top 4800 probable, it throws this error:

[!] OSError: [Errno 24] Too many open files

After that, it stops working.

Is this something that could be fixed by properly configuring pypy? Is this related to my compiled Hashcat that may not work on the Pi?

RaduNico commented 5 years ago

I could reproduce your error on my laptop - it seems that for a reason pypy keeps piling up a lot of open files which it never closes. Those open files add up eventually reaching the system maximum number of open files resulting in the error you are seeing. In other words pypy and wifite are leaking open files when used together - I'll try and find the cause

RaduNico commented 5 years ago

I've found the cause of the problem - it seems the garbage collection takes a lot of time to kick in for pypy. Most of the files open by wifite are pipe files open by the Process class. I tried increasing the number of maximum files that can be opened by a process. At some point around 4000-5000 open files the garbage collection would start and close all those files.

Simply increase the number of maximum simultaneous open files for the system should fix it. Now another issue I ran into was that around 1000-1200 open files tshark would crash with a ' buffer overflow detected ' error. I am very unsure as to what causes that.