CGI Reboot script using cURL not working

Gswanson74

Young grasshopper
Jun 20, 2016
55
2
Can anyone give me a hand? Running "http://192.168.1.200:81/hy-cgi/device.cgi?cmd=sysreboot&user=12345&pwd=67890" works to reboot my cams. Running it through cURL I get an unauthorized 401 error. When any of my cameras drop in BI, they are still viewable with other software, hence they can be trigger to reboot via the CGI command. I am trying to get a script for execution in the BI watchdog, but have had no luck so far.
 
do you have to login/password first when using web browser to access the reboot button ? if suppose yes then you must also authentify with curl calling the login url with login/password as parameters (you will have to pass them try POST parameters I guess), then retrieve the cookie session number it will return and reuse it when calling the reset url, I recommend you to use the development tool of Chrome (or other browser) to see what parameters are passed to the camera when you login so you can do the same with curl.

or... try @nayr answer first that should work and is much simpler ;-)
 
Last edited:
if they are standard HTTP Auth credentials, try putting the login in the URI
Code:
http://username:password@192.168.1.200:81/hy-cgi/device.cgi?cmd=sysreboot&user=12345&pwd=67890
 
if they are standard HTTP Auth credentials, try putting the login in the URI
Code:
http://username:password@192.168.1.200:81/hy-cgi/device.cgi?cmd=sysreboot&user=12345&pwd=67890

Tried that also. I'll try again though, syntax error always get me. The line I originally posted works in the browser, just not cURL.
 
do you have to login/password first when using web browser to access the reboot button ? if suppose yes then you must also authentify with curl calling the login url with login/password as parameters (you will have to pass them try POST parameters I guess), then retrieve the cookie session number it will return and reuse it when calling the reset url, I recommend you to use the development tool of Chrome (or other browser) to see what parameters are passed to the camera when you login so you can do the same with curl.

or... try @nayr answer first that should work and is much simpler ;-)
I'll try the other suggestion first, since yours leaves me a little puzzled ;-)