Code: Select all
#!/bin/bash
password=$1
echo " pwd: $password"
timestamp=`date +%s%N | cut -b1-13`
echo "timestamp: $timestamp"
sha1=($(echo "password=$password×tamp=$timestamp" | sha1sum))
echo " sha1: [${sha1}]"
md5=($(echo $sha1 | md5sum))
echo " md5: [${md5}]"
echo ""
curl -s "http://192.168.178.61:10800/v1/login?sign=$md5×tamp=$timestamp" | jq
sadly the api does not let me log in:
Code: Select all
[fk@linux ~]$ ./cam.sh testpassword
pwd: testpassword
timestamp: 1548173780240
sha1: [a355c64d15f31dea5a89b30a5e96592d3252afb9]
md5: [fe557cee8d1867ded3276af345d98bca]
{
"error": {
"code": 10000,
"msg": "sign error or password error"
},
"status": 0
}
Does anyone have an idea what is wrong? I rechecked that correct api password is set in printer for sure.
Can someone verify that im generating correct sha1 and md5 for password "testpassword" and timestamp 1548173780240?