I’m looking to configure the SSID name (and possibly other settings) via a command line.
Need to include it in some local automation. This is for RUT230/240/241 etc.
Preferably Curl (Windows). I’ve tried my usual trick of http listening, and Firefox developer tools to view the urls and strings being used but am nowhere near being where I need to be.
This is using cgi, though I can’t seem to find any reference to available CGI commands.
I know with the built in cli it would be “uci set wireless.@wifi-iface[0].ssid=‘name’” but as to how I send that (and query it back to confirm) from a command line is another thing.
If anyone has any pointers or examples that I can scavage from it would be greatly appreciated.
If you want to configure devices using ‘curl’, I would suggest taking a look into JSON-RPC. This way, you will be able to send HTTP POSTs to the router and execute commands on it. For configuration, you can send UCI commands. You can find JSON-RPC configurations examples for Windows and Linux machines here and here, respectively.
Thank you AndzejJ - I’ve got the necessary commands now working to get the auth key, make the ssid change and commit/reload.
I just need to complete 2 final steps - 1 is to read back the SSID to confirm the change has taken…
I found the command
"curl --location “http:///192.168.1.1/ubus” --header “Content-Type: text/plain” --data “{"jsonrpc": "2.0", "id": 1, "method": "call", "params":["rutkey", "iwinfo", "info", { "device":"wlan0"}]}”
This generates a full list of the wifi details, however I’m looking to report back just the SSID (to read into a variable), but can’t seem to find out the command to do so. Any pointers?
Finally, I’ve got the “get model / firmware etc” working just fine, but can’t find the command to query the SIM card, ie read the SIM SN etc. Again, is there something I’m not finding on the Wiki pages?
Many thanks for your help so far - I’d never have figured this out otherwise.
As flebourse mentioned, you can use jq. You can download it via opkg.
opkg install jq
I would also suggest looking into ubus commands to get various information. For example:
ubus list
ubus -v list gsm.modem0
ubus call gsm.modem0 info
ubus call gsm.modem0 get_network_info
You can also execute AT commands via gsmctl from the command line:
gsmctl -A "AT+COPS?"
Keep in mind that the AT commands may differ based on the modem installed in your device. You can search online for the AT commands documentation that corresponds to your particular modem model.