Forked from orther/disable-tmobile-5g-home-internet-rotuer-wifi.md
Created
November 14, 2023 01:25
-
-
Save timperrett/e3370a8154bd300c05fc386dc19d0dde to your computer and use it in GitHub Desktop.
JS Code To Disable WiFi for T-Mobile 5G Home Internet Router
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This script can be copied into the browser console and used to disable wifi on the T-Mobile 5G Home Internet router. The web interface for the router doesn't allow you to disable it. | |
| ## Steps | |
| 1. Go to [http://192.168.12.1](http://192.168.12.1) | |
| 2. Open dev console (on mac `[cmd]+[opt]+i`) | |
| 3. Paste the below code with the `password` value replaced with the actual password | |
| <details> | |
| <summary><b>Expand To See Code</b></summary> | |
| ```js | |
| async function tmobileHomeInternetDisableWifi() { | |
| const username = 'admin' | |
| const password = 'REPLACE-WITH-REAL-PASSWORD' // <<------- Make sure to replace this | |
| async function loginTmobile(username, password) { | |
| const resp = await fetch("http://192.168.12.1/TMI/v1/auth/login", { | |
| "headers": { | |
| "accept": "application/json", | |
| "accept-language": "en-US,en;q=0.9", | |
| "cache-control": "max-age=0", | |
| "content-type": "text/plain;charset=UTF-8" | |
| }, | |
| "referrer": "http://192.168.12.1/home", | |
| "referrerPolicy": "strict-origin-when-cross-origin", | |
| // "body": "{\"username\":\"admin\",\"password\":\"tug.ecologist.cover.facility\"}", | |
| body: JSON.stringify({ username, password }), | |
| "method": "POST", | |
| "mode": "cors", | |
| "credentials": "include" | |
| }); | |
| console.log('resp', { headers: resp.headers }) | |
| if (resp.ok) { | |
| const jsonValue = await resp.json(); // Get JSON value from the response body | |
| const authToken = jsonValue?.auth?.token | |
| return Promise.resolve(authToken); | |
| } else { | |
| return Promise.reject('Failed to get JSON respon value'); | |
| } | |
| } | |
| async function getAccessPointConfig(authToken) { | |
| const resp = await fetch("http://192.168.12.1/TMI/v1/network/configuration?get=ap", { | |
| headers: { | |
| "accept": "application/json", | |
| "accept-language": "en-US,en;q=0.9", | |
| "authorization": `Bearer ${authToken}`, | |
| "cache-control": "max-age=0" | |
| }, | |
| referrer: "http://192.168.12.1/networks", | |
| referrerPolicy: "strict-origin-when-cross-origin", | |
| body: null, | |
| method: "GET", | |
| mode: "cors", | |
| credentials: "include" | |
| }); | |
| console.log('ap config resp', resp) | |
| if (resp.ok) { | |
| const jsonValue = await resp.json(); // Get JSON value from the response body | |
| return Promise.resolve(jsonValue); | |
| } else { | |
| return Promise.reject('Failed to get JSON respon value'); | |
| } | |
| } | |
| function disableWifiProps(apConfig) { | |
| const configWifiOff = { | |
| ...apConfig, | |
| '2.4ghz': { ...apConfig['2.4ghz'], isRadioEnabled: false }, | |
| '5.0ghz': { ...apConfig['5.0ghz'], isRadioEnabled: false }, | |
| } | |
| console.log('configWifiOff', configWifiOff) | |
| return configWifiOff | |
| } | |
| async function disableAccessPointWifi(authToken) { | |
| const apConfig = await getAccessPointConfig(authToken) | |
| const wifiOffConfig = disableWifiProps(apConfig) | |
| const resp = await fetch("http://192.168.12.1/TMI/v1/network/configuration?set=ap", { | |
| headers: { | |
| "accept": "application/json", | |
| "accept-language": "en-US,en;q=0.9", | |
| "authorization": `Bearer ${authToken}`, | |
| "cache-control": "max-age=0", | |
| "content-type": "text/plain;charset=UTF-8" | |
| }, | |
| referrer: "http://192.168.12.1/networks", | |
| referrerPolicy: "strict-origin-when-cross-origin", | |
| body: JSON.stringify(wifiOffConfig), | |
| method: "POST", | |
| mode: "cors", | |
| credentials: "include" | |
| }); | |
| console.log('ap config resp', resp) | |
| if (resp.ok) { | |
| const jsonValue = await resp.json(); // Get JSON value from the response body | |
| return Promise.resolve(jsonValue); | |
| } else { | |
| return Promise.reject('Failed to get JSON respon value'); | |
| } | |
| } | |
| const authToken = await loginTmobile(username, password) | |
| const result = await disableAccessPointWifi(authToken) | |
| return result | |
| } | |
| ``` | |
| </details> | |
| 4. Disable wifi by type `tmobileHomeInternetDisableWifi()` and hitting enter to run the code. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment