Updating foscam firmware via API
Foscam just released a new round of firmware updates. The suggested process to deploy firmware updates involves using the web interface. I’m hoping newer models are less of a hassle, but older models require the user to install an .exe and use internet explorer 10 or hope that your browser is old enough to allow you to enable NPAPI.
That pretty much rules out Linux, Mac, and up-to-date browsers on Windows.
But fear not, the devices have an API (for some reason they deleted any references/links to it from their forum, but I found a version here).
The API comes with its own share of odd quirks, but to update the firmware without a browser you can use the following CURL command
curl --output - --connect-timeout 15 --max-time 180 -H 'Expect:' --form 'image=@FOSIPC_A_patch_ver_whatever.bin' --request POST 'http://192.168.0.123/cgi-bin/CGIProxy.fcgi?cmd=fwUpgrade&usr=admin&pwd=password'
Replace the username and password with an account with admin privileges, the IP with the IP of your device, and the .bin file with the latest patch for your device.
Note: If your admin username or password contain any non alphanumeric characters, you need to Urlencode them. There are multiple ways to do this (perl, python, jq), but I’ll assume you have curl installed and can do
echo -n '$uper$secure' | curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "" | cut -c 3-