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.
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)
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):Code:# apt-get install linux-headers-amd64
Makefile --> Add the following line somewhere among the other EXTRA_CFLAGS
(Or patch with this diff: Makefile.diff.txt)
os_dep/linux/ioctl_cfg80211.c --> Find the section that starts with:Code:EXTRA_CFLAGS += -Wno-incompatible-pointer-types
(Or patch with this diff: ioctl_cfg80211.diff.txt)
(line 854)Code:if (rtw_to_roam(padapter) > 0) {
and ADD the following line of code
(good practice would be to add it among the other definitions, so e.g. after the u16 channel = .... line)Code:struct cfg80211_roam_info roam_info = {};
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:
and ADD the following lines instead: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);
4. Compile and install: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);
There should be no errors, although there are a few warnings. It does take a little bit of time, so be patient.Code:# make # make install
5. Load dependent modules, as per the original instructions (won't hurt, but these should already be loaded).
6. Insert the newly compiled module into the kernel:Code:# modprobe lib80211 # modprobe cfg80211
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:# insmod 8188eu.ko
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:# apt-get install lshw # lshw -c net
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.Code:# modprobe -r r8188eu
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
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.
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 ranI got (4.13+86+kali1) headers which is why I suppose it wouldn't compile in the beginning.Code:# apt-get install linux-headers-amd64
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 (?)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
Then I tried to update my kernel but without success. I tried everything
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 gettingCode:# apt-get update # apt-get upgrade # apt-get dist-upgrade # apt-get full-upgrade
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...Code:# uname -r 4.12.0-kali1-amd64
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![]()
you need manual install linux headers amd64 for 4.12
here
http://http.kali.org/kali/pool/main/l/linux/
![]()
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
So this should mean that the driver is good, right ?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
However, when I type airmon-ng, I get
Anyone has an idea what I am doing wrong ?Code:# airmon-ng PHY Interface Driver Chipset phy2 wlan0 ?????? phy1 wlan1 rtl8187 Realtek Semiconductor Corp. RTL8187B
Thanks in advance![]()
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
what is the wifi card that you are using now
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
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.
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
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
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
would be great if 4.14 would work as well.
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.
Sir not understood from step -2 please tell me detailed
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.
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
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).
# 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"
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; 1 Week Ago at 07:14. Reason: Disabled smilies in text