CGI Reboot script using cURL not working

Gswanson74

Young grasshopper
Joined
Jun 20, 2016
Messages
55
Reaction score
1
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.
 

Dodutils

Pulling my weight
Joined
Dec 10, 2016
Messages
451
Reaction score
166
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:

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
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
 

Gswanson74

Young grasshopper
Joined
Jun 20, 2016
Messages
55
Reaction score
1
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.
 

Gswanson74

Young grasshopper
Joined
Jun 20, 2016
Messages
55
Reaction score
1
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 ;-)
 
Top