gruijter / netgear.js

Node js module to communicate with Netgear routers via SOAP
Mozilla Public License 2.0
58 stars 11 forks source link

Change router wifi passwords #21

Closed LongBrandon closed 2 years ago

LongBrandon commented 2 years ago

First of all thank you for all the work on this project.

I am trying to find a way to change the wifi passwords on the router (not the guest networks but the "regular" wifi ones). Do you have any idea of what the soap message would look like? Or could you point me in the right direction to find it?

LongBrandon commented 2 years ago

I ended up downloading the genie app and did some snooping with WireShark. For my Nighthawk R8000P here is what I observed when updating the password for 5G1:

This is sent first which updates the password:

<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
        <SessionID>A7D88AE69687E58D9A00</SessionID>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <M1:Set5G1WLANWPAPSKByPassphrase xmlns:M1="urn:NETGEAR-ROUTER:service:WLANConfiguration:1">
            <NewChannel>44</NewChannel>
            <NewRegion>US</NewRegion>
            <NewSSID>Wifi-5G</NewSSID>
            <NewWPAEncryptionModes>WPA2-PSK</NewWPAEncryptionModes>
            <NewWPAPassphrase>yourPasswordHere</NewWPAPassphrase>
            <NewWirelessMode>1625Mbps</NewWirelessMode>
        </M1:Set5G1WLANWPAPSKByPassphrase>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Then this is sent which I think applies the changes. If you don't send this it seems like clients that are currently connected can stay connected (don't get kicked off):

<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
        <SessionID>A7D88AE69687E58D9A00</SessionID>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <M1:ConfigurationFinished xmlns:M1="urn:NETGEAR-ROUTER:service:DeviceConfig:1">
            <NewStatus>ChangesApplied</NewStatus>
        </M1:ConfigurationFinished>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I have not fully tested this. But hopefully this helps someone out.

gruijter commented 2 years ago

I am very hesistant to add password setting to the netgear package. I am affraid it can (and thus will) be abused somehow.

What is your use case?

LongBrandon commented 2 years ago

I have a teenager who has convinced us to let him stay on the internet until 11 or 12 pm (depending on the day). If I don't turn off the internet he will be on it all night long.

I have tried many parental features (including the routers built in Circle app). But he is able to easily get around all of them or there are other issues/inconsistencies that I don't like. Changing the internet password just works. I have my app setup as a windows service and it changes the internet password at 11 pm automatically.

To me changing the password can be abused just like any of the other router settings your library gives access to. What is the difference that you see?

I rolled my own client entirely in C# (since that's what I'm familiar with). I was just hoping to give back a little since I looked through your code to determine how to build mine. So no need to add the feature if I'm the only person asking for it.

Either way thanks for all of your hard work on the library. It has helped me out a ton.