curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Configure a network camera

From: Tony Lombardo via curl-users <curl-users_at_lists.haxx.se>
Date: Thu, 26 Oct 2023 13:46:00 +0000

Thanks, Ray, for the reply. For what it's worth, the initial camera configurations are done on a test bench with the camera directly connected to a laptop and no other networks in use. That's why I didn't worry about sending the username and password. In this case anyway.

Seems like it should be pretty straightforward, I've tried your suggestions and some other things too. I wouldn't be surprised to find the endpoint just doesn't work as documented. I was hoping for something simple with bash and curl. Who knows, maybe I will give python a try.

Thanks again,
-Tony

--
Tony Lombardo
Systems Administrator
Division of Public Safety
Access Control Department
Cornell University

________________________________
From: curl-users <curl-users-bounces_at_lists.haxx.se> on behalf of Ray Satiro via curl-users <curl-users_at_lists.haxx.se>
Sent: Tuesday, October 24, 2023 5:57 PM
To: curl-users_at_lists.haxx.se <curl-users_at_lists.haxx.se>
Cc: Ray Satiro <raysatiro_at_yahoo.com>
Subject: Re: Configure a network camera

On 10/24/2023 8:12 AM, Tony Lombardo via curl-users wrote:
This may be obvious to even the most casual observer, but I have tried every permutation I can think of and none of them worked. Attempting to use a simple bash script for network camera configuration.
I tried a couple times to escape the ampersand and so forth, it doesn't seem to like the syntax in general. I have other similar scripts that use different endpoints that work fine. Any suggestions are appreciated.

res=$(curl -s --anyauth --noproxy "*" -u root:"thisisthepassword" 123.456.0.78/axis-cgi/pwdgrp.cgi?action=add&user=operator&pwd="alsoapassword"&grp=operator)

echo "$res"


If anyone is truly interested, the instructions for what I am trying to do are located here:
https://www.axis.com/vapix-library/subjects/t10175981/section/t10036044/display
-     Under the "Add, modify and delete user accounts" section, example #1


Enable verbose mode -v to see what is happening. You have to quote the URL. Also that API requires the comment parameter to add a user even if there's no comment, so probably something like this:

"123.456.0.78/axis-cgi/pwdgrp.cgi?action=add&user=operator&pwd=alsoapassword&grp=operator&comment="

From a security standpoint this is a bad way to do it because the username and password are in the command line (which in Linux can usually be seen) and the request is sent via http which is insecure and can be sniffed over the network, unlike https which is secure and can't be sniffed. If the camera accepts secure connections then use that instead. Other changes that could be made are putting the camera username/password in a configuration file that curl reads via -K or --config [1], like curl -K userpass.txt ... , and POSTing the parameters from a file instead of putting them in the url. If you are interested in improving security you will have to read your API manual and the curl manual to determine what is possible for your situation.


[1]: https://curl.se/docs/manpage.html#-K


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-10-26