Skip to content

Instantly share code, notes, and snippets.

@CypherpunkSamurai
Last active January 16, 2022 19:38
Show Gist options
  • Select an option

  • Save CypherpunkSamurai/cd9d9da6c9e8ff34748c3312146c4f8e to your computer and use it in GitHub Desktop.

Select an option

Save CypherpunkSamurai/cd9d9da6c9e8ff34748c3312146c4f8e to your computer and use it in GitHub Desktop.
4G WiFi Modem msm8916 webkey scripts
setprop service.adb.tcp.port 5555 && stop adbd && start adbd

HTTP SL4A Api Documentation (reverse engineered)

Fetch Data

This http request fetches data from the 4G LTE Wifi router

Request:

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"d62d8e592b6c2998f4d3a798843c62fd\", qop=auth, nc=0000046c, cnonce=\"7478a2b447e90b66\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/desk.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":85,\"method\":\"getDeviceState\",\"params\":[]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Response:

{"error":null,"id":85,"result":{"UnreadSmsCount":0,"DataConnectivity":"CONNECTED","NetworkType":"LTE","ClientsNumber":"1","LAN_insert":false,"MobileTotalBytes":"94.61 MB","NetworkOperatorName":"Vodafone IN","Signal":4,"BatteryStatus":"Discharging","LAN_enable":true,"BatteryLevel":"86","EthernetConnectivityAvailable":false,"SimState":5}}

MMNC

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"cf5ffb4acf64871237c9ffd87e889cc4\", qop=auth, nc=0000046e, cnonce=\"efd230188c22faa6\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/top.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":455,\"method\":\"getMCCMNC\",\"params\":[]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Get Wifi AP Info

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"f656bcc1dda33fd7e01c567b694919c3\", qop=auth, nc=0000046a, cnonce=\"41626687515f781c\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/top.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":454,\"method\":\"getWifiApInfo\",\"params\":[2]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Get Login Info

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"fcddb0f563f793fff0af783d79be0d28\", qop=auth, nc=00000a4d, cnonce=\"90265448e5a520c5\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/UserAccount.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":0,\"method\":\"getLoginUserInfo\",\"params\":[]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Get SIM type

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"bf451b4761c801f1c9a09a5edd7a0205\", qop=auth, nc=00000761, cnonce=\"44b77d8272b6be03\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/top.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":2,\"method\":\"getSimType\",\"params\":[]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Get Wifi AP Name

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"1439973c45179dabbfe5e870c7778929\", qop=auth, nc=0000081d, cnonce=\"a9c69d06be9a6feb\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/ssid.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":0,\"method\":\"getWifiApInfo\",\"params\":[0]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Get Wifi AP Password

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"5f33beb9b3b8f1d98f5b4c5ba1ff7d25\", qop=auth, nc=0000081f, cnonce=\"96479532578febcf\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/ssid.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":2,\"method\":\"getWifiApInfo\",\"params\":[3]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Get Wifi AP Type

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"0a8ec73a9ea346800d7cda6a0d9d95da\", qop=auth, nc=0000081e, cnonce=\"bd2e2a9cd84acb77\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/ssid.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":1,\"method\":\"getWifiApInfo\",\"params\":[1]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Get APN

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"fe7683a0f6b8cb2432007b9c2f8a722c\", qop=auth, nc=00000850, cnonce=\"3250c8867dbb1981\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/apn.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":0,\"method\":\"getApnList\",\"params\":[]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Disable Mobile Data

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"f3103741769533cf92f6ddc114cd03b8\", qop=auth, nc=0000097c, cnonce=\"945b41b8ff1c4521\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/desk.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":7,\"method\":\"MobileDataEnable\",\"params\":[]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Enable Mobile Data

fetch("http://192.168.43.1/sl4a", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "Digest username=\"admin\", realm=\"4G Wireless Router\", nonce=\"1642360175_3232246730\", uri=\"/sl4a\", response=\"0cd395e4465747abb451551d73f84096\", qop=auth, nc=000009e4, cnonce=\"ac5772b8ccf75470\"",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded",
    "pragma": "no-cache",
    "sec-gpc": "1",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "http://192.168.43.1/desk.html",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"id\":20,\"method\":\"MobileDataEnable\",\"params\":[]}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});
adb push start.sh /data/data/com.webkey/files/start.sh
adb shell chmod 644 /data/data/com.webkey/files/start.sh
adb push adbwifi.sh /system/xbin/adbwifi
adb shell chmod 644 /system/xbin/adbwifi
# use 644 for safe
# 777 for other
#!/system/bin/sh
su -c /system/xbin/adbwifi
su -c /data/data/com.webkey/files/./webkey
mount -o rw,remount -t yaffs2 /dev/block/mtdblock2 /system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment