Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Aircrack-ng with compat wireless


I recently bought an Asus 1001p. I got home and immediately installed Ubuntu Netbook Remix on it. Unfortunately my wireless chipset was not supported in the current kernel so I had to use the bleeding edge compat-wireless drivers. After successfully installing the drivers I ran into a problem using airodump-ng and aireplay-ng. It kept saying my interface was stuck in a perhaps hypothetical -1 channel and i kept receiving the error "fixed channel mon0: -1". After a bit of research I have a fix for Ubuntu (should work on other distros aswell) so i though i should share it.

NOTE: Make sure you have build-essential.

First I had to edit a few lines of an existing patch for a similar problem. Here is a link to my version of the patch but the contents are below anyway:

--- chan.c.orig
+++ chan.c
@@ -49,9 +49,12 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,
{
struct ieee80211_channel *chan;
int result;
+ struct wireless_dev *mon_dev = NULL;

- if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
+ if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) {
+ mon_dev = wdev;
wdev = NULL;
+ }

if (wdev) {
ASSERT_WDEV_LOCK(wdev);
@@ -76,5 +79,8 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,
if (wdev)
wdev->channel = chan;

+ if (mon_dev)
+ mon_dev->channel = chan;
+
return 0;
}

Save it and copy it into the same directory as the compat wireless chan.c file. Mine was in ~/compat*/net/wireless but you can do a search with something like the below to find it.
sudo find / -name chan.c -print
Now open a terminal and navigate to the directory where chan.c and the patch are located. Run (I had to use sudo because the owner was root as i had already edited the file as root):
sudo patch -p0 -i < watevaucalledthepatch.patch
Now if you had to run the above command with root privileges (like me) then run the below to restore the file permissions. Replace userhere in the first line below with your user name:
sudo chown userhere:userhere chan.c
sudo chmod 777 chan.c
It should now be patched successfully with the right permissions. All you need to do now is recompile and unload the old drivers. Navigate into the base directory of compat wireless (mine was ~/compat*). I ran the below to select the ath9k drivers but you may have to do different depending on your chipset:
./scripts/driver-select ath9k
Now run the below to build:
make
sudo make install
And unload the old drivers:
sudo make unload
sudo make wlunload
You may or may not have to run the below, it won't hurt if you do.
sudo make btunload
Now reboot or alternatively run the below replacing driverhere with your driver:
sudo modprobe driverhere
Everything should be in working order and the problem fixed. I can now crack WEP in minutes and catch a handshake in a matter of seconds. Hope this helped anyone suffering with the same problem.

Why use Linux?

Even as a fairly new Linux user, I always receive the comment "Why do you use Linux". A lot of my friends think it's the worst operating system in the world. "It's so hard to use","You can't do anything on it", "It doesn't support any hardware" they say. The truth is; I don't know why I use it, I just love it. The fact is, it's faster, free and 99% of the applications made for it are open source. It looks better, I find it more compatible and if you program at all you will most probably find it 10 times better than any other operating system. Don't get me wrong, I like Microsoft Operating Systems (I have never been into Macs.... Bit of a ripoff in my opinion). I still use Windows to play all my games and do all my word processing. Sure there's wine (a Windows file system and registry emulator) but i just prefer to do those things on Windows. As for browsing, I don't care what OS I'm using, they both have IM clients and they both have my two favorite browsers (Chrome and Firefox). I get annoyed when people say they hate Windows, it's not a bad OS. It's probably the most user friendly OS available. People need to stop saying it's crap.

As for the question which one is better; I have to say Linux but only because of the applications i run. If I were a pro gamer, I would use Windows. If I was a hobby programmer, I would use Linux. It's as simple as that.