1.

Solve : Direct URL Webpage Option Execution for Modem Reset?

Answer»

Looking into a way to pass a single URL (string) to my cable modem to basically have it reset by another program that monitors its connectivity. I have had issues where I can contact my modem, but the modem to ISP connection is lost requiring a reset. Comcast has made multiple visits and I have already replaced the modem. So since this happens a couple times a week and a reset is required to fix this, I figured I might be able to automate the reboot when my one system on the network detects that the internet is gone for 30 seconds, to then pass a direct URL reboot request via IEXPLORE.EXE "URL_and_True_To_RESET_INFO"

The URL that this HTML & Script is from is:  http://192.168.100.1/RgConfig.asp

And when selecting reset, and OK, it then tells the modem to reset and the URL changes to:
http://192.168.100.1/goform/RgConfig

So I am thinking that the information from Code: [Select]window.document.RgConfig.ResetReq.value = 1 should be able to be executed directly at the URL and have the modem reset, but http://192.168.100.1/goform/RgConfig.ResetReq.value = 1 doesnt work, so maybe a HTML or Script guru can help me make this work maybe?

Leads me to believe that this form function adds .ResetReq.value = 1 to the http://192.168.100.1/goform/RgConfig url path since it shows the form action of  =/goform/RgConfig



Code: [Select]function resetReq()
{
 var agree=window.confirm('Are you sure you want to reset the modem?');

 if (agree == true)
 {
window.document.RgConfig.ResetReq.value = 1;
 }
}



Code: [Select]<html>

<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="Wed, 30 Apr 1975 02:00:00 GMT">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Modem Configuration: Status - Software</title>

</head>

<body>

<script language="javascript" type="text/javascript">
function RgConfigHtml()
{
   var html = "";
   var flag = 1;
   var freqPlan = 0;
   var channelId = 4;
   var dsFreq = 621000000;
   var dhcpServer = "Enabled";
   var freqPlanList = ["North American Standard/HRC/IRC", "European PAL I/B/G", "Japan NTSC",
                       "China", "Korea" ];

   if (flag == 1)
   {
       html += '<tr><td>Frequency Plan</td><td>' + freqPlanList[freqPlan] + '</font></td></tr>';
html += '<tr><td>Upstream Channel ID</td><td>' + channelId + '</font></td></tr>';
html += '<tr><td>Frequency (Hz)</td><td>' + dsFreq + '</font></td></tr>';
html += '<tr><td>DHCP Server</td><td >' + dhcpServer + '</font></td></tr>';
     
   }
   else
   {

       html += '<tr><td>Frequency Plan</td>' +
   '<td><SELECT NAME="CmFrequencyPlan">' +
           '<OPTION value="0"' + (freqPlan==0?'selected':'') + '>North American Standard/HRC/IRC' +
   '<OPTION value="1"' + (freqPlan==1?'selected':'') + '>European PAL I/B/G' +
   '<OPTION value="2"' + (freqPlan==2?'selected':'') + '>Japan NTSC' +
   '<OPTION value="3"' + (freqPlan==3?'selected':'') + '>World Wide' +    
                   '<OPTION value="4"' + (freqPlan==4?'selected':'') + '>Korea' +
                   '</SELECT></td></tr>';
       html += '<tr><td>Upstream Channel ID</td>' +
   '<td><INPUT TYPE=TEXT NAME="CmUpChannelId" value=' + channelId + '></td></tr>';
       html += '<tr><td>Frequency</td>' +
   '<td><INPUT TYPE=TEXT NAME="CmDownstreamFreq" value=' + dsFreq + '></td></tr>';
       html += '<tr><td COLSPAN=2>DHCP Server Enabled                                     '+
   '<INPUT TYPE=CHECKBOX NAME="CmDhcpServer"' + (dhcpServer=="Enabled"?'checked':'') + '><br>' +
  'The SURFboard cable modem can be used as a gateway to the Internet by a ' +
          'maximum of 32 users on a Local Area Network (LAN). When the Cable Modem is ' +
          'disconnected from the Internet, users on the LAN can be dynamically ' +
          'assigned IP Addresses by the Cable Modem DHCP Server. These addresses are ' +
          'assigned from an address pool which begins with 192.168.100.11 and ends ' +
          'with 192.168.100.42. Statically assigned IP addresses for other devices on ' +
          'the LAN should be chosen from outside of this range.'+ '</td></tr>';
       html += '<tr><td COLSPAN=2>' +
   '<input type="submit" value="Save Changes" align="middle" onClick="SaveChanges();">' +
   '<input type="hidden" name="saveChanges" value=0>' +
   '<br>' +
   '<b>Note:<br></b>' +
   'Making changes requires a modem reboot to take effect.</td></tr>';
   }

   return html;
}

