Notices


Reply
Thread Tools
jd4200's Avatar
Posts: 451 | Thanked: 424 times | Joined on Apr 2010 @ England
#71
My bash scripting skills are still in the early stages, but I created two scripts which are executed by QueenBeecon widgets to put the card in and out of monitor mode, and loads and unloads the drivers (just in case anyone else finds them useful):

Clicking widgets changes the states, screeny of it:


Code:
#!/bin/sh
# You'll either need execute this script as root, or allow user to
# use ifconfig/iwconfig in the sudoers file (which is my method)

mode=$(/sbin/iwconfig wlan0 |grep Mode |awk -F : '{print $2'} |awk '{print $1}')
if [[ "$mode" == "Managed" ]]; then

sudo /sbin/ifconfig wlan0 down
sudo /sbin/iwconfig wlan0 mode Monitor
sudo /sbin/ifconfig wlan0 up

echo "Monitor"
exit 1

elif [[ "$mode" == "Monitor" ]]; then

sudo /sbin/ifconfig wlan0 down
sudo /sbin/iwconfig wlan0 mode Managed
sudo /sbin/ifconfig wlan0 up

echo "Managed"
exit 2

else
echo "state error"
exit 127
fi
The driver loader/unloader is here

Anyone have any tips on how to improve it?

As the drivers are unloaded on reboot, I had to use a "state_file" to keep track of whether they are loaded or not during up-time, and before a reboot or shutdown occurs the state_file is set back to "unloaded".
(Not sure what would happen if the phone loses battery power and turns off though)

Last edited by jd4200; 2011-01-14 at 01:44.
 

The Following 3 Users Say Thank You to jd4200 For This Useful Post:
Posts: 3,664 | Thanked: 1,530 times | Joined on Sep 2009 @ Hamilton, New Zealand
#72
would be nice if this wasn't running with powerkernel. I would prefered stock kernel instead.
 
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#73
Originally Posted by maxximuscool View Post
would be nice if this wasn't running with powerkernel. I would prefered stock kernel instead.
Why? Power Kernel is stock kernel + happiness + sunshine + rainbows + cure for AIDS/cancer/Parkinsons + solving world hunger.

