- Back to the Key: The HTTP Authorization Header
- Tying It All Together: Rebooting the Router
- Another Example: The Netgear Wireless Access Point
- What If Your Device Uses POST as the Form Method?
- Using This Technique on Other Devices
- Summary
Another Example: The Netgear Wireless Access Point
My DSL modem/router uses a pretty simple form (one piece of data) in its web interface to cause a reboot. The interface form for my Netgear wireless access point is a bit more complex, as shown in Figure 3 and Listing 4.
Figure 3 The reboot page of a Netgear wireless access point.
Listing 4 The source code for the access point reboot page form.
... <script language=JavaScript> function do_apply(){ if(getyes() == 1) { location.href="reboot.htm"; } else { alert("Please select ’yes’ and then press [ Apply ] to reboot the AP."); } } ... <form NAME=general> <table border="0" cellpadding="0" cellspacing="3" width="100%"> <tr> <td colspan="2"><h1> Reboot AP</h1></td> </tr> <tr> <!-- RULE --> <td colspan="2" background="liteblue.gif" height="12"> </td> </tr> <tr> <td>Reboot access point:</td> <td> <input type=radio NAME=reboot_ap value="1">Yes <input type=radio NAME=reboot_ap value="0" CHECKED>No </td> </tr> <tr> <!-- RULE --> <td colspan="2" background="liteblue.gif" height="12"> </td> </tr> <tr> <td align=center colspan=2> <input TYPE="button" VALUE="Apply" onClick="do_apply();"> <input TYPE="Reset" VALUE="Cancel"></td> </tr> </table> </form>
This page uses a bit of JavaScript to ensure that the user has clicked the Yes button before clicking Apply. If the user clicked the Yes button, the JavaScript directs the browser to load the page reboot.htm. Note that this isn’t a form action; simply loading the page with the appropriate authentication is enough to reboot the access point—no fancy form encoding needed!
Therefore, our script in Listing 3 only needs to have the $url variable changed as follows:
$url = "/reboot.htm"