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

[Rfkill/PyRic issue]: pyric.error: [Errno 19] No device at None #1444

Open
s7x opened this issue Jul 8, 2021 · 9 comments
Open

[Rfkill/PyRic issue]: pyric.error: [Errno 19] No device at None #1444

s7x opened this issue Jul 8, 2021 · 9 comments
Labels

Comments

@s7x
Copy link

s7x commented Jul 8, 2021

Version: commit 4e1052f

Description

Information

  • OS: Archlinux with Blackarch repos
  • Kernel: 5.12.10-arch1-1
  • Cards used/Chipset: Ralink Technology, Corp. RT5572 Wireless Adapter (Panda Wireless PAU09 N600), 2 identical cards
  • Injection/AP mode compatible?: Yes

Hello there!

s7x here, from the Blackarch Linux team. There seems to be an error in the pyric/utils/rfkill.py file in the soft_blocked() function preventing wifiphisher to run properly. I think the problem lies in the rfkill_list() function though. As shown in the screenshot below, when I run the rfkill_list() function, it does not properly indexes the phy#N/wlanN cards/interfaces in the rfks dict.

image

iw dev showing the phy#N cards/interfaces:

image

When running rfkill list, I can see that the cards are not blocked (neither hard/soft blocked):

image

Things tried

  • Disabling NetworkManager
  • airmon-ng check kill
  • Only using 1 card
  • rfkill unblock manually

Script Output

> wifiphisher -aI wlan1 -eI wlan2

[*] Starting Wifiphisher 1.4GIT ( https://wifiphisher.org ) at 2021-07-08 13:21
[+] Timezone detected. Setting channel range to 1-13
Traceback (most recent call last):
  File "/usr/bin/wifiphisher", line 33, in <module>
    sys.exit(load_entry_point('wifiphisher==1.4', 'console_scripts', 'wifiphisher')())
  File "/usr/lib/python3.9/site-packages/wifiphisher/pywifiphisher.py", line 729, in run
    engine.start()
  File "/usr/lib/python3.9/site-packages/wifiphisher/pywifiphisher.py", line 451, in start
    self.network_manager.unblock_interface(mon_iface)
  File "/usr/lib/python3.9/site-packages/wifiphisher/common/interfaces.py", line 647, in unblock_interface
    if pyw.isblocked(card):
  File "/usr/lib/python3.9/site-packages/pyric/pyw.py", line 625, in isblocked
    return rfkill.soft_blocked(idx), rfkill.hard_blocked(idx)
  File "/usr/lib/python3.9/site-packages/pyric/utils/rfkill.py", line 163, in soft_blocked
    raise pyric.error(errno.ENODEV,"No device at {0}".format(idx))
pyric.error: [Errno 19] No device at None

Don't hesitate to ask if you need more information.

EDIT: typo

Cheers!

@sophron
Copy link
Member

sophron commented Jul 15, 2021

Hi @s7x,

Thanks for reporting this. Development is pretty slow these days. Hopefully, we'll find some time to have a look within the next few months.

@JetseVerschuren
Copy link

Hi @s7x,

First of all, thanks for the detailed report. I'd like to mention PyRIC is a separate library maintained by @wraith-wireless. That being said, I can't replicate your issue on my machine (Ubuntu). When I replicate your experiment with manually pasting the code for rfkill_list into python (bpython to be exact), I get an error that getname is not defined. After defining that function it works fine. Did you declare it "above" your screenshot?

P.S. @sophron I was literally just typing this when you commented...

@s7x
Copy link
Author

s7x commented Jul 29, 2021

Hi @JetseVerschuren & @sophron, first of all: thank you for your feedbacks on the issue!

No worries on the delays @sophron I understand. It's to help us keep track on the issues encountered on tools in Blackarch's side too :)

Hi @s7x,

First of all, thanks for the detailed report. I'd like to mention PyRIC is a separate library maintained by @wraith-wireless. That being said, I can't replicate your issue on my machine (Ubuntu). When I replicate your experiment with manually pasting the code for rfkill_list into python (bpython to be exact), I get an error that getname is not defined. After defining that function it works fine. Did you declare it "above" your screenshot?

P.S. @sophron I was literally just typing this when you commented...

