olssonm / google-wifi-api

Discovered API-endpoints for the Google Wifi Router and OnHub
MIT License
202 stars 15 forks source link

v2 API calls #6

Open MikeMannox opened 6 years ago

MikeMannox commented 6 years ago

I wanted to see if I figure out how the Google Wifi Android App queries for attached devices - (which I couldn't find), but I did find a whole bunch of API calls.

The Class I inspected was: com.google.api.services.accesspoints.v2.AccessPoints

Some of these seem interesting, although I could not see what queries and args are being passed.

Maybe you might have an idea...


// accesspoints
HttpMethods.DELETE, "v2/accesspoints/{apId}"
HttpMethods.GET, "v2/accesspoints/{apId}/hardwareBundleSetupInfo"
HttpMethods.POST, "v2/accesspoints/{apId}/localSpeedTest"
HttpMethods.POST, "v2/accesspoints/{clientApId}/meshSpeedTest"
HttpMethods.POST, "v2/accesspoints/{apId}/reboot"
HttpMethods.PUT, "v2/accesspoints/{apId}/bridgeMode"
HttpMethods.PUT, "v2/accesspoints/{apId}/lighting"
HttpMethods.PUT, "v2/accesspoints/{apId}/room"
HttpMethods.POST, "v2/accesspoints/{apId}/wifiblasterSpeedTest"

// apSoftware
HttpMethods.GET, "v2/apSoftware/{lastDismissedApVersion}/releaseNotes"

HttpMethods.GET, "v2/appSoftware/{appVersion}/clientTypes/{clientType}/status"

// connectedhome
HttpMethods.PUT, "v2/connectedhome/adapters/{adapterId}/activate"
HttpMethods.PUT, "v2/connectedhome/adapters/{adapterId}/deactivate"
HttpMethods.GET, "v2/connectedhome/adapters"
HttpMethods.PUT, "v2/connectedhome/{groupId}/cloudAction"

// groups
HttpMethods.POST,"v2/groups/{groupId}/blockingSchedules"
HttpMethods.POST,"v2/groups/{groupId}/blockingSchedules/{id}"
HttpMethods.DELETE, "v2/groups/{groupId}/blockingSchedules/{blockingScheduleId}"
HttpMethods.POST,"v2/groups/{groupId}/contentFilteringPolicies"
HttpMethods.DELETE, "v2/groups/{groupId}/contentFilteringPolicies/{contentFilteringPolicyId}"
HttpMethods.POST,"v2/groups/{groupId}/contentFilteringPolicies:updateMultiple"
HttpMethods.DELETE, "v2/groups/{groupId}"
HttpMethods.DELETE, "v2/groups/{groupId}/portForwarding"
HttpMethods.DELETE, "v2/groups/{groupId}/prioritizedStation"
HttpMethods.GET, "v2/groups/{groupId}"
HttpMethods.GET, "v2/groups/{groupId}/backhaulOfChildNodes"
HttpMethods.GET, "v2/groups/{groupId}/historicalUsage"
HttpMethods.GET, "v2/groups/{groupId}/meshConfiguration"
HttpMethods.GET, "v2/groups/{groupId}/meshSpeedTestResults"
HttpMethods.GET, "v2/groups/{groupId}/realtimeMetrics"
HttpMethods.GET, "v2/groups/{groupId}/speedTestResults"
HttpMethods.GET, "v2/groups/{groupId}/status"
HttpMethods.GET, "v2/groups/{groupId}/wifiblasterSpeedTestResults"
HttpMethods.POST, "v2/groups/{groupId}/insightCards/{cardId}/action"
HttpMethods.DELETE, "v2/groups/{groupId}/insightCards/{cardId}"
HttpMethods.GET, "v2/groups/{groupId}/insightCards/{cardId}"
HttpMethods.GET, "v2/groups/{groupId}/insightCards"
HttpMethods.GET, "v2/groups"
HttpMethods.POST, "v2/groups/{groupId}/managers"
HttpMethods.DELETE, "v2/groups/{groupId}/managers/{managerId}"
HttpMethods.POST, "v2/groups/{groupId}/portForwarding"
HttpMethods.POST, "v2/groups/{groupId}/psks"
HttpMethods.POST, "v2/groups/{groupId}/reboot"
HttpMethods.POST, "v2/groups/{groupId}/rebootWhenUpdateReady"
HttpMethods.POST, "v2/groups/{groupId}/startLogUpload"
HttpMethods.POST, "v2/groups/{groupId}/stationSets"
HttpMethods.DELETE, "v2/groups/{groupId}/stationSets/{stationSetId}"
HttpMethods.GET, "v2/groups/{groupId}/stationSets/{stationSetId}/stationActivity"
HttpMethods.POST, "v2/groups/{groupId}/stationSets/{stationSetId}"
HttpMethods.DELETE, "v2/groups/{groupId}/stations/{stationId}/stationName"
HttpMethods.GET, "v2/groups/{groupId}/stations"
HttpMethods.POST, "v2/groups/{groupId}/stations/operations/macAddresses"
HttpMethods.PUT, "v2/groups/{groupId}/stations/{stationId}/staticIp"
HttpMethods.PUT, "v2/groups/{groupId}/stations/{stationId}/stationName"
HttpMethods.PUT, "v2/groups/{groupId}/apSoftwareChannel"
HttpMethods.PUT, "v2/groups/{groupId}/dataCollection"
HttpMethods.PUT, "v2/groups/{groupId}/defaultPrioritizedStation"
HttpMethods.PUT, "v2/groups/{groupId}/dnsConfig"
HttpMethods.PUT, "v2/groups/{groupId}/guestWirelessConfig"
HttpMethods.PUT, "v2/groups/{groupId}/ipv6"
HttpMethods.PUT, "v2/groups/{groupId}/lanAddresses"
HttpMethods.PUT, "v2/groups/{groupId}/meshNetwork"
HttpMethods.PUT, "v2/groups/{groupId}/prioritizedStation"
HttpMethods.PUT, "v2/groups/{groupId}/stationBlocking"
HttpMethods.PUT, "v2/groups/{groupId}/upnpConfig"
HttpMethods.PUT, "v2/groups/{groupId}/wirelessConfig"
HttpMethods.POST, "v2/groups/{groupId}/wanSpeedTest"

// operations
HttpMethods.GET, "v2/operations/{operationId}"
HttpMethods.GET, "v2/operations/{operationId}/psks"
HttpMethods.GET, "v2/operations/{operationId}/macAddresses"

HttpMethods.POST, "v2/registrationTickets"

//userPreferences
HttpMethods.GET, "v2/userPreferences"
HttpMethods.PUT, "v2/userPreferences"
HttpMethods.PUT, "v2/userPreferences/resendConfirmationEmail"

HttpMethods.GET, "v2/oobeflow"

// the following log comment was in the class:
ajx.b(z, "You are currently running with version %s of google-api-client. You need at least version 1.15 of google-api-client to run version 1.22.0-SNAPSHOT of the Google Access Points API (Autopush) library.", bfi.c);

And one v1

"https://www.googleapis.com/", "wificonfig/v1/devices/"
// no clue how this is used

I hope it helps in some way

olssonm commented 6 years ago

Thanks for the info and input!

I don't have an Android device to check them out, but you mean that all these calls are made from the Android Google Wifi App to the Wifi-unit itself? That's quite odd actually, I haven't seen or detected and v2-calls at all over here.

Just to make sure, we're talking about this app: https://play.google.com/store/apps/details?id=com.google.android.apps.access.wifi.consumer&hl=en and this Google product: https://store.google.com/product/google_wifi?

MikeMannox commented 6 years ago

Yes, this is the same APK and same product.

As I mentioned I was looking for a way to read the attached devices list. Whilst looking around inside the app I discovered the above URL's inside the class.

You don't necessarily need an Android device to read what is in the APK.

Visit ApkMirror and download the App

Download & install JADX and you can have a look around yourself.

I hope this helps :)