function SaveChanges()
{
window.document.RgConfig.saveChanges.value = 1;
}

function restoreFactoryDefault()
{
 var agree=window.confirm('This action requires re-initialization of the cable modem. This process could take from 5 to 30 minutes.  Do you want to proceed?');

 if (agree == true)
 {
window.document.RgConfig.RestoreFactoryDefault.value = 1;
 }
}

function resetReq()
{
 var agree=window.confirm('Are you sure you want to reset the modem?');

 if (agree == true)
 {
window.document.RgConfig.ResetReq.value = 1;
 }
}

</script>

<form action=/goform/RgConfig method=POST name="RgConfig">

<table border="0" cellspacing="0" width="100%" id="AutoNumber1" style="border-collapse: collapse" bordercolor="#111111" cellpadding=0>

<tr>
 <td width="100%" height="22" colspan="2" bgcolor="#018ABE">&nbsp;
 </td>
</tr>

<tr>
 <td width="157" height="130" align="center" style="border-left-style: none; border-left-width: medium; border-right-style: solid" bordercolor="#018ABE">
  <a href="http://www.motorola.com"><img border="0" src="s_motorola.gif"></a>
 </td>
 <td width="119%" height="51" align="left" style="border-bottom: 0px solid #C0C0C0">
    <p style="margin-left: 20; margin-top: 0; margin-bottom: 0"><font face="Arial" style="font-size: 20pt">Configuration</font></p>
    <p style="margin-left: 20; margin-top: 0; margin-bottom: 0"><b>This page provides information about the manually configurable settings of the Cable Modem.</b></p>
  </td>
</tr>

<tr>
 <td width="140" height="50" align="center" valign="top" style="border-left-style: none; border-left-width: medium; border-right-style: solid" bordercolor="#018ABE">&nbsp;<A HREF="RgStatus.asp" TARGET="_top" STYLE="TEXT-DECORATION:none">

<table border="0" cellspacing="6" width="100%" cellpadding="2">

<tr><td bgcolor="#CCCC99">
<A HREF="RgStatus.asp" TARGET="_top" STYLE="TEXT-DECORATION:none">
<FONT  COLOR="#485A91" FACE="Arial,Helvetica"><b>
Status</b></FONT></A></td></tr>

<tr><td bgcolor="#CCCC99">
<A HREF="RgSignal.asp" TARGET="_top" STYLE="TEXT-DECORATION:none">
<FONT COLOR="#485A91" FACE="Arial,Helvetica"><b>
Signal</b></FONT></A></td></tr>

<tr><td bgcolor="#CCCC99">
<A HREF="RgAddress.asp" TARGET="_top" STYLE="TEXT-DECORATION:none">
<FONT COLOR="#485A91" FACE="Arial,Helvetica"><b>
Addresses</b></FONT></A></td></tr>

<tr><td bgcolor="#666600">
<A HREF="RgConfig.asp" TARGET="_top" STYLE="TEXT-DECORATION:none">
<FONT COLOR="White" FACE="Arial,Helvetica"><b>
Configuration</b></FONT></A></td></tr>

<tr><td bgcolor="#CCCC99">
<A HREF="RgEventLog.asp" TARGET="_top" STYLE="TEXT-DECORATION:none">
<FONT COLOR="#485A91" FACE="Arial,Helvetica"><b>
Logs</b></FONT></A></td></tr>

<tr><td bgcolor="#CCCC99">
<A HREF="RgHelp.asp" TARGET="_top" STYLE="TEXT-DECORATION:none">
<FONT COLOR="#485A91" FACE="Arial,Helvetica"><b>
Help</b></FONT></A></td></tr>

<br>
<br>
<br>
<tr><td align="center"><a href="http://www.motorola.com">
<img border="0" src="about_surfboard.gif"></a></td>
</tr>
</table>
 </td>

 <td>

 <table style="font-family: Helvetica; font-size: 14; margin-left: 20; margin-bottom: 30" width="95%" CELLPADDING=6 CELLSPACING=0 BORDER=1>

 <tr>
  <td align="center" bgcolor="#666600"><b><font COLOR="white" FACE="Arial,Helvetica">Item</font></b></td>
  <td align="center" bgcolor="#666600"><b><font COLOR="white" FACE="Arial,Helvetica" >Value</font></b>
  </td>
 </tr>


<script language="javascript" type="text/javascript">
document.write(RgConfigHtml());
</script>


<tr>
  <td COLSPAN=2>
      <input type="submit" value="Restore Factory Defaults" align="middle" onClick="restoreFactoryDefault();">
  <input type="hidden" name="RestoreFactoryDefault" value=0>
       <br>
