Skip to main content
Add the missing save step I updated my script with.
Source Link
interfect
  • 303
  • 2
  • 8

EDIT: This is only a partial solution. The device will join the network, but (if it has HDMI connected?) it goes into a "Connecting to " screen, and expects some further communication that the app knows how to send. When it doesn't get it, it forgets the network and goes back to setup mode.

I had no luck with @Jozef's answer, because I could only find Linux builds of Chromium, not Chrome, and Chromium seems to never have implemented chrome://cast.

However, I did find some documentation of the Chromecast's API at https://rithvikvibhu.github.io/GHLocalApi/, and I noted that if you're doing initial setup, none of it needs any authentication. There was also some useful information at https://github.com/rithvikvibhu/GHLocalApi/issues/68#issue-766300901 about how you need to encrypt the WiFi password with a public key from the device before submitting it.

So, I put together a Bash script, which I've published at https://gist.github.com/interfect/5f68381d55658d334e2bc4619d796476, which can do the Chromecast initial setup and connect it to WiFi without Google Home or an Android or iOS device. All you need is a Linux or (probably) Mac environment, or (probably) WSL on Windows.

To use it, you need to get your computer on the same network as the Chromecast somehow, either with an Ethernet adapter for the Chromecast (which I tested) or by somehow finding and joining its setup hotspot (which I have not tested).

If you're a big fan of the curl | bash school of system administration, you can:

wget https://gist.githubusercontent.com/interfect/5f68381d55658d334e2bc4619d796476/raw/1d16ead908a92742d5f22231a2611242d673654f/castanet.sh
chmod +x castanet.sh
CHROMECAST_IP=192.168.0.100 WIFI_SSID="foobar" WIFI_PASSWORD="hackme" ./castanet.sh

I don't want to copy-paste a whole script in here, since I don't think that's what StackExchange is for, but the important steps are:

  1. Get the device RSA public_key from the JSON available via TSL 1.2 HTTPS to port 8443 at /setup/get_eureka_info. (My curl defaulted to 1.3, and that was too new for the device and I had to dissuade it.)
  2. POST to /setup/scan_wifi
  3. After a bit, get /setup/scan_results, find your network, and grab the wpa_auth (always 7?) and wpa_cipher (always 4?)
  4. Encrypt the password to the device's public key using RSA_PKCS1_PADDING and an oaepHash of sha256 (the nodejs crypto module can do this, if you wrap the key in BEGIN and END lines), and base64 encode the cyphertext.
  5. JSON post the ssid, wpa_auth, wpa_cipher, and enc_passwd, along with to /setup/connect_wifi.
  6. JSON post a flag keep_hotspot_until_connected flag ofwith value true true, to /setup/connect_wifisave_wifi.
  7. Make sure not before the Chromecast decided to leave it plugged into Ethernet, or it will drop off the new wifi connection in favor of the Ethernet onenetwork.

EDIT: This is only a partial solution. The device will join the network, but (if it has HDMI connected?) it goes into a "Connecting to " screen, and expects some further communication that the app knows how to send. When it doesn't get it, it forgets the network and goes back to setup mode.

I had no luck with @Jozef's answer, because I could only find Linux builds of Chromium, not Chrome, and Chromium seems to never have implemented chrome://cast.

However, I did find some documentation of the Chromecast's API at https://rithvikvibhu.github.io/GHLocalApi/, and I noted that if you're doing initial setup, none of it needs any authentication. There was also some useful information at https://github.com/rithvikvibhu/GHLocalApi/issues/68#issue-766300901 about how you need to encrypt the WiFi password with a public key from the device before submitting it.

So, I put together a Bash script, which I've published at https://gist.github.com/interfect/5f68381d55658d334e2bc4619d796476, which can do the Chromecast initial setup and connect it to WiFi without Google Home or an Android or iOS device. All you need is a Linux or (probably) Mac environment, or (probably) WSL on Windows.

To use it, you need to get your computer on the same network as the Chromecast somehow, either with an Ethernet adapter for the Chromecast (which I tested) or by somehow finding and joining its setup hotspot (which I have not tested).

If you're a big fan of the curl | bash school of system administration, you can:

wget https://gist.githubusercontent.com/interfect/5f68381d55658d334e2bc4619d796476/raw/1d16ead908a92742d5f22231a2611242d673654f/castanet.sh
chmod +x castanet.sh
CHROMECAST_IP=192.168.0.100 WIFI_SSID="foobar" WIFI_PASSWORD="hackme" ./castanet.sh

I don't want to copy-paste a whole script in here, since I don't think that's what StackExchange is for, but the important steps are:

  1. Get the device RSA public_key from the JSON available via TSL 1.2 HTTPS to port 8443 at /setup/get_eureka_info. (My curl defaulted to 1.3, and that was too new for the device and I had to dissuade it.)
  2. POST to /setup/scan_wifi
  3. After a bit, get /setup/scan_results, find your network, and grab the wpa_auth (always 7?) and wpa_cipher (always 4?)
  4. Encrypt the password to the device's public key using RSA_PKCS1_PADDING and an oaepHash of sha256 (the nodejs crypto module can do this, if you wrap the key in BEGIN and END lines), and base64 encode the cyphertext.
  5. JSON post the ssid, wpa_auth, wpa_cipher, and enc_passwd, along with a keep_hotspot_until_connected flag of true, to /setup/connect_wifi.
  6. Make sure not to leave it plugged into Ethernet, or it will drop the wifi connection in favor of the Ethernet one.

I had no luck with @Jozef's answer, because I could only find Linux builds of Chromium, not Chrome, and Chromium seems to never have implemented chrome://cast.

However, I did find some documentation of the Chromecast's API at https://rithvikvibhu.github.io/GHLocalApi/, and I noted that if you're doing initial setup, none of it needs any authentication. There was also some useful information at https://github.com/rithvikvibhu/GHLocalApi/issues/68#issue-766300901 about how you need to encrypt the WiFi password with a public key from the device before submitting it.

So, I put together a Bash script, which I've published at https://gist.github.com/interfect/5f68381d55658d334e2bc4619d796476, which can do the Chromecast initial setup and connect it to WiFi without Google Home or an Android or iOS device. All you need is a Linux or (probably) Mac environment, or (probably) WSL on Windows.

To use it, you need to get your computer on the same network as the Chromecast somehow, either with an Ethernet adapter for the Chromecast (which I tested) or by somehow finding and joining its setup hotspot (which I have not tested).

If you're a big fan of the curl | bash school of system administration, you can:

wget https://gist.githubusercontent.com/interfect/5f68381d55658d334e2bc4619d796476/raw/1d16ead908a92742d5f22231a2611242d673654f/castanet.sh
chmod +x castanet.sh
CHROMECAST_IP=192.168.0.100 WIFI_SSID="foobar" WIFI_PASSWORD="hackme" ./castanet.sh

I don't want to copy-paste a whole script in here, since I don't think that's what StackExchange is for, but the important steps are:

  1. Get the device RSA public_key from the JSON available via TSL 1.2 HTTPS to port 8443 at /setup/get_eureka_info. (My curl defaulted to 1.3, and that was too new for the device and I had to dissuade it.)
  2. POST to /setup/scan_wifi
  3. After a bit, get /setup/scan_results, find your network, and grab the wpa_auth (always 7?) and wpa_cipher (always 4?)
  4. Encrypt the password to the device's public key using RSA_PKCS1_PADDING and an oaepHash of sha256 (the nodejs crypto module can do this, if you wrap the key in BEGIN and END lines), and base64 encode the cyphertext.
  5. JSON post the ssid, wpa_auth, wpa_cipher, and enc_passwd to /setup/connect_wifi.
  6. JSON post a flag keep_hotspot_until_connected with value true true to /setup/save_wifi before the Chromecast decided to drop off the new wifi network.
Note that this doesn't really fully work yet
Source Link
interfect
  • 303
  • 2
  • 8

EDIT: This is only a partial solution. The device will join the network, but (if it has HDMI connected?) it goes into a "Connecting to " screen, and expects some further communication that the app knows how to send. When it doesn't get it, it forgets the network and goes back to setup mode.

I had no luck with @Jozef's answer, because I could only find Linux builds of Chromium, not Chrome, and Chromium seems to never have implemented chrome://cast.

However, I did find some documentation of the Chromecast's API at https://rithvikvibhu.github.io/GHLocalApi/, and I noted that if you're doing initial setup, none of it needs any authentication. There was also some useful information at https://github.com/rithvikvibhu/GHLocalApi/issues/68#issue-766300901 about how you need to encrypt the WiFi password with a public key from the device before submitting it.

So, I put together a Bash script, which I've published at https://gist.github.com/interfect/5f68381d55658d334e2bc4619d796476, which can do the Chromecast initial setup and connect it to WiFi without Google Home or an Android or iOS device. All you need is a Linux or (probably) Mac environment, or (probably) WSL on Windows.

To use it, you need to get your computer on the same network as the Chromecast somehow, either with an Ethernet adapter for the Chromecast (which I tested) or by somehow finding and joining its setup hotspot (which I have not tested).

If you're a big fan of the curl | bash school of system administration, you can:

wget https://gist.githubusercontent.com/interfect/5f68381d55658d334e2bc4619d796476/raw/1d16ead908a92742d5f22231a2611242d673654f/castanet.sh
chmod +x castanet.sh
CHROMECAST_IP=192.168.0.100 WIFI_SSID="foobar" WIFI_PASSWORD="hackme" ./castanet.sh

I don't want to copy-paste a whole script in here, since I don't think that's what StackExchange is for, but the important steps are:

  1. Get the device RSA public_key from the JSON available via TSL 1.2 HTTPS to port 8443 at /setup/get_eureka_info. (My curl defaulted to 1.3, and that was too new for the device and I had to dissuade it.)
  2. POST to /setup/scan_wifi
  3. After a bit, get /setup/scan_results, find your network, and grab the wpa_auth (always 7?) and wpa_cipher (always 4?)
  4. Encrypt the password to the device's public key using RSA_PKCS1_PADDING and an oaepHash of sha256 (the nodejs crypto module can do this, if you wrap the key in BEGIN and END lines), and base64 encode the cyphertext.
  5. JSON post the ssid, wpa_auth, wpa_cipher, and enc_passwd, along with a keep_hotspot_until_connected flag of true, to /setup/connect_wifi.
  6. Make sure not to leave it plugged into Ethernet, or it will drop the wifi connection in favor of the Ethernet one.

I had no luck with @Jozef's answer, because I could only find Linux builds of Chromium, not Chrome, and Chromium seems to never have implemented chrome://cast.

However, I did find some documentation of the Chromecast's API at https://rithvikvibhu.github.io/GHLocalApi/, and I noted that if you're doing initial setup, none of it needs any authentication. There was also some useful information at https://github.com/rithvikvibhu/GHLocalApi/issues/68#issue-766300901 about how you need to encrypt the WiFi password with a public key from the device before submitting it.

So, I put together a Bash script, which I've published at https://gist.github.com/interfect/5f68381d55658d334e2bc4619d796476, which can do the Chromecast initial setup and connect it to WiFi without Google Home or an Android or iOS device. All you need is a Linux or (probably) Mac environment, or (probably) WSL on Windows.

To use it, you need to get your computer on the same network as the Chromecast somehow, either with an Ethernet adapter for the Chromecast (which I tested) or by somehow finding and joining its setup hotspot (which I have not tested).

If you're a big fan of the curl | bash school of system administration, you can:

wget https://gist.githubusercontent.com/interfect/5f68381d55658d334e2bc4619d796476/raw/1d16ead908a92742d5f22231a2611242d673654f/castanet.sh
chmod +x castanet.sh
CHROMECAST_IP=192.168.0.100 WIFI_SSID="foobar" WIFI_PASSWORD="hackme" ./castanet.sh

I don't want to copy-paste a whole script in here, since I don't think that's what StackExchange is for, but the important steps are:

  1. Get the device RSA public_key from the JSON available via TSL 1.2 HTTPS to port 8443 at /setup/get_eureka_info. (My curl defaulted to 1.3, and that was too new for the device and I had to dissuade it.)
  2. POST to /setup/scan_wifi
  3. After a bit, get /setup/scan_results, find your network, and grab the wpa_auth (always 7?) and wpa_cipher (always 4?)
  4. Encrypt the password to the device's public key using RSA_PKCS1_PADDING and an oaepHash of sha256 (the nodejs crypto module can do this, if you wrap the key in BEGIN and END lines), and base64 encode the cyphertext.
  5. JSON post the ssid, wpa_auth, wpa_cipher, and enc_passwd, along with a keep_hotspot_until_connected flag of true, to /setup/connect_wifi.
  6. Make sure not to leave it plugged into Ethernet, or it will drop the wifi connection in favor of the Ethernet one.

EDIT: This is only a partial solution. The device will join the network, but (if it has HDMI connected?) it goes into a "Connecting to " screen, and expects some further communication that the app knows how to send. When it doesn't get it, it forgets the network and goes back to setup mode.

I had no luck with @Jozef's answer, because I could only find Linux builds of Chromium, not Chrome, and Chromium seems to never have implemented chrome://cast.

However, I did find some documentation of the Chromecast's API at https://rithvikvibhu.github.io/GHLocalApi/, and I noted that if you're doing initial setup, none of it needs any authentication. There was also some useful information at https://github.com/rithvikvibhu/GHLocalApi/issues/68#issue-766300901 about how you need to encrypt the WiFi password with a public key from the device before submitting it.

So, I put together a Bash script, which I've published at https://gist.github.com/interfect/5f68381d55658d334e2bc4619d796476, which can do the Chromecast initial setup and connect it to WiFi without Google Home or an Android or iOS device. All you need is a Linux or (probably) Mac environment, or (probably) WSL on Windows.

To use it, you need to get your computer on the same network as the Chromecast somehow, either with an Ethernet adapter for the Chromecast (which I tested) or by somehow finding and joining its setup hotspot (which I have not tested).

If you're a big fan of the curl | bash school of system administration, you can:

wget https://gist.githubusercontent.com/interfect/5f68381d55658d334e2bc4619d796476/raw/1d16ead908a92742d5f22231a2611242d673654f/castanet.sh
chmod +x castanet.sh
CHROMECAST_IP=192.168.0.100 WIFI_SSID="foobar" WIFI_PASSWORD="hackme" ./castanet.sh

I don't want to copy-paste a whole script in here, since I don't think that's what StackExchange is for, but the important steps are:

  1. Get the device RSA public_key from the JSON available via TSL 1.2 HTTPS to port 8443 at /setup/get_eureka_info. (My curl defaulted to 1.3, and that was too new for the device and I had to dissuade it.)
  2. POST to /setup/scan_wifi
  3. After a bit, get /setup/scan_results, find your network, and grab the wpa_auth (always 7?) and wpa_cipher (always 4?)
  4. Encrypt the password to the device's public key using RSA_PKCS1_PADDING and an oaepHash of sha256 (the nodejs crypto module can do this, if you wrap the key in BEGIN and END lines), and base64 encode the cyphertext.
  5. JSON post the ssid, wpa_auth, wpa_cipher, and enc_passwd, along with a keep_hotspot_until_connected flag of true, to /setup/connect_wifi.
  6. Make sure not to leave it plugged into Ethernet, or it will drop the wifi connection in favor of the Ethernet one.
Source Link
interfect
  • 303
  • 2
  • 8

I had no luck with @Jozef's answer, because I could only find Linux builds of Chromium, not Chrome, and Chromium seems to never have implemented chrome://cast.

However, I did find some documentation of the Chromecast's API at https://rithvikvibhu.github.io/GHLocalApi/, and I noted that if you're doing initial setup, none of it needs any authentication. There was also some useful information at https://github.com/rithvikvibhu/GHLocalApi/issues/68#issue-766300901 about how you need to encrypt the WiFi password with a public key from the device before submitting it.

So, I put together a Bash script, which I've published at https://gist.github.com/interfect/5f68381d55658d334e2bc4619d796476, which can do the Chromecast initial setup and connect it to WiFi without Google Home or an Android or iOS device. All you need is a Linux or (probably) Mac environment, or (probably) WSL on Windows.

To use it, you need to get your computer on the same network as the Chromecast somehow, either with an Ethernet adapter for the Chromecast (which I tested) or by somehow finding and joining its setup hotspot (which I have not tested).

If you're a big fan of the curl | bash school of system administration, you can:

wget https://gist.githubusercontent.com/interfect/5f68381d55658d334e2bc4619d796476/raw/1d16ead908a92742d5f22231a2611242d673654f/castanet.sh
chmod +x castanet.sh
CHROMECAST_IP=192.168.0.100 WIFI_SSID="foobar" WIFI_PASSWORD="hackme" ./castanet.sh

I don't want to copy-paste a whole script in here, since I don't think that's what StackExchange is for, but the important steps are:

  1. Get the device RSA public_key from the JSON available via TSL 1.2 HTTPS to port 8443 at /setup/get_eureka_info. (My curl defaulted to 1.3, and that was too new for the device and I had to dissuade it.)
  2. POST to /setup/scan_wifi
  3. After a bit, get /setup/scan_results, find your network, and grab the wpa_auth (always 7?) and wpa_cipher (always 4?)
  4. Encrypt the password to the device's public key using RSA_PKCS1_PADDING and an oaepHash of sha256 (the nodejs crypto module can do this, if you wrap the key in BEGIN and END lines), and base64 encode the cyphertext.
  5. JSON post the ssid, wpa_auth, wpa_cipher, and enc_passwd, along with a keep_hotspot_until_connected flag of true, to /setup/connect_wifi.
  6. Make sure not to leave it plugged into Ethernet, or it will drop the wifi connection in favor of the Ethernet one.