Jump to content

Wps Button


Recommended Posts

Hi everyone !

This module adds a new menu entry "Buttons" in the GUI to allow the configuration of the WPS button behavior.

You can add the following actions to the WPS button:

- Toggle Karma

- Toggle DNS Spoof

- Toggle URL Snarf

- Connect SSH

- Reboot

- Run Custom Script (4 custom scripts available)

4 duration can be configured:

- 0-2 Seconds

- 4-6 Seconds

- 8-10 Seconds

- 12+ Seconds

Module is available through module system.

post-38761-0-75915900-1331325544_thumb.p

Edited by Whistle Master
Link to comment
Share on other sites

Whistle Master,

Nice mod!

I have actually added a similar setup for the next release, just that I have no pre-configuration.

You can select what time you want and then modify the script depending on what is selected.

What I should add is that this may break the reset button disable / enable.

I can't try it out right now, but that is something quite important to keep intact.

Thanks for posting it!

Best,

Sebkinne

Link to comment
Share on other sites

Thanks!

I can't wait to see yours in the next release :)

Regarding the reset button enable/disable, I did the following:

each time the button actions are updated, I remove all the button from the system config (system.@button):

	while(exec("uci get system.@button[0]") == "button")
	{
		exec("uci delete system.@button[0]");
	}
	exec("uci commit system");

and I then add again all the button, keeping the reset button for the last position:

for($i=0;$i<4;$i++)
{
	exec("uci add system button");
	exec("uci set system.@button[".$i."].button=reset");
	exec("uci set system.@button[".$i."].action=released");

	if($_wpsx[$i] == 0) $handler = "logger No action";
	else if($_wpsx[$i] == 1) $handler = "php /www/toggle_services.php -karma";
	else if($_wpsx[$i] == 2) $handler = "php /www/toggle_services.php -dnsspoof";
	else if($_wpsx[$i] == 3) $handler = "php /www/toggle_services.php -snarf";
	else if($_wpsx[$i] == 4) $handler = "php /www/toggle_services.php -s";
	else if($_wpsx[$i] == 5) $handler = "reboot";
	else if($_wpsx[$i] == 6) $handler = "sh /www/pineapple/wpsScript.sh";

	exec("uci set system.@button[".$i."].handler='".$handler."'");
	exec("uci set system.@button[".$i."].min=".$_wpsx_min[$i]."");
	exec("uci set system.@button[".$i."].max=".$_wpsx_max[$i]."");
	exec("uci commit system");
}

exec("uci add system button");
exec("uci set system.@button[4].button=wps");
exec("uci set system.@button[4].action=released");
exec("uci set system.@button[4].handler='cp /etc/config/backup/* /etc/config/ && reboot'");
exec("uci set system.@button[4].min=5");
exec("uci set system.@button[4].max=10");
exec("uci commit system");

I had also to modify the resetButton.sh to always remove/add button n°4 as reset button will always be at this position with my implementation.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks!

I can't wait to see yours in the next release :)

Regarding the reset button enable/disable, I did the following:

each time the button actions are updated, I remove all the button from the system config (system.@button):

	while(exec("uci get system.@button[0]") == "button")
	{
		exec("uci delete system.@button[0]");
	}
	exec("uci commit system");

and I then add again all the button, keeping the reset button for the last position:

for($i=0;$i<4;$i++)
{
	exec("uci add system button");
	exec("uci set system.@button[".$i."].button=reset");
	exec("uci set system.@button[".$i."].action=released");

	if($_wpsx[$i] == 0) $handler = "logger No action";
	else if($_wpsx[$i] == 1) $handler = "php /www/toggle_services.php -karma";
	else if($_wpsx[$i] == 2) $handler = "php /www/toggle_services.php -dnsspoof";
	else if($_wpsx[$i] == 3) $handler = "php /www/toggle_services.php -snarf";
	else if($_wpsx[$i] == 4) $handler = "php /www/toggle_services.php -s";
	else if($_wpsx[$i] == 5) $handler = "reboot";
	else if($_wpsx[$i] == 6) $handler = "sh /www/pineapple/wpsScript.sh";

	exec("uci set system.@button[".$i."].handler='".$handler."'");
	exec("uci set system.@button[".$i."].min=".$_wpsx_min[$i]."");
	exec("uci set system.@button[".$i."].max=".$_wpsx_max[$i]."");
	exec("uci commit system");
}

exec("uci add system button");
exec("uci set system.@button[4].button=wps");
exec("uci set system.@button[4].action=released");
exec("uci set system.@button[4].handler='cp /etc/config/backup/* /etc/config/ && reboot'");
exec("uci set system.@button[4].min=5");
exec("uci set system.@button[4].max=10");
exec("uci commit system");

I had also to modify the resetButton.sh to always remove/add button n°4 as reset button will always be at this position with my implementation.

looks good but where can we find the files i cant find them on the wiki.

Edited by mreidiv
Link to comment
Share on other sites

Hi everyone !

I added a mod on the wiki about the WPS button.

This adds a new menu entry "Buttons" in the GUI to allow the configuration of the WPS button behavior.

You can add the following actions to the WPS button:

- Toggle Karma

- Toggle DNS Spoof

- Toggle URL Snarf

- Connect SSH

- Reboot

- Run Custom Script

4 duration can be configured:

- 0-2 Seconds

- 4-6 Seconds

- 8-10 Seconds

- 12+ Seconds

post-38761-0-75915900-1331325544_thumb.p

Great work Whistle Master!

I really hope this is going to be added to the project? one thing that would help is using one of the leds to signal when to let go? or a secession of presses maybe within 1 second.

when wps button pressed

wpsCount++

reset/set wps timer

if wps timer is 1 second old goto wps select case, reset wpsCount, disable wps timer

Link to comment
Share on other sites

While waiting to reorder all the stuff on the github wiki, I uploaded the wps buttons scripts files here.

Thanks ! Been looking for this (and annoying many, many other posters!).

I have done a quick edit and added the link to the file on the wiki for any other noobs such as myself!

Link to comment
Share on other sites

  • 4 months later...
  • 5 weeks later...
  • 2 weeks later...

IMPORTANT:

This has now been fixed.

This module has been pulled from the module database.

When setting a WPS script, it overwrites the reset button handler.

In doing that, the resetPineapple.sh script does not get used which can potentially cause a brick.

I believe that this is responsible for all the people reporting that the reset button does not reset their password and that they now need to get a serial cable.

To fix this issue you will need to uninstall the module and re-flash the pineapple.

Best Regards,

Sebkinne

Note: I am well aware that the issue at hand was not introduced on purpose. It was simply overlooked. WhistleMaster of course did not mean to cause this. The pulling of the module is not permanent either, once the issue is resolved it will be back.

Link to comment
Share on other sites

This behavior is from the very first version of the module. I will update it as soon as possible ! Sorry for the issue !

I now placed the reset button at system.@button[0]. So simply do not remove that and remove anything > 0.

A simply for loop should do the trick :)

That way you do not need to re-program the reset button at all which in the case of file changes would be best ;)

Best Regards,

Sebkinne

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

WM thanks for this infusion..It's geat but....there's a problem.

I'm running the latest firmware version (2.7 - MK4) and no option seems to work. Only "Reboot" option works.

MK4 Karma, DNS Spoof, URL Snarf, SSH not change their statuses when WPS Button is pressed.

Will be an update for this infusion? Thanks in advance.

Best regards.

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

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.

  • Recently Browsing   0 members

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