<b>Note:<br></b>
        Resetting the cable modem to its factory default configuration will remove all
stored parameters learned by the cable modem during prior initializations. The
process to get back online from a factory default condition could take from 5
to 30 minutes. Please reference the cable modem User Guide for details on the
power up sequence.
  </td>
</tr>

<br>

<tr>
  <td COLSPAN=2 align="center">
      <input type="submit" value="Restart Cable Modem" align="center" onClick="resetReq();">
  <input type="hidden" name="ResetReq" value=0>
  </td>
</tr>
</table>
</td>
</tr>

  <tr><td width="100%" height="19" colspan="2" bgcolor="#018ABE">&nbsp;</td></tr>
  <tr><td><font size="1">©2004 Motorola &nbsp; All rights reserved.</font></td></tr>

</table>
</form>
</body>

</html>DaveLembke, You code is way, way over my head.
I had Comcast and a reset was maybe once a week.
Is the connection by Ethernet cable?
Is the modem so far away you can not reset it by hand?
Modem is ethernet, and there are times that I am on the road on business and can not gain access into my own network without first having to call my wife and talk her through reboot. Would be nice to have a detection setup for internet down and have a computer thats already running be able to give it a reboot after 30 seconds of no internet. Detecting if the internet is down is easy, but trying to pass this reboot by passing direct form information through a URL chain is stumping me. I am thinking that even though the HTML & Scripts originated from the built in web server like service that the modem has, that feeding it what it wants even if not originated from the interaction of its own code, but a copy of its exact code with the form info that its ready to accept, it should act like pass thru acceptance and take the reboot.

The page uses a simple alert box which if selected OK, it passes the true statement in script for the information to be passed via a form to the modem. And I am thinking that this info can be tagged onto the URL at the END of the URL path to pass the reset to the modem.

The alert box and what the modem needs is right here, but I am just not sure how to pass it as URL + the true to reboot data that will make it reboot. Javascript and FORMS are my weak spot. And figured I would post this here instead of programming, since this is geared more towards HTML and Javascript web design even though it could be categorized as, hardware bending programming probably, to force feed it what it will readily accept without alert box and authentication required.

On the third screenshot you see the URL change to http://192.168.100.1/goform/RgConfig as the information is passed via form to the modem, but I am thinking this same info can be tagged onto the URL and passed that way as well. IF NOT... Then maybe an altered webpage that does away with the alert box, but passes it the true statement its ready to accept via form will also do the trick and be less complicated, at which point just launching the page will cause the reboot to happen once.
Code: [Select]function resetReq()
{
 var agree=window.confirm('Are you sure you want to reset the modem?');

 if (agree == true)
 {
window.document.RgConfig.ResetReq.value = 1;
 }
}

</script>

<form action=/goform/RgConfig method=POST name="RgConfig">
[recovering disk space - old attachment deleted by admin]Some modems routers  will take a restart from the command line. May work in wireless.
We are not taking  about the hard reset, whiten only bis done with a paper clip. Instead a restart of the sequence normally used with power on.
example:
http://ussername.password.193.168.1.1/#k

Or something like that. I got n that off the top of my head. It vars with which modem you have.
Sorry I can't stay hee. My partner says I have to mop the floor
Google: router reset command lineGot the floor done.
Here is one reference:
Quote

Re: Reset WRT54G router remotely
I was able to soft reset my Linksys WRT54G router firmware v1.009 remotely using a hidden reboot page as no reboot button was found on the admin page. Steps below:

1. Login into the web admin page of your router. I believe the default gateway is
192.168.1.1.
2. Go to the following page
http://192.168.1.1/Reset.htm
3. That should do it
 http://homecommunity.cisco.com/t5/Wireless-Routers/Reset-WRT54G-router-remotely/td-p/5352/page/2
But I still can't find the one I wanted, where you do the user name and password in the URL.
I am sure I saw that somewhere.
Does this help any?

EDIT: Crisco routers:
http://www.techrepublic.com/blog/networking/run-remote-commands-on-a-cisco-router-from-your-pc/422
Tried it with IP corrected for this device to 192.168.100.1 to see if it has a hidden page called Reset.htm, but comes up page not found. I am sure that Motorola and Linksys have their differences if there are any hidden pages.

*Update: It would probably be easier to create an altered webpage to launch than to pass it all in thru the URL. I have been able to reset the modem via an altered webpage that is outside of the modem on my computer locally by changing the form action path to full path of where to send the reset info to, but I still want to make this automatic vs having to click to submit:

Code: [Select]<form action=http://192.168.100.1/goform/RgConfig method=POST name="RgConfig">
From its original:

Code: [Select]<form action=/goform/RgConfig method=POST name="RgConfig">
I have been tweaking the webpage, but HIT a wall. The wall is that the form that passes the reset requires a user to do an event vs automatic execution of the form to be submitted. Dug out my O'Reilly Javascript book that I havent touched in 8 years that was burried under the stacks of other programming books that are used more frequently, and looking through all options for FORM Submission, I havent found a way to autosubmit on page load. I tried using onLoad in place of onClick, thinking that on pageload it would execute sending the reset info via form submission, but that doesnt work.

      onClick="resetReq();">
    

Also looked into others who want automatic form submissons and found this: http://www.velocityreviews.com/forums/t161954-convert-form-to-submit-on-load-instead-of-clicking-submit-button.html

*BUT... Trying to mix this code into this so called automatic form doesnt seem to be going too well. I tried to remove the IF statement, so that it would just do it no matter what the condition was, and that still requires clicking either button on the OK or Cancel alert box. Tried to remove the alert box and execute

Code: [Select]function resetReq()
{
window.document.RgConfig.ResetReq.value = 1;
}
Instead of:

Code: [Select]function resetReq()
{
 var agree=window.confirm('Are you sure you want to reset the modem?');
 
 if (agree == true)
 {
window.document.RgConfig.ResetReq.value = 1;
 }
}
And that also doesnt seem to automatically pass the form via auto-submit

Well I am going to take a break from this, since I have been hammering at this for 3 hrs and although made small progress, need a break from the code. I guess I will go fix my 2nd car that is starving for fuel.Have you ever used AutoHotkey or other keyboard emulators?
These can record macros that can be triggered by some later event.
Quote
AutoHotkey is a free, open-source utility for Windows. With it, you can:
    * Automate almost anything by sending keystrokes and mouse clicks. You can write a mouse or keyboard macro by hand or use the macro recorder.
    * Create hotkeys for keyboard, joystick, and mouse. Virtually any key, button, or combination can become a hotkey.
    * Expand abbreviations as you type them. For example, typing "btw" can automatically produce "by the way".
    * Create custom data-entry forms, user interfaces, and MENU bars. See GUI for details.
    * Remap keys and buttons on your keyboard, joystick, and mouse.
    * Respond to signals from hand-held remote controls via the WinLIRC client script.
    * Run existing AutoIt v2 scripts and enhance them with new capabilities.
    * Convert any script into an EXE file that can be run on computers that don't have AutoHotkey installed.
http://www.autohotkey.com/
Program like this can work inside of your browser.
It can, I believe, even start the browser.
Might be easier that JavaScript..

Thanks, I was able to make it work through Macro. Although would have been nicer to make it work as a single webpage that would send the form data on page load. I suppose the reason for why onLoad doesnt work for forms is because if it was OnLoad vs OnClick, it could be used for malicious intent...such as stealing info  through form that grabs and sends the minute the page loads without the user aware. I wonder if all forms are this way governed by browser rules handling forms or if the scripting language controls this.auto-submit web form using the body onLoad event. There is no onLoad event for an HTML form.

Code: [Select]<body onLoad="document.formName.submit()">
in your case I think that would be:

Code: [Select]<body onLoad="document.RgConfig.submit()">
Your cable modem shouldn't be going down a couple times a week.  Cable modems are much more reliable than that.  Since the modem has been replaced, it's probably not a problem with the modem, but a problem some where in the outside plant that Comcast needs to fix.  It sounds like an intermittent problem which can be very hard to find and fix.  Probably by the time the techs get to your home everything is working fine.

Here's another way that may serve the need to reset.
It would be nice... just a little or switch that could be held for a few seconds and force the modem to reset. If you have a wire connection going to the router and modem, there is a trick you can use.
In some IT installations they multiplex Ethernet cables to cut down on the cost of long cable runs. This applies to the 100 MB Ethernet, not the gigabit.  For the 100 Mb Ethernet there are a total of eight wires and the cable, but only four are actually used. But all of the wires have to be present for the proper electrical characteristics.
So you could guess what I'm getting at next. Here in my house we use  the Ethernet cable as an extension line out to another place. It's just an ordinary CAT-5, but it carries both Ethernet and a standard phone line. Nothing illegal about it, as far as I know. The voltages on the telephone line are usually quite low, except when the phone rings. Up to now nothing and has been blown up by the telephone company. The wires in question are cut out a little ways away from the connector and are tied into the phone system. Works for me.
It would be quite easy to put a little switch on one of those wire pairs and run it over to the power supply of the modem and just FLIP  the current on and off with the switch. I'm not sure how long cable could be before you have too much loss in the wire. Some modems require quite a bit of current, like 800 ma at 12 V, so there would be a little bit of a loss with two small wires of a CAT-5  cable. Or use a relay.

Just a thought.


Discussion

No Comment Found