Using the --digest option for digest authentication with a twist on linux

I am trying to change the date of a camera based on Onvif using curl in linux. I already managed to do this in C # and use digest authentication, but I'm stuck in this case.

I use the following command:

curl -u "admin:admin" --digest http://10.104.37.1:80/onvif/device_service --data '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"><DateTimeType>Manual</DateTimeType><DaylightSavings>false</DaylightSavings><TimeZone><TZ xmlns="http://www.onvif.org/ver10/schema">CST-0:00:00</TZ></TimeZone><UTCDateTime><Time xmlns="http://www.onvif.org/ver10/schema"><Hour>8</Hour><Minute>8</Minute><Second>8</Second></Time><Date xmlns="http://www.onvif.org/ver10/schema"><Year>2008</Year><Month>8</Month><Day>8</Day></Date></UTCDateTime></SetSystemDateAndTime></s:Body></s:Envelope>' 

And I get the following result (seems stuck):

  • About connecting () to port 10.104.37.1 80 (# 0)
  • Attempt 10.104.37.1 ... connected
  • Connected to 10.104.37.1 (10.104.37.1) port 80 (# 0)
  • Server auth using digest with user 'admin'
  • POST / onvif / device_service HTTP / 1.1
  • User-Agent: curl / 7.19.7 (i486-pc-linux-gnu) libcurl / 7.19.7 OpenSSL / 0.9.8k zlib / 1.2.3.3 libidn / 1.15
  • Host: 10.104.37.1
  • To accept:/
  • Content-Length: 0
  • Content-Type: application / x-www-form-urlencoded

After that, nothing happens.

I have to say that if I just read the date (auth is not required for this action) ...

 curl -u admin:admin http://10.104.37.1:80/onvif/device_service --data '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' 

... he does it right, but if I add -digest, the process follows the previous behavior.

Can anyone give me a hint?

Thanks!

EDIT: Isn't it strange that content length = 0?

+3
source share
1 answer

I finally found a solution : I added the command - anyauth to the full command. Anyway, I still don't know why using the --digest option terminates the process.

+1
source

Source: https://habr.com/ru/post/925015/


All Articles