ARGS> QOP REALM NONCE*
home/admin> curl -u admin:password -I http://10.20.30.40:80/ISAPI/System/deviceInfo
HTTP/1.1 401 Unauthorized
Date: Wed, 14 Aug 2024 10:45:49 GMT
X-Frame-Options: SAMEORIGIN
Content-Length: 178
Content-Type: text/html
Connection: close
WWW-Authenticate: Digest qop="auth", realm="IP Camera(FG513)", nonce="363366353a35303765373163623ac37af43d2139923cb0440c109a7e65c2", stale="FALSE"
TimeStamp
home/admin> TS=`date '+%s'` ; echo $TS ${#TS}
1723605034 10
cnonce
home/admin> CNONCE=`openssl rand -base64 32 ` ; echo $CNONCE ${#CNONCE}
2yaqtY/4ykO+XQ1iphW1/kHdwpX91S1ISWI3pFEY2Ys= 44
WWW-Authorization: Digest
CNONCE=`openssl rand -base64 32 `
NC=00000001
QOP=auth
########################################################################
#
# H1=<user>:<realm>:<password>
# H2=<method>:<uri>
#
# DIGEST=MD5( MD5(H1):<nonce>:<nc>:<cnonce>:<qop>:MD5(H2) )
#
########################################################################
HA1SRC=$USERID:$REALM:$USERPWD
HA2SRC=$METHOD:$URI
HA1=`echo -n $HA1SRC | openssl dgst -md5 | awk '{print $2}' `
HA2=`echo -n $HA2SRC | openssl dgst -md5 | awk '{print $2}' `
HA9SRC=$HA1:$NONCE:$NC:$CNONCE:$QOP:$HA2
DIGEST=`echo -n $HA9SRC | openssl dgst -md5 | awk '{print $2}' `
HEADERS=
HEADERS=$HEADERS""
HEADERS=$HEADERS"Authorization: "
HEADERS=$HEADERS"Digest username=\"$USERID\", "
HEADERS=$HEADERS"realm=\"$REALM\", "
HEADERS=$HEADERS"nonce=\"$NONCE\", "
HEADERS=$HEADERS"uri=\"$URI\", "
HEADERS=$HEADERS"cnonce=\"$CNONCE\", "
HEADERS=$HEADERS"nc=$NC, "
HEADERS=$HEADERS"qop=auth, "
HEADERS=$HEADERS"response=\"$DIGEST\" "
HEADERS=$HEADERS""
snd-get-system-info
home/admin> www-auth 10.20.30.40 admin password http://10.20.30.40:80/ISAPI/System/deviceInfo -v
* Trying 10.20.30.40:80...
* Connected to 10.20.30.40 (10.20.30.40) port 80 (#0)
* Server auth using Digest with user 'admin'
> GET /ISAPI/System/deviceInfo HTTP/1.1
> Host: 10.20.30.40
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Date: Fri, 16 Aug 2024 09:01:05 GMT
< X-Frame-Options: SAMEORIGIN
< Content-Length: 178
< Content-Type: text/html
< Connection: close
< WWW-Authenticate: Digest qop="auth", realm="IP Camera(FG513)", nonce="633430333a35613662343466383ac37af43d2139923cb0440c109a7e65c2", stale="FALSE"
<
* Closing connection 0
* Issue another request to this URL: 'http://10.20.30.40:80/ISAPI/System/deviceInfo'
* Hostname 10.20.30.40 was found in DNS cache
* Trying 10.20.30.40:80...
* Connected to 10.20.30.40 (10.20.30.40) port 80 (#1)
* Server auth using Digest with user 'admin'
> GET /ISAPI/System/deviceInfo HTTP/1.1
> Host: 10.20.30.40
> Authorization: Digest username="admin", realm="IP Camera(FG513)", nonce="633430333a35613662343466383ac37af43d2139923cb0440c109a7e65c2", uri="/ISAPI/System/deviceInfo", cnonce="ZmE5MDgwMDk5Y2Y1MGEwZjlkNGFmOTFlZTQ0YzZkYTI=", nc=00000001, qop=auth, response="4e0a2ca069e09990ed437951e95dbc90"
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Fri, 16 Aug 2024 09:01:05 GMT
< X-Frame-Options: SAMEORIGIN
< Cache-Control: no-cache
< Content-Length: 1148
< Connection: close
< Content-Type: application/xml
<
<?xml version="1.0" encoding="UTF-8"?>
<DeviceInfo version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<deviceName>Network Speaker</deviceName>
<deviceID>00000000-1111-2222-3333-444444444444</deviceID>
<deviceDescription>VoiceSpeaker</deviceDescription>
<deviceLocation>hangzhou</deviceLocation>
<systemContact>Hikvision.China</systemContact>
<model>DS-QAXYXYZ-ABC</model>
<serialNumber>DS-QAXYXYZ-ABC202400000000000000000</serialNumber>
<macAddress>00:11:22:33:44:55</macAddress>
<firmwareVersion>V1.3.0</firmwareVersion>
<firmwareReleasedDate>build 240327</firmwareReleasedDate>
<encoderVersion>V1.3.0</encoderVersion>
<encoderReleasedDate>build 240220</encoderReleasedDate>
<bootVersion>V1.3.4</bootVersion>
<bootReleasedDate>100316</bootReleasedDate>
<hardwareVersion>0x0</hardwareVersion>
<deviceType>VoiceSpeaker</deviceType>
<telecontrolID>88</telecontrolID>
<supportBeep>true</supportBeep>
<supportVideoLoss>false</supportVideoLoss>
<firmwareVersionInfo>B-R--0</firmwareVersionInfo>
<manufacturer>hikvision</manufacturer>
<subSerialNumber>FG5133321</subSerialNumber>
<OEMCode>1</OEMCode>
</DeviceInfo>
* Closing connection 1
snd-chk-audio-play
/home/admin> snd-chk-audio-play 10.20.30.40 admin password
<?xml version="1.0" encoding="UTF-8"?>
<AccessControl version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<isSupportCustomAudio>true</isSupportCustomAudio>
<isSupportSearchCustomAudio>true</isSupportSearchCustomAudio>
<isSupportMaintenanceDataExport>true</isSupportMaintenanceDataExport>
<isSupportTTSAudio>true</isSupportTTSAudio>
<TTSChannelsCap>
<channelsList>
<channelsID>1</channelsID>
</channelsList>
</TTSChannelsCap>
<isSupportAddCustomAudioFolder>true</isSupportAddCustomAudioFolder>
<isSupportDeleteCustomAudioFolder>true</isSupportDeleteCustomAudioFolder>
<isSupportModifyCustomAudioFolder>true</isSupportModifyCustomAudioFolder>
<isSupportGetCustomAudioFolder>true</isSupportGetCustomAudioFolder>
<isSupportAddFolderCustomAudio>true</isSupportAddFolderCustomAudio>
<isSupportDeleteFolderCustomAudio>true</isSupportDeleteFolderCustomAudio>
<isSupportSearchFolderCustomAudio>true</isSupportSearchFolderCustomAudio>
<isSupportCustomAudioPlay>true</isSupportCustomAudioPlay>
</AccessControl>
isSupportCustomAudio & isSupportTTSAudio
/home/admin> snd-chk-audio-play 10.20.30.40 admin password | sed -e 's/ xmlns.*=".*"//g' | xmlstarlet sel -t -v "/AccessControl/isSupportCustomAudio"
true
/home/admin> snd-chk-audio-play 10.20.30.40 admin password | sed -e 's/ xmlns.*=".*"//g' | xmlstarlet sel -t -v "/AccessControl/isSupportTTSAudio"
true
snd-get-audio-params
/home/admin> snd-get-audio-params 10.20.30.40 admin password
{
"playDurationMode": {
"@opt": [
"selfDefine",
"auto"
]
},
"playDuration": {
"@min": 1,
"@max": 86399
},
"audioLevel": {
"@min": 0,
"@max": 15
},
"audioOutID": {
"size": 1,
"@min": 1,
"@max": 1
},
"volume": {
"@min": 0,
"@max": 10
},
"audioVolume": {
"@min": 0,
"@max": 100
}
}
snd-get-audio-list
home/admin> snd-get-audio-list 10.20.30.40 admin password
{
"CustomAudioInfoList": [
{
"customAudioID": 4,
"customAudioName": "M001.mp3",
"customAudioPath": "/emmc/config/Media/M001.mp3",
"audioFileFormat": "mp3",
"audioFileSize": 2068708,
"audioFileDuration": 258,
"customAudioFile": {
"filePathType": "URL",
"filePath": "/ISAPI/AccessControl/EventCardLinkageCfg/CustomAudio/download?CustomAudioId=4&format=json"
}
}
]
}
snd-custom-audio-play
ARGS> customAudioID = 4
/home/admin> snd-custom-audio-play 10.20.30.40 admin password 4
{
"statusCode": 1,
"statusString": "OK",
"subStatusCode": "ok"
}
snd-custom-audio-stop
ARGS> customAudioID = 4
/home/admin> snd-custom-audio-stop 10.20.30.40 admin password 4
{
"statusCode": 1,
"statusString": "OK",
"subStatusCode": "ok"
}
snd-trigger-audio-play
ARGS> channelsID = 1
ARGS> customAudioID = 4 audioVolume = 10 loopPlaybackTimes = 3
/home/admin> snd-custom-audio-stop 10.20.30.40 admin password 4
{
"statusCode": 1,
"statusString": "OK",
"subStatusCode": "ok"
}
/home/admin> snd-trigger-audio-play 10.20.30.40 admin password 4 10 3
{
"statusCode": 1,
"statusString": "OK",
"subStatusCode": "ok"
}
/home/admin> snd-trigger-audio-play 10.20.30.40 admin password 4 10 3
{
"statusCode": 2,
"statusString": "Device Busy",
"subStatusCode": "deviceBusy"
}