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: Ray Satiro via curl-users <curl-users_at_lists.haxx.se>
Date: Tue, 24 Oct 2023 17:57:30 -0400

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
> <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-24