Not really, but it's basically the same thing, plus extra stuff which is better. If you WANT to overclock/undervolt, it can do that, but there's a bunch of other stuff it does that the stock kernel doesn't do, that has nothing to do with dangers like that - but many are things I'd say are required for anything claiming itself to be a 'mobile computer'. (IPv6 support - everything is starting to slowly shift to supporting it/using it ; iptables, etc, allowing for very effective firewall-ing; and a bunch of other modules which I don't remember, but are actually useful - like the thing that enables getting battery temperature, the module for USB-internet, etc).

jd4200: I don't have any suggestions right off the top of my head, other than using "lsmod | grep [name of module]" to check if a certain module is loaded, instead of saving the state inside a file (less writes to flash chip, and avoids your sudden-reboot/shutdown/battery-flies-out problem).

The modules loaded with the current version of injection driver are different than the modules loaded with the stock driver.

(Also: Holy **** that's an N900 desktop? That's customized beyond recognition. Looks like I've been REALLY out of date when it comes to desktop/widget/theme changes.)
 
jd4200's Avatar
Posts: 451 | Thanked: 424 times | Joined on Apr 2010 @ England
#74
Originally Posted by Mentalist Traceur View Post
Why? Power Kernel is stock kernel + happiness + sunshine + rainbows + cure for AIDS/cancer/Parkinsons + solving world hunger.
Shame it can't roll a cigarette though. Stupid Power Kernel. Stupid.

jd4200: I don't have any suggestions right off the top of my head, other than using "lsmod | grep [name of module]" to check if a certain module is loaded, instead of saving the state inside a file (less writes to flash chip, and avoids your sudden-reboot/shutdown/battery-flies-out problem).
Cool, thanks. I thought it was loading different modules but under the same name, so I didn't bother with that route.
I'll have a looksie.

Last edited by jd4200; 2011-01-14 at 02:31.
 
Posts: 3,664 | Thanked: 1,530 times | Joined on Sep 2009 @ Hamilton, New Zealand
#75
@Mentalist,
Agreed but PowerKernel is not always reliable in term of stability when new PR is released. And I'm happily with the Stock Kernel for the Mo after reflashed and found that my N900 is did not have the infamous issues with processor spikes after 24hours. So I think i'm staying for now, and some apps will not work with Power Kernel.

Is Joikuspot work with this kernel46? Heard that it didn't in the previous version though.
 
Posts: 435 | Thanked: 197 times | Joined on Feb 2010
#76
Originally Posted by Mentalist Traceur View Post
Nothing 'out there' ever reports itself as having an 192.168.something.something address to the outside world.
The easy way to know what your 'outside' IP is is by going to www.whatismyip.com or something like that.
First off, thanks alot, made a lot of sense, even looked it up (even as something simple like http://www.192168ip.com ,lol). Now i have a question, is there currently a widget that displays your "outside" IP on connection?

Originally Posted by jd4200 View Post
Clicking widgets changes the states, screeny of it:
That is indeed an interrested desktop, is that all QueenBeecon? If not, would you mind sharing the name of the widget? Particulary interrested in wireless mode and inject modules.
 
Posts: 539 | Thanked: 518 times | Joined on May 2010 @ nanaurbusiness
#77
Originally Posted by jd4200 View Post
My bash scripting skills are still in the early stages, but I created two scripts which are executed by QueenBeecon widgets to put the card in and out of monitor mode, and loads and unloads the drivers (just in case anyone else finds them useful):

Clicking widgets changes the states, screeny of it:


Code:
#!/bin/sh
# You'll either need execute this script as root, or allow user to
# use ifconfig/iwconfig in the sudoers file (which is my method)

mode=$(/sbin/iwconfig wlan0 |grep Mode |awk -F : '{print $2'} |awk '{print $1}')
if [[ "$mode" == "Managed" ]]; then

sudo /sbin/ifconfig wlan0 down
sudo /sbin/iwconfig wlan0 mode Monitor
sudo /sbin/ifconfig wlan0 up

echo "Monitor"
exit 1

elif [[ "$mode" == "Monitor" ]]; then

sudo /sbin/ifconfig wlan0 down
sudo /sbin/iwconfig wlan0 mode Managed
sudo /sbin/ifconfig wlan0 up

echo "Managed"
exit 2

else
echo "state error"
exit 127
fi
The driver loader/unloader is here

Anyone have any tips on how to improve it?

As the drivers are unloaded on reboot, I had to use a "state_file" to keep track of whether they are loaded or not during up-time, and before a reboot or shutdown occurs the state_file is set back to "unloaded".
(Not sure what would happen if the phone loses battery power and turns off though)
Really nice work. Do I just have to put the code into the command field of a new QBWidget or do I need to create a script and let QBW simply start it.

thx in advance,

..::J4ZZ::..
 
jd4200's Avatar
Posts: 451 | Thanked: 424 times | Joined on Apr 2010 @ England
#78
Originally Posted by IsaacDFP View Post
Fi

That is indeed an interrested desktop, is that all QueenBeecon? If not, would you mind sharing the name of the widget? Particulary interrested in wireless mode and inject modules.
It's all QueenBeecon, apart from the data counter at the top (data-plan-monitor).

Originally Posted by J4ZZ View Post
Really nice work. Do I just have to put the code into the command field of a new QBWidget or do I need to create a script and let QBW simply start it.

thx in advance,

..::J4ZZ::..
I'm new to QueenBeecon, so I may be doing this wrong, but:


Then put the scripts below into:

/home/user/MyDocs/wl1251-maemo/binary/compat-wireless/

(or wherever your driver folder is, if it's different make sure you change the location in the above QueenBeecon config files).


Code:

Interface status
For this to work you need to give your self permissions to use iwconfig/ifconfig to change the interface properties which normally require root privallages.

So add the following to /etc/sudoers:
user ALL = NOPASSWD: /sbin/ifconfig
user ALL = NOPASSWD: /sbin/iwconfig

You must edit that file with "vi" (use the command visudo).
Don't use any other text editor, they can screw with the file, seriously messing things up.
Code:
Load/Unload modules.
Don't bother with this one yet, it's not working right. I'll update it when I figure it out.
For this one to work you have to create a "state_file" to keep track of whether the modules are unloaded or loaded.
So, create a new file called "state_file" in /tmp/ (nano /tmp/state_file), and then write "Unloaded" into the file and save it. (If you have them loaded, the write "Loaded" into it).

To make sure this file is recreated on reboot, add the following:

echo "Unloaded" > /tmp/state_file

to this files:
 /etc/event.d/hildon-desktop
A bit messy really to accomplish something simple. I'm new to bash, so I'll have a look later to see if I can get it to work without have to mess with the sudoers file, or use the state_file.

Last edited by jd4200; 2011-01-14 at 20:34.
 
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#79
If you put the state_file to into /tmp/whatever it won't get saved to disk (well, unless it's swapped, then it's saved to the swap partition), and then you're avoiding a decent amount of flash wear. You can then also always put a script in /etc/init.d/ or /etc/event.d/ that would create the state_file, with the value of 'unloaded' upon ever boot, so that you don't have conflicts between surviving state_files left over from unexpected system crashes/power-offs. (actually, you can do the latter without the former, to set the value of state_file to unloaded at boot.)
 
jd4200's Avatar
Posts: 451 | Thanked: 424 times | Joined on Apr 2010 @ England
#80
Originally Posted by Mentalist Traceur View Post
If you put the state_file to into /tmp/whatever it won't get saved to disk (well, unless it's swapped, then it's saved to the swap partition), and then you're avoiding a decent amount of flash wear. You can then also always put a script in /etc/init.d/ or /etc/event.d/ that would create the state_file, with the value of 'unloaded' upon ever boot, so that you don't have conflicts between surviving state_files left over from unexpected system crashes/power-offs. (actually, you can do the latter without the former, to set the value of state_file to unloaded at boot.)
Thanks! I've changed it so the file is moved to /tmp/.
 
Reply

Tags
aircrack, aircrack-ng, tutorial

Thread Tools

 
Forum Jump


All times are GMT. The time now is 12:09.