/ath-pentest

Fixes to Atheros driver kernel modules for pentesting and non-standard usage

ath-pentest

Patches to Atheros driver kernel modules for pentesting and non-standard usage

Features in ath.ko

  • EEPROM country code override to custom or default (module option)
  • All standard channels enabled
  • Power maxed to 30
  • NO-IR/RADAR removed

Features in ath9k.ko, ath9k_common.ko, ath9k_htc.ko, ath9k_hw.ko

  • Power maxed to 30
  • Carrier sense disabled for ath9k, ath9k_htc (module option) NOTE: this will probably make normal Wi-Fi difficult. I use it only for RF tests.

Usage

Everything below was tested on Debian (buster).
I am building only ath* modules, not complete kernel.
These steps are suitable for my configuration. You should adjust them for yours.
You will need additional packages (as a minimum "build-essential") if they are not already installed.

Supposing you are working with some version of 4.19 kernel.

git clone https://github.com/RandDruid/ath-pentest.git
sudo apt-get install linux-source-4.19 linux-headers-$(uname -r)
tar xaf /usr/src/linux-source-4.19.tar.xz
mv linux-source-4.19 linux-source-4.19-patched
patch -p1 -d linux-source-4.19-patched < ath-pentest/ath_pentest_k4.19.diff
cd linux-source-4.19-patched
cp /boot/config-$(uname -r) .config
cp /usr/src/linux-headers-$(uname -r)/Module.symvers .
make prepare
make scripts
make M=drivers/net/wireless/ath/

Backup and push to the kernel tree.

mkdir -p ~/ath_backup/ath9k
sudo su
cp $(dirname $(modinfo -n ath))/ath.ko ~/ath_backup/
cp $(dirname $(modinfo -n ath9k))/*.ko ~/ath_backup/ath9k/
cp drivers/net/wireless/ath/ath.ko $(dirname $(modinfo -n ath))/
cp drivers/net/wireless/ath/ath9k/*.ko $(dirname $(modinfo -n ath9k))/

I put all my options into one file. Make it available for modprobe.

sudo cp ath.conf /etc/modprobe.d/

Patch file was created like this

diff -rup linux-source-4.19/drivers/net/wireless/ath linux-source-4.19-patched/drivers/net/wireless/ath | grep -v '^Only in' > ath_pentest_k4.19.diff

Inspired by:
https://github.com/hatsunearu/EZ-WifiBroadcast/blob/master/Patches/ez-wifibroadcast-1.4-kernel-4.4-patches.diff
https://gist.github.com/BigNerd95/0be0a5b52a16524a78fc768f0d208a74#file-regd_diff-c