#!/bin/bash
# ,___ r2
# ¡ _` wifix
# ª_/() http://pastebin.com/u/noes1s
# |\` `, CC BY-SA 3.0
# _·' l
#___________________________________________________________________________________________________
#Dependencies: sed, wget, patch
#Variables:
ddir=$(pwd)
kernel=$(uname -r |sed -e 's/-.*//')
InstallCompat(){
bl='/etc/modprobe.d/blacklist.conf'
blacklist=(wl)
for d in ${blacklist[*]}; { [[ $(cat $bl | grep $d) ]]|| echo blacklist $d | tee -a $bl ;}
wget http://patches.aircrack-ng.org/channel-negative-one-maxim.patch -O- | patch -Np1
wget http://patches.aircrack-ng.org/mac80211.compat08082009.wl_frag+ack_v1.patch -O- | patch -Np1
wget http://patches.aircrack-ng.org/zd1211rw-inject+dbi-fix-2.6.26.patch -O- | patch -Np0
wget http://patches.aircrack-ng.org/mac80211_2.6.32.2-wl_frag+ack_radiotap.patch -O- | patch -Np1
make && make install && {
MODULES=(
iwlwifi_mac80211 rc80211_simple zd1211rw-mac80211
ieee80211_crypt_tkip ieee80211_crypt_ccmp
ieee80211softmac ieee80211_crypt ieee80211
bcm43xx rndis_wext iwl4965
ipw2100 ipw2200 libipw
wl1251 wl12xx iwmc3200wifi
libertas_cs usb8xxx libertas libertas_sdio libertas_spi
libertas_tf libertas_tf_usb
adm8211 zd1211rw
orinoco_cs orinoco_nortel orinoco_pci orinoco_plx
orinoco_tld orinoco_usb spectrum_cs orinoco
b43 b44 b43legacy brcm80211 ssb
iwl3945 iwlagn iwlcore
ath9k ath9k_htc ath9k_common ath9k_hw
ath5k ath ath6kl ar9170usb carl9170
p54pci p54usb p54spi p54common
rt2400pci rt2500pci rt61pci
rt2500usb rt73usb
rt2800usb rt2800lib
rt2x00usb rt2x00lib
rtl8180 rtl8187 rtl8192ce rtlwifi
mwl8k mac80211_hwsim
at76c50x_usb at76_usb
rndis_wlan rndis_host cdc_ether usbnet
eeprom_93cx6
lib80211_crypt_ccmp lib80211_crypt_tkip lib80211_crypt_wep
mac80211 cfg80211 lib80211
)
IPW3945D="/sbin/ipw3945d-`uname -r`"
if [ -f $IPW3945D ]; then
$IPW3945D --isrunning
if [ ! $? ]; then
echo -n " Detected ipw3945 daemon loaded we're going to "
echo -e " shut the daemon down now and remove the module."
modprobe -r --ignore-remove ipw3945
fi
fi
grep ath_pci /proc/modules 2>&1 > /dev/null
if [ $? -eq 0 ]; then
echo -e "\n MadWifi driver is loaded, going to try to unload it..."
./scripts/madwifi-unload
fi
for i in ${MODULES[*]}; do
grep ^$i /proc/modules > /dev/null
if [ $? -eq 0 ]; then
echo -e "\n Restarting $i module(s)..." && mod=$i
modprobe -r --ignore-remove $i
fi
done
! grep ^$i /proc/modules > /dev/null && modprobe $mod &&
echo -e "\n\e[1;32m Ready! \e[m"
echo -e " Drivers not working? -> Reboot your system.\n" ;} ||
echo -e '\n\e[1;31m (!) Unknown installation error\e[m\n'
cd $ddir
}
Compat(){
cd /tmp
#Kernel 3.0
if [[ $(echo $kernel |cut -c1-3) = 3.0 ]]; then
link="http://www.orbit-lab.org/kernel/compat-wireless-3.0-stable/v$kernel/"
#Kernel 2.6
elif [[ $(echo $kernel |cut -c1-3) = 2.6 ]]; then
link="http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v$kernel/"
fi
package=$(wget -qO- $link | awk '/tar.bz2/{print $6}' | sed -e '$!d;s/.*="//;s/".*//')
dir=$(echo $package | sed 's/*//;s/.tar.bz2.*//')
[[ -e $package ]] && rm $package
[[ -d $dir ]] && rm -rf $dir
wget $link/$package -O- | tar xvj && cd ./$dir && InstallCompat
}
Welcome(){
clear
echo -e "\e[1;31mwi\e[32mfix\e[m"
}
Help(){
Welcome
echo -e " Use: $0 [option]\n
-i : Compat (Install Compat-wireless stable drivers)
-h : Help
Dependencies: sed, wget, patch
Internet connection required!\n"
}
#___________________________________________________________________________________________________
# STARTUP
#___________________________________________________________________________________________________
Welcome && ((UID)) && echo -e "\n\e[1;31m"' (!) '"\e[mUse: sudo bash $0\n" && exit
while getopts "i" execute; do
case ${execute} in
i ) Compat; exit;;
* ) Help; exit ;;
esac
done
Welcome
select opt in Compat Help; { $opt; exit ;}