Re: Configure a network camera

Tony Lombardo via curl-users <[email protected]>
Newsgroups gmane.comp.web.curl.general
Message-ID <SA0PR04MB73056210A04658F6B9B2BA44B2DDA@SA0PR04MB7305.namprd04.prod.outlook.com>
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 <[email protected]> on behalf of Ray Satiro via curl-users <[email protected]>
Sent: Tuesday, October 24, 2023 5:57 PM
To: [email protected] <[email protected]>
Cc: Ray Satiro <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.