Results 1 to 25 of 25

Thread: Getting RTL8188 to work with Kali in monitor mode

  1. #1
    Join Date
    2017-Sep
    Posts
    3

    Getting RTL8188 to work with Kali in monitor mode

    tldr: RTL8188 now works in Kali 2017.2 with monitor mode support. "Some assembly required" (although not that kind of assembly)

    The Realtek RTL8188EU(S) chipset is featured in quite a few USB WiFi adapters, including the TP LINK TL-WN722N v2 (but not v1). Until recently, this chipset has not worked well with Kali, but a solution for older kernels was posted on github a while back:

    https://github.com/mfruba/kernel

    Unfortunately, this solution only works on kernel version 4.9 and 4.10 (and possibly 4.11), whereas the latest Kali (2017.2) uses the 4.12 kernel.

    I have now managed to get that driver compiled and running on the 4.12 kernel and can confirm that monitor mode absolutely works. In order to do so, two source files must be changed, but it really isn't difficult for anyone who knows their way around an editor.

    Please note that the code snippets below aren't original. They were pretty much pulled straight from other github Realtek WiFi driver projects after going sifting through their bug fixes for kernel 4.12 related issues (several projects with more or less identical changes, seemingly independent). Attribution: https://patchwork.kernel.org/patch/9714419/

    Don't be discouraged by the superficial complexity. This really is only a matter of changing a few lines of code and typing in a handful of commands in the terminal. If there are any questions, please ask and I'll do my best to help.

    Steps to get RTL8188EUS working on linux kernel 4.12

    1. Download source from https://github.com/mfruba/kernel and cd to kernel-master/drivers/TL-WN722N_v2.0-Ralink/rtl8188EUS_linux_v4.3.0.8_13968.20150417

    2. Install kernel headers (if you don't, you'll get the errors paladin gets above)
    Code:
    # apt-get install linux-headers-amd64
    3. MODIFY CODE for 4.12 kernel. This may sound intimidating, but in reality it consists of just a few lines in two files (use whatever editor you wish):
    Makefile --> Add the following line somewhere among the other EXTRA_CFLAGS
    (Or patch with this diff: Makefile.diff.txt)
    Code:
    EXTRA_CFLAGS += -Wno-incompatible-pointer-types
    os_dep/linux/ioctl_cfg80211.c --> Find the section that starts with:
    (Or patch with this diff: ioctl_cfg80211.diff.txt)
    Code:
    if (rtw_to_roam(padapter) > 0) {
    (line 854)
    and ADD the following line of code
    Code:
    struct cfg80211_roam_info roam_info = {};
    (good practice would be to add it among the other definitions, so e.g. after the u16 channel = .... line)
    finally, a bit of code a few lines further down in the same file needs to be replaced.
    DELETE (or comment out) the following lines of code:
    Code:
    cfg80211_roamed(padapter->pnetdev
    			#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE)
    			, notify_channel
    			#endif
    			, cur_network->network.MacAddress
    			, pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2
    			, pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2
    			, pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6
    			, pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6
    			, GFP_ATOMIC);
    and ADD the following lines instead:
    Code:
    roam_info.channel = notify_channel;
    roam_info.channel = notify_channel;
    roam_info.bssid = cur_network->network.MacAddress;
    roam_info.req_ie = pmlmepriv->assoc_req+sizeof(struct ieee80211_hdr_3addr)+2;
    roam_info.req_ie_len = pmlmepriv->assoc_req_len-sizeof(struct ieee80211_hdr_3addr)-2;
    roam_info.resp_ie = pmlmepriv->assoc_rsp+sizeof(struct ieee80211_hdr_3addr)+6;
    roam_info.resp_ie_len = pmlmepriv->assoc_rsp_len-sizeof(struct ieee80211_hdr_3addr)-6;
    cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC);
    4. Compile and install:
    Code:
    # make
    # make install
    There should be no errors, although there are a few warnings. It does take a little bit of time, so be patient.

    5. Load dependent modules, as per the original instructions (won't hurt, but these should already be loaded).
    Code:
    # modprobe lib80211
    # modprobe cfg80211
    6. Insert the newly compiled module into the kernel:
    Code:
    # insmod 8188eu.ko
    7. If there was already a driver loaded for the RTL8188EUS device, remove it. This could possibly be done before inserting the module into the kernel, in which case you might not have to remove and reinsert the device to get the newly compiled module bound to the device. To verify which kernel module (driver) is being used, you can install and use lshw:
    Code:
    # apt-get install lshw
    # lshw -c net
    Find the right networking device and look under "configuration". It should say "driver=rtl8188eu". If it says "r8188eu" that's the old one. Remove it:
    Code:
    # modprobe -r r8188eu
    Removing and reinserting the device might be necessary to get the kernel to bind the new driver. There are other ways to do it, but this is fairly foolproof. Verify with lshw that the correct driver is being used.

    THAT'S IT!

    Tested on a clean install of "Kali 64 bit 2017.2" dd'ed to a USB drive with an additional partition added for persistence and booted in persistence mode. Switching to monitor mode works and functions as intended. Changes, settings, and full functionality survive boot.[/quote]
    Makefile.diff.txt
    Last edited by qmech; 2017-10-19 at 09:21. Reason: minor formatting, attribution, diff files

  2. #2
    Join Date
    2016-Dec
    Posts
    806
    If you can provide a diff, it will be a lot easier and less error-prone from inexperienced users. Applying diff/patch is super easy.

  3. #3
    Join Date
    2017-Sep
    Posts
    3
    Quote Originally Posted by Mister_X View Post
    If you can provide a diff, it will be a lot easier and less error-prone from inexperienced users. Applying diff/patch is super easy.
    For a few lines of code, I'm not convinced that someone completely new to programming would find it easier to apply a diff. Easier to just copy and paste a few lines.

    The diffs are nice for more experienced users and should have been included, so I've updated the post with diffs.

  4. #4
    Join Date
    2017-Oct
    Posts
    2
    Hello,

    I'm new to Kali and pen testing, I use Linux for some time but I still consider myself a beginner.

    I'm struggling to make my WN722N v2 work, and after a couple of days I still don't manage.

    I tried first on kali 2017.2 live usb installation, when I ran
    Code:
    # apt-get install linux-headers-amd64
    I got (4.13+86+kali1) headers which is why I suppose it wouldn't compile in the beginning.
    Code:
    # make
    "******************************************"
    "NO SKRC,we will use default KSRC"
    "******************************************"
    make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/4.12.0-kali1-amd64/build M=/root/Downloads/kernel-master/drivers/TL-WN722N_v2.0-Ralink/rtl8188EUS_linux_v4.3.0.8_13968.20150417  modules
    make[1]: *** /lib/modules/4.12.0-kali1-amd64/build: No such file or directory.  Stop.
    Makefile:1370: recipe for target 'modules' failed
    make: *** [modules] Error 2
    I made a link to new headers, and I managed to compile but then I couldn't insert 8188eu.ko module into the kernel. Probably because headers and kernel have to be the same version (?)

    Then I tried to update my kernel but without success. I tried everything

    Code:
    # apt-get update
    # apt-get upgrade
    # apt-get dist-upgrade
    # apt-get full-upgrade
    I tried also installing another linux image, but couldn't make kali boot it, although it showed on the list of images. Whatever I did, I kept getting
    Code:
    # uname -r
    4.12.0-kali1-amd64
    I don't understand if I did something wrong or it isn't possible to upgrade kernel with live USB, but I guess I'll make another post to find that out...

    Anyways, after failing to update kernel I made another live USB with weekly release W43, where headers corresponded the kernel version, and I did manage to compile and insert the module but WN722N won't go to monitor mode. So, I guess it doesn't work with v 4.13 ?

    In the meantime I ordered another WiFi card, but I'm still curious to know if it is possible to make WN722N work and if I did something wrong for the sake of learning

    Any help would be highly appreciated

    Thanks in advance

  5. #5
    Join Date
    2017-Oct
    Posts
    1
    you need manual install linux headers amd64 for 4.12
    here
    http://http.kali.org/kali/pool/main/l/linux/

  6. #6
    Join Date
    2017-Oct
    Posts
    2
    Thanks for your reply pogo !

    I've installed the headers for 4.12 and I've recompiled everything and managed to insert 8188eu.ko into the kernel, however I still can't put my card in monitor mode... :/

    When I type lshw -c net, I get

    Code:
    # lshw -c net
      *-network                 
           description: Ethernet interface
           product: RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
           vendor: Realtek Semiconductor Co., Ltd.
           physical id: 0
           bus info: pci@0000:02:00.0
           logical name: eth0
           version: 02
           serial: 00:1e:33:71:ae:12
           size: 10Mbit/s
           capacity: 100Mbit/s
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
           configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s
           resources: irq:26 ioport:2000(size=256) memory:d0410000-d0410fff memory:d0400000-d040ffff
      *-network:0
           description: Wireless interface
           physical id: 2
           bus info: usb@6:2
           logical name: wlan0
           serial: d4:6e:0e:16:ea:8d
           capabilities: ethernet physical wireless
           configuration: broadcast=yes driver=rtl8188eu multicast=yes wireless=unassociated
      *-network:1
           description: Wireless interface
           physical id: 3
           bus info: usb@6:6
           logical name: wlan1
           serial: 62:23:1c:4e:91:33
           capabilities: ethernet physical wireless
           configuration: broadcast=yes driver=rtl8187 driverversion=4.12.0-kali1-amd64 firmware=N/A link=no multicast=yes wireless=IEEE 802.11
    So this should mean that the driver is good, right ?

    However, when I type airmon-ng, I get

    Code:
    # airmon-ng
    
    PHY	Interface	Driver		Chipset
    
    phy2	wlan0		??????		 
    phy1	wlan1		rtl8187		Realtek Semiconductor Corp. RTL8187B
    Anyone has an idea what I am doing wrong ?

    Thanks in advance

  7. #7
    I am having the same problem

    root@kali:~/Downloads/kernel-master/drivers/TL-WN722N_v2.0-Ralink/rtl8188EUS_linux_v4.3.0.8_13968.20150417# airmon-ng

    PHY Interface Driver Chipset

    phy0 wlan0 iwlwifi Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)
    phy1 wlan1 ??????


    root@kali:~/Downloads/kernel-master/drivers/TL-WN722N_v2.0-Ralink/rtl8188EUS_linux_v4.3.0.8_13968.20150417# uname -r
    4.13.0-kali1-amd64

  8. #8
    Join Date
    2017-Oct
    Posts
    1
    what is the wifi card that you are using now

  9. #9
    Join Date
    2017-Oct
    Posts
    1
    I still getting "r8188eu" i cant remove im going to reinstall all the system to stay clean an i will use 4.12 , i use right now 4.13

  10. #10
    Join Date
    2013-Apr
    Posts
    15
    I simply added the "working" driver to https://github.com/kimocoder/rtl8188eu for simple patching reasons.
    Supports kernel v4.13 + Makefile addition added, but as I've said in the bugtracker, this is a dirty driver.

  11. #11
    Join Date
    2017-Nov
    Posts
    1
    Hey guys, could use your help on this one. I usually try to solve everything myself and i've been successful until now, linux.. and this driver, man it drives me crazy :P

    So i've been trying to follow everything you've said and i tried like every method there is on youtube. But i feel like this one is the one, except. I can't make anything out of it.

    How do i even enter the conf file for the kernel? Or applying the patch?

    Looked around for tutorials and guides but i don't know. I just don't get it, but i can't give up either, so.. help a brother out?
    Going to get the v1 from ebay, but it will take a couple of weeks i could've learned alot more about this.

    Regards, GhostMuppet

  12. #12
    Join Date
    2017-Nov
    Posts
    1
    I feel dumb, but I've gotten pretty far I think I'll be ok if someone could kindly explain just a little bit more in depth WHERE I would find the file that I can open to edit for this part:

    3. MODIFY CODE for 4.12 kernel. This may sound intimidating, but in reality it consists of just a few lines in two files (use whatever editor you wish):
    Makefile --> Add the following line somewhere among the other EXTRA_CFLAGS

  13. #13
    Join Date
    2018-Jan
    Posts
    1
    hi,
    after you download the github repo type:
    $cd kernel/drivers/TL-WN722N_v2.0-Ralink/rtl8188EUS_linux_v4.3.0.8_13968.20150417
    then if you do ls you will see Makefile. You have to edit this one.

    UPDATE:
    I have a question.
    hum does it exist a compatible version of the driver with the kernel 4.14.0 ?
    thanks.
    Last edited by maiki; 2018-01-04 at 10:27. Reason: Merge Posts

  14. #14
    would be great if 4.14 would work as well.

  15. #15
    Join Date
    2018-Jan
    Posts
    1
    I just used the driver of kimocoder ( https://github.com/kimocoder/rtl8188eu ).

    Just downloaded, make, make install, rmmod r8188eu, insmod 8188eu.ko

    airmon-ng still had problems with monitor mode, but I was able to enter monitor mode via

    ifconfig wlan0 down
    iwconfig wlan0 mode monitor
    ifconfig wlan0 up

    airodump worked fine.

    uname -r
    4.14.0-kali3-amd64

    lshw showed the weird ??? at driver but whatever.

    Thank you kimocoder at this point.

  16. #16
    Sir not understood from step -2 please tell me detailed

  17. #17

    Question

    Quote Originally Posted by b4551k5 View Post
    I just used the driver of kimocoder ( https://github.com/kimocoder/rtl8188eu ).

    Just downloaded, make, make install, rmmod r8188eu, insmod 8188eu.ko

    airmon-ng still had problems with monitor mode, but I was able to enter monitor mode via

    ifconfig wlan0 down
    iwconfig wlan0 mode monitor
    ifconfig wlan0 up

    airodump worked fine.

    uname -r
    4.14.0-kali3-amd64

    lshw showed the weird ??? at driver but whatever.

    Thank you kimocoder at this point.
    At this point the Mode is "Auto," and no programs or scripts recognize the adapter as being in Monitor mode. Albeit, this process you gave DID allow my adapter to be recognized as an interface, but the problem i described was unchanged.

  18. #18
    Join Date
    2018-Feb
    Posts
    1
    Hi, everybody. I have TP-LINK WN722N V.3.0, and this manual is working for it. But I have a question. After changing of driver, the device works in monitor mode. And does it support injections after such upgrade? Will be thankful for answer.

  19. #19
    Join Date
    2018-Feb
    Posts
    1
    Please how can i install airdrop-ng on kali 2018... I tried installing the requirment lorcon but its giving me error message..... Please guild me

  20. #20
    Join Date
    2018-Feb
    Posts
    1
    It worked for a moment.
    I could set monitor mode and even scan signals with airodump, but it crashed after some minutes and I couldn't get it back again (maybe I could, resetting the VM, but I decided to return the product and buy another device).

  21. #21
    Join Date
    2018-Mar
    Posts
    1

    and now????

    # airmon-ng start wlan0

    Found 4 processes that could cause trouble.
    If airodump-ng, aireplay-ng or airtun-ng stops working after
    a short period of time, you may want to run 'airmon-ng check kill'

    PID Name
    514 NetworkManager
    610 wpa_supplicant
    631 dhclient
    5384 dhclient

    PHY Interface Driver Chipset

    phy0 wlan0 ??????
    cat: /sys/class/ieee80211/phy0/device/net/wlan0mon/type: File o directory non esistente

    Newly created monitor mode interface wlan0mon is *NOT* in monitor mode.
    Removing non-monitor wlan0mon interface...

    WARNING: unable to start monitor mode, please run "airmon-ng check kill"

  22. #22
    Join Date
    2018-Apr
    Posts
    1

    Hhhhhhhheeeelllllpppppp!!!!!!!!!

    can someone please please PLEASE help me i brought a thinkpad e545 with a broadcom chipset, after three weeks of trying to get the driver to send packets (not possible sfter so many people saying it was and so many people saying it wasnt) i found out that yeah its not possible. So i brought a TP-LINK TL-WN722N witch forums say its plau and play so after three weeks of faffing about it sounded like a good bet. after 5 operating systems later (ubuntu, fedora 27, elementary, mint and now kali) i have found out it is not plug and play. i can get the internet but no monitor mode. i have tried every tutorial word for word but still no joy. when i try and install ther master driver given in the discription i still have errors about fail to create module files and this is what i get when trying to put the device in monitor mode

    lewis@kali:~$ iwconfig
    eth0 no wireless extensions.

    wlan1 unassociated ESSID:"" Nickname:"<WIFI@REALTEK>"
    Mode:Managed Frequency=2.412 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

    wlan0 IEEE 802.11 ESSID:"VM8555177"
    Mode:Managed Frequency:2.412 GHz Access Point: 40:0D:10:FA:AB:21
    Bit Rate=72 Mb/s Tx-Power=200 dBm
    Retry short limit:7 RTS thr:off Fragment thr:off
    Power Management:off
    Link Quality=70/70 Signal level=-40 dBm
    Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
    Tx excessive retries:0 Invalid misc:0 Missed beacon:0

    lo no wireless extensions.

    lewis@kali:~$ airmon-ng
    Run it as root
    lewis@kali:~$ sudo su
    root@kali:/home/lewis# cd
    root@kali:~# airmon-ng

    PHY Interface Driver Chipset

    phy0 wlan0 wl Broadcom Limited BCM43142 802.11b/g/n (rev 01)
    null wlan1 r8188eu

    root@kali:~# ifconfig wlan1 down
    root@kali:~# iwconfig wlan1 mode monitor
    Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan1 ; Invalid argument.
    root@kali:~# uname -r
    4.15.0-kali2-amd64
    root@kali:~#

    can anyone give me a step by step guide including a guide inserting the EXTRA_FLAGS many thanks i'm very much looking forward to the help
    Last edited by maiki; 2018-04-12 at 07:14. Reason: Disabled smilies in text

  23. #23
    Join Date
    2018-Nov
    Posts
    1
    Does this work in latest Kali Linux

  24. #24
    Join Date
    2016-Dec
    Posts
    806
    Tanuj-dd, give it a try, you'll see.

  25. #25
    Join Date
    2019-Feb
    Posts
    1
    Use this driver: https://github.com/kimocoder/rtl8188eus

    It works on the newest Kali, supports monitor mode and packet injection, at least as far as this:

    [root] [~] # aireplay-ng -9 wlan021:26:01 Trying broadcast probe requests...
    21:26:02 Injection is working!
    Didn't test it further for now.

    Also there's this issue: https://github.com/aircrack-ng/aircrack-ng/issues/1736 which seems to be solved in this driver:

    airodump-ng wlan0
    CH 1 ][ Elapsed: 33 mins ][ 2019-02-10 21:31 ][ WPA handshake: 00:26:5A:22:AF:B8
    And it still goes on.

    The driver may not see your card out-of-the-box. If it doesn't, use this manual:
    https://github.com/kimocoder/rtl8812...re_VidPids.pdf to add Vendor ID of your device. You can find some VIDs here:
    https://github.com/quickreflex/rtl81...nux/usb_intf.c

    Personally I had to add this line for my TP-Link TL-WN722N v3:

    {USB_DEVICE(0x2357, 0x010c),.driver_info = RTL8188E}, /* TP-Link TL-WN722N v2 */

Similar Threads

  1. Nexus 5 - Can't get monitor mode to work
    By pispuso in forum NetHunter General Questions
    Replies: 7
    Last Post: 2020-10-24, 00:09
  2. Replies: 1
    Last Post: 2020-10-07, 08:55
  3. Replies: 11
    Last Post: 2019-01-15, 14:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •