How to reboot a SMC Barricade router remotely

Chris Tavares cct at tavaresstudios.com
Sun May 4 21:15:49 EDT 2003


"Jesse Lee" <jkl555 at hotmail.com> wrote in message
news:86e72741.0305040530.49f08d6d at posting.google.com...
> "Chris Tavares" <cct at tavaresstudios.com> wrote in message
news:<6u2ta.53259$ey1.4895862 at newsread1.prod.itd.earthlink.net>...
> > "Jesse Lee" <jkl555 at hotmail.com> wrote in message
> > news:86e72741.0305031947.29b2ec97 at posting.google.com...
> > > I have a SMC Barricade 7004AWBR router and I am trying to find a
> > > script that can remotely reboot the router (to renew the IP address).
> > > I have a web server running all the time. For security reason I would
> > > like to renew the IP address every night. Would someone point me to
> > > any web site that I can find such a script ?
> > >
> > > Thanks.
> > >
> > > Jesse Lee
> >
> > I've written several similar scripts, but not for the 7004AWBR. What you
> > need to do is act like a web client. urllib and httplib are your friends
> > here.
> >
> > To figure out what you need to send, grab a copy of tcpTrace from
> > http://www.pocketsoap.com/tcptrace/ . This is a tool that lets you
easily
> > spy on http transactions, so you can tell how the router does it's
login,
> > and what happens when you press the reset button. You will need some
> > knowledge of how HTTP works to understand what's happening here.
> > Unfortunately, every router does this sort of thing differently.
> >
> > Good luck,
> >
> > -Chris
>
> Chris,
>
> Thanks. I tried the tool and I think I know the steps I need to do are
> login through cgi-bin/logi and then call cgi-bin/rebo for this router.
> But the login process seems to pass encrypted password to the router.
> This may explain why I always get "Password is incorrect".
>
> For the reference, here is the cgi-bin/logi web page looks like
>

[ ... html trace skipped ... ]

What you need to do is simulate what happens when you press the login button
on the form. This causes an HTTP post request for the form on that page.
Notice this stuff:

<FORM ACTION=/cgi-bin/logi METHOD=POST NAME=LOGIN><INPUT TYPE=HIDDEN
VALUE="@D" NAME=RC><INPUT TYPE=HIDDEN VALUE="root" NAME=ACCT><INPUT
TYPE=HIDDEN VALUE="00:08:06 (S=00:00:00,P=0)" NAME=PSWD>System
Password<BR><INPUT TYPE=PASSWORD NAME=URL SIZE=9
MAXLENGTH=9><BR>(default: <B>admin</B>)<P><INPUT TYPE=HIDDEN
VALUE="3ABC.374E.3ABC/3100+ADA4 at Totoro 193s1" NAME=KEY><INPUT
TYPE=HIDDEN VALUE="R1.93s1" NAME=htm>
<INPUT TYPE=SUBMIT VALUE="Log in"></FORM>

What you'll need to do is hit the router with a get request, parse out the
form (htmllib can help with this) so that you get the values of all the
hidden elements, and then pass those values back in a POST request. You're
missing the hidden fields, so that's why you're getting the "incorrect
password". If you do several requests, you'll notice that the PSWD and
possibly the KEY values change every time. That's why you need to get the
form before you do the post.

Good luck,

-Chris






More information about the Python-list mailing list