Jump to content

Feature Request. Disable Wireless


bobtheman
 Share

Recommended Posts

  • 1 month later...

EDIT: I've change the commands given by start/stopwlan.php, instead of ifconfig i used wifi so the monitor interface will be started/shutdown as well. Complete WiFi silence when turned off ;)

I updated the index.php myself :)

Here's what you do ;)

Use your favorite texteditor to edit this file:

/www/pineapple/index.php

Look for this piece of code:

$iswlanup = exec("ifconfig wlan0 | grep UP | awk '{print $1}'");
if ($iswlanup == "UP") {
echo " Wireless  <font color=\"lime\"><b>enabled</b></font>.<br />";
} else { echo " Wireless  <font color=\"red\"><b>disabled</b></font>.<br />"; }

comment the code so it doesn't work anymore, because we are going to make some "new" code

change it so it looks like this: (note the /* above and the */ under the code)

/*
$iswlanup = exec("ifconfig wlan0 | grep UP | awk '{print $1}'");
if ($iswlanup == "UP") {
echo " Wireless  <font color=\"lime\"><b>enabled</b></font>.<br />";
} else { echo " Wireless  <font color=\"red\"><b>disabled</b></font>.<br />"; }
*/

Add the following code under the code you just commented:

if ( exec("ifconfig wlan0 | grep UP | awk '{print $1}'") == "UP" ){
$iswlanup = true;
}
if ($iswlanup != "") {
echo " Wireless  <font color=\"lime\"><b>enabled</b></font>.  | <a href=\"config/stopwlan.php\"><b>Stop</b></a><br />";
} else { echo " Wireless  <font color=\"red\"><b>disabled</b></font>. | <a href=\"config/startwlan.php\"><b>Start</b></a> <br />"; }

Save your index.php

Now we are almost there but we need to make two more files.

Create a file called startwlan.php and add follwing code:

<?php
exec ("wifi");
?>
<html><head>
<meta http-equiv="refresh" content="0; url=/pineapple/">
</head><body bgcolor="black" text="white"><pre>
<?php
echo "Wireless started";
?>
</pre></head></body>

And create a file called stopwlan.php and add following code:

<?php
exec("wifi down");
?>
<html><head>
<meta http-equiv="refresh" content="0; url=/pineapple/">
</head><body bgcolor="black" text="white"><pre>
<?php
echo "Wireless disabled";
?>
</pre></head></body>

Copy the files startwlan.php and stopwlan.php to /www/pineapple/config/

Refresh your Status page and voila! :D

There are probably much easier and cleaner ways to do this, but it works and i wanted to contribute ;)

Some screenies :D

post-28797-0-26711600-1335368545_thumb.p

post-28797-0-40009300-1335368553_thumb.p

Edited by WatskeBart
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...