lycca commented 6 years ago

Hi Mike,

I bought a few Google Wifi’s, which have an old 8688.0.0 version of firmware from the test image channel (instead of the usual stable channel) and having field updateRequired = 0.

It seems that some kind of write protection / restriction were in force in the test image firmware, preventing the execution of Recovery Mode when trying to flash a newer stable image firmware.

Since I am not familiar with CrOS development, could you please advise the procedure for me to flash the Google Wifi to 9334.x.x steady channel image (downloaded from OnHub Recovery Utility).

Below is my posting seeking for help in Google Help Forum, for your reference:

https://groups.google.com/a/chromium.org/forum/m/#!topic/chromium-os-dev/98yOPE3UEBo

https://productforums.google.com/forum/#!topic/googlewifi/etya6Mqeo-Y

https://productforums.google.com/forum/#!topic/googlewifi/-AvwS-S-h2Q

https://productforums.google.com/forum/#!topic/googlewifi/IH16V17l6J4

I also attached the status page of the Google Wifi (http://192.168.86.1/api/v1/status) below for your information, many thanks!

{ softwareStatus = { updateChannel = "testimage-channel"; updateProgress = 0; updateRequired = 0; updateStatus = 1; version = "8688.0.0"; }; systemStatus = { deviceId = "ed6640ea-ccbd-8c48-a02f-6c9102300f44"; hardware = 4; hardwareId = "GALE A2A-A2A-E3A-A4Q-A9C"; uptime = 19893; }; wanStatus = { captivePortal = 0; ethernetLink = 1; invalidCredentials = 0; online = 1; pppoeDetected = 0; }; }

adriancampos commented 5 years ago

I found the line prodAccesspointsApiHost = "accesspoints.googleapis.com" in com.google.android.apps.access.wifi.consumer.config.Config. Combined with your "v2" endpoints listed above (ex: https://accesspoints.googleapis.com/v2/userPreferences), I get a response:

"Request had invalid authentication credentials..."

To get an authorization token, I'm guessing we need to make a request to https://accounts.google.com/o/oauth2/v2/auth as described in https://developers.google.com/identity/protocols/OAuth2InstalledApp, pretending to be the app. I haven't been able to pull the parameters (specifically client_id) for that from the app, but I assume they're in there in some form.

Any suggestions?

forresthopkinsa commented 4 years ago

@adriancampos Did you ever figure that out?

JamesHawkinss commented 2 years ago

@forresthopkinsa

Hi there, apologies for picking up on this dead issue.

I've just implemented many of these API endpoints in a Node.js wrapper, which shows how to authenticate etc: https://github.com/JamesHawkinss/google-wifi-api-node

Hope this proves useful. I have plans to develop a web dashboard for showing basic Google Wifi information, as I don't like having to use the mobile app.

AngeloD2022 commented 2 years ago

I am working to reverse the RPC version of this API.

Authentication, as well as many of the HTTP methods, are implemented in C++ in this repository.

If anyone has any information relating to the new (RPC) API version, please let me know! :)