tomaspinho / rtl8821ce

Other
1.58k stars 412 forks source link

Monitor mode IS working. I don't know how. #282

Closed wxifze closed 2 years ago

wxifze commented 2 years ago

Month before I installed this driver from aur for the internal RTL8821CE adapter in my laptop.

Yesterday I plugged an external TL-WN722N(rtl8188eu) adapter in my laptop and installed the driver with monitor mode support for it. As usual with the TL-WN722N adapter, I executed these commands to launch monitor mode on the interface wlp3s0.

sudo airmon-ng check kill
sudo ifconfig wlp3s0 down
sudo iwconfig wlp3s0 mode monitor
sudo ifconfig wlp3s0 up

For some time I was debugging my ESP8266 project, capturing mostly beacon frames. Today while the wireshark was capturing packets I unplugged the TL-WN722N. Imagine my face when they were still coming. Turns out TL-WN722N was named wlp0s20f0u1, and wlp3s0 is actually an internal RTL8821CE adapter. I accidentally switched monitor mode on the wrong adapter and it worked! How is it possible?

Some info:

「~」 𝑓 uname -a
Linux desu 5.15.50-1-lts #1 SMP Sat, 25 Jun 2022 14:58:59 +0000 x86_64 GNU/Linux
「~」 𝑓 hwinfo --wlan
01: PCI 300.0: 0282 WLAN controller                             
  [Created at pci.386]
  Unique ID: hAO_.3iB5JdFY_KE
  Parent ID: Muvi.uZ7yVlanct8
  SysFS ID: /devices/pci0000:00/0000:00:1d.5/0000:03:00.0
  SysFS BusID: 0000:03:00.0
  Hardware Class: network
  Model: "Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter"
  Vendor: pci 0x10ec "Realtek Semiconductor Co., Ltd."
  Device: pci 0xc821 "RTL8821CE 802.11ac PCIe Wireless Network Adapter"
  SubVendor: pci 0x1a3b "AzureWave"
  SubDevice: pci 0x3041 
  Driver: "rtl8821ce"
  Driver Modules: "8821ce"
  Device File: wlp3s0
  Features: WLAN
  I/O Ports: 0x4000-0x40ff (rw)
  Memory Range: 0xa4300000-0xa430ffff (rw,non-prefetchable)
  IRQ: 142 (no events)
  HW Address: redacted
  Permanent HW Address: redacted
  Link detected: yes
  WLAN channels: 1 2 3 4 5 6 7 8 9 10 11 12 13 36 40 44 48 52 56 60 64 100 104 108 112 116 120 124 128 132 136 140
  WLAN frequencies: 2.412 2.417 2.422 2.427 2.432 2.437 2.442 2.447 2.452 2.457 2.462 2.467 2.472 5.18 5.2 5.22 5.24 5.26 5.28 5.3 5.32 5.5 5.52 5.54 5.56 5.58 5.6 5.62 5.64 5.66 5.68 5.7
  WLAN bitrates: 1 2 5.5 11
  WLAN encryption modes: TKIP CCMP
  WLAN authentication modes: open wpa-psk wpa-eap
  Module Alias: "pci:v000010ECd0000C821sv00001A3Bsd00003041bc02sc80i00"
  Driver Info #0:
    Driver Status: rtw88_8821ce is not active
    Driver Activation Cmd: "modprobe rtw88_8821ce"
  Driver Info #1:
    Driver Status: 8821ce is active
    Driver Activation Cmd: "modprobe 8821ce"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #22 (PCI bridge)
「~」 𝑓 iwconfig wlp3s0 
wlp3s0    IEEE 802.11b  ESSID:""  Nickname:"<WIFI@REALTEK>"
          Mode:Monitor  Frequency:2.417 GHz  Access Point: Not-Associated   
          Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Me connecting to my router, captured on RTL8821CE: asdfasdff

Also works with 5GHz: asdfasdff

tomaspinho commented 2 years ago

Well, monitor mode is working because you're using rtw88 which is the built-in kernel module by Realtek for this card. You're actually not using the code in this repo :)