Results 1 to 25 of 25

Thread: Getting RTL8188 to work with Kali in monitor mode

Threaded View

Previous Post Previous Post   Next Post Next Post
  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

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
  •