Regarding PyRIC causing trouble, I need to specify that I was using the fork from @sophron in my test. I also tried the @wraith-wireless version but I'm having the same issue when running wifiphisher: (pyric.error: [Errno 19] No device at None).

I did in fact import all the pyric/utils/rfkill.py content in ipython before running the script.

@Mexploit
Copy link

Mexploit commented Aug 28, 2021

Hello @s7x , @sophron , friendly Noob here. I was having the same issue on Ubuntu 20.04, re-installed the OS multiple times along with the proper Python packages. It was to no avail. I kept getting the same issue you are having. I found it interesting that when i did a fresh install of Ubuntu 18.04 LTS, and installed the Python packages and dependencies along with sudo apt-get install net-tools, it actually worked. I couldn't get the victim machine to connect to my Evil Twin "Couldn't get IP", but after running the following commands (sudo systemctl disable systemd-resolved.service &
sudo systemctl stop system-resolved
), The "Couldn't get IP" issue was resolved and Wifiphisher worked without Errors. Maybe with your extensive knowledge you can investigate what differentiates Ubuntu 18.04 & 20.04, and that could possibly lead the authors to a better diagnostic. Sorry i can't be of much help. P.S after installing and succesfully running an attack with Wifiphisher, i tried to upgrade from 18.04 LTS to 20.04 LTS using terminal and after doing so, wifiphisher gave me multiple Errors along the way and could not find a solution anywhere. Hope my experience can offer you guys some hints, thank you for your hard work. The cards i was using during this Alfa AWUS036NHA and Alfwa AWUS036ACS (5ghz capable).

@kozel747
Copy link

5.14.0-kali2-amd64 #1 SMP Debian 5.14.9-2kali1 (2021-10-04) x86_64 GNU/Linux
i have this error too
Changing wlan2mon MAC addr (BSSID) to 00:00:00:af:90:c1
[+] Changing wlan2mon MAC addr (BSSID) to 00:00:00:02:c6:86
Traceback (most recent call last):
File "/usr/local/bin/wifiphisher", line 33, in
sys.exit(load_entry_point('wifiphisher==1.4', 'console_scripts', 'wifiphisher')())
File "/usr/local/lib/python3.9/dist-packages/wifiphisher-1.4-py3.9.egg/wifiphisher/pywifiphisher.py", line 729, in run
engine.start()
File "/usr/local/lib/python3.9/dist-packages/wifiphisher-1.4-py3.9.egg/wifiphisher/pywifiphisher.py", line 503, in start
self.network_manager.unblock_interface(ap_iface)
File "/usr/local/lib/python3.9/dist-packages/wifiphisher-1.4-py3.9.egg/wifiphisher/common/interfaces.py", line 647, in unblock_interface
if pyw.isblocked(card):
File "/usr/lib/python3/dist-packages/pyric/pyw.py", line 625, in isblocked
return rfkill.soft_blocked(idx), rfkill.hard_blocked(idx)
File "/usr/lib/python3/dist-packages/pyric/utils/rfkill.py", line 163, in soft_blocked
raise pyric.error(errno.ENODEV,"No device at {0}".format(idx))
pyric.error: [Errno 19] No device at None

@jhondepp69
Copy link

why sir...help me...broken wifiphisher

[*] Starting Wifiphisher 1.4GIT ( https://wifiphisher.org ) at 2021-12-14 11:55
[+] Timezone detected. Setting channel range to 1-13
[+] Selecting wlan0 interface for the deauthentication attack
[+] Selecting wlan1 interface for creating the rogue Access Point
[+] Changing wlan1 MAC addr (BSSID) to 00:00:00:da:88:a8
[+] Changing wlan1 MAC addr (BSSID) to 00:00:00:81:d7:e6
Traceback (most recent call last):
File "/usr/local/bin/wifiphisher", line 33, in
sys.exit(load_entry_point('wifiphisher==1.4', 'console_scripts', 'wifiphisher')())
File "/usr/local/lib/python3.9/dist-packages/wifiphisher-1.4-py3.9.egg/wifiphisher/pywifiphisher.py", line 729, in run
engine.start()
File "/usr/local/lib/python3.9/dist-packages/wifiphisher-1.4-py3.9.egg/wifiphisher/pywifiphisher.py", line 503, in start
self.network_manager.unblock_interface(ap_iface)
File "/usr/local/lib/python3.9/dist-packages/wifiphisher-1.4-py3.9.egg/wifiphisher/common/interfaces.py", line 647, in unblock_interface
if pyw.isblocked(card):
File "/usr/local/lib/python3.9/dist-packages/PyRIC-0.1.6.4-py3.9.egg/pyric/pyw.py", line 625, in isblocked
return rfkill.soft_blocked(idx), rfkill.hard_blocked(idx)
File "/usr/local/lib/python3.9/dist-packages/PyRIC-0.1.6.4-py3.9.egg/pyric/utils/rfkill.py", line 163, in soft_blocked
raise pyric.error(errno.ENODEV,"No device at {0}".format(idx))
pyric.error: [Errno 19] No device at None

@pippo1990
Copy link

pippo1990 commented Jan 31, 2022

@sophron @s7x tracked down to pyric/net/wireless/rfkill_h.py line 123:

it says: rfk_rfkill_event = "IBBBB" but should be rfk_rfkill_event = "IBBBBB"

at least in my setting (kali linux - debian rolling testing ?? )

i goes that :
RFKILLEVENTLEN = struct.calcsize(rfk_rfkill_event) ----> is 9 instead of 8

so :

def rfkill_event(idx,rtype,op,hard=0,soft=0):
"""
create a rkfill event structure
:param idx: index of dev rfkill i.e. 0,1
:param rtype: type of rfkill
:param op: op code
:param hard: hard state one of {0=unbloacked|1=blocked}
:param soft: soft state one of {0=unblocked|1=blocked}
:returns: a rfkill event structure
"""
return struct.pack(rfk_rfkill_event,idx,rtype,op,hard,soft)

should return a byte more like --> return struct.pack(rfk_rfkill_event,idx,rtype,op,hard,soft, unknown)

don't know what the byte is for, according to https://github.com/torvalds/linux/blob/master/include/uapi/linux/rfkill.h

is for:

struct rfkill_event_ext {
__u32 idx;
__u8 type;
__u8 op;
__u8 soft;
__u8 hard;

/*
 * older kernels will accept/send only up to this point,
 * and if extended further up to any chunk marked below
 */

__u8  hard_block_reasons;  ## -------> ?????????????????

} attribute((packed));`

__u8 hard_block_reasons; let me know if you know more,

found something : https://patchwork.kernel.org/project/linux-wireless/patch/20201104134641.28816-1-emmanuel.grumbach@intel.com/

@cond8r
Copy link

cond8r commented Feb 4, 2022

I just found out what the problem is, I only keep one wireless card, through ifconfig wlan0 down, and then run sudo wifiphisher and it works!

@niroop893
Copy link

I have got the below error after install wiifiphisher on ubuntu 22.04

Traceback (most recent call last):
File "/home/niroop/wifiphisher/bin/./wifiphisher", line 24, in
run()
File "/usr/local/lib/python3.10/dist-packages/wifiphisher-1.4-py3.10.egg/wifiphisher/pywifiphisher.py", line 762, in run
engine.start()
File "/usr/local/lib/python3.10/dist-packages/wifiphisher-1.4-py3.10.egg/wifiphisher/pywifiphisher.py", line 536, in start
self.network_manager.unblock_interface(ap_iface)
File "/usr/local/lib/python3.10/dist-packages/wifiphisher-1.4-py3.10.egg/wifiphisher/common/interfaces.py", line 648, in unblock_interface
if pyw.isblocked(card):
File "/usr/local/lib/python3.10/dist-packages/PyRIC-0.1.6.4-py3.10.egg/pyric/pyw.py", line 624, in isblocked
idx = rfkill.getidx(card.phy)
File "/usr/local/lib/python3.10/dist-packages/PyRIC-0.1.6.4-py3.10.egg/pyric/utils/rfkill.py", line 200, in getidx
rfks = rfkill_list()
File "/usr/local/lib/python3.10/dist-packages/PyRIC-0.1.6.4-py3.10.egg/pyric/utils/rfkill.py", line 86, in rfkill_list
'soft':RFKILL_STATE[s],
IndexError: list index out of range

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

No branches or pull requests

9 participants