Re: Configure a network camera

Ray Satiro via curl-users <[email protected]>
Newsgroups gmane.comp.web.curl.general
Message-ID <[email protected]>
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
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.