View Single Post
  #1  
Old 29.10.2011, 14:09
lurker
Guest
 
Posts: n/a
Exclamation Method for reconnects requiring a MAC address change; Example for SMC 2804WBR

Hey,

to obtain a fresh IP from my provider I need to change my MAC. I wanted to do this using only LiveHeader. This was somewhat troublesome, since there is no easy way to get a random number and I didn't find a good solution on the forum. However I figured out a way to do this that I would like to share.

The idea is to load a page containing a pseudo-random value from the router (In this case I use the seconds of the current time). Then parse it to set a random variable and use that to set the mac to a random value. This is steps 2, 3 and 4 of my script.

I hope this information is of some use to people with a similar setup. I think it would be a good addition to LiveHeader to have a variable that gets replaced with a random number. I could submit a patch if a dev tells me how to do it.

Code:
[[[HSRC]]]
    [[[STEP]]]
        [[[DEFINE routername="SMC*2804WBR"/]]]
    [[[/STEP]]]
    [[[STEP]]]
        [[[REQUEST]]]
            POST /login.htm HTTP/1.1
            Host: %%%routerip%%%
            Cookie: %%%Set-Cookie%%%

           page=login&page=login&year=111&month=10&day=28&hour=12&minute=16&second=6&pws=<password>
        [[[/REQUEST]]]
    [[[/STEP]]]
    [[[STEP]]]
        [[[REQUEST]]]
            GET /status_main.htm HTTP/1.1
            Host: %%%routerip%%%
            Cookie: %%%Set-Cookie%%%
        [[[/REQUEST]]]
    [[[/STEP]]]
    [[[STEP]]]
        [[[PARSE]]]
            n: [0-9]+:[0-9]+:([0-9][0-9])
        [[[/PARSE]]]
    [[[/STEP]]]
    [[[STEP]]]
        [[[REQUEST]]]
            POST /wan_dhcp.htm HTTP/1.1
            Host: %%%routerip%%%
            Cookie: %%%Set-Cookie%%%
            Referer: **External links are only visible to Support Staff**

            page=dhcpc&HostName=&MACaddr1=8c&MACaddr2=a9&MACaddr3=82&MACaddr4=73&MACaddr5=fc&MACaddr6=%%%n%%%
        [[[/REQUEST]]]
    [[[/STEP]]]
    [[[STEP]]]
        [[[REQUEST]]]
            POST /system_reset.htm HTTP/1.1
            Host: %%%routerip%%%
            Cookie: %%%Set-Cookie%%%

           page=system_reset
        [[[/REQUEST]]]
    [[[/STEP]]]
[[[/HSRC]]]
Reply With Quote