Giter Club home page Giter Club logo

Comments (7)

hzgjq avatar hzgjq commented on September 27, 2024

重试是为了避免超时或网络传输失败,
出现错误码310000可能的原因有:

  1. 消息内容中不包含任何关键词
  2. timestamp 无效
  3. 签名不匹配
  4. IP地址不在白名单
    如果偶尔出现的话往往是本地时间和服务器时间差异过大造成timestamp 无效

from dingtalkrobot.

shadu120 avatar shadu120 commented on September 27, 2024

1.走的就是验签方式,不存在关键字问题
2.时间肯定有效的
3.这个就是问题
4.同1

经过我多测试发现,URL编码后带%6E的这种,是不能通过验签的,可以重新生成一次。

function GetSafeSign(){
	GetTimeStamp
	Sign="$(URLEncode $(echo -en "${TimeStamp}\n${Secret}" | openssl dgst -sha256 -hmac "${Secret}" -binary | openssl base64))"
	while [[ $Sign =~ "%6E" ]] ||  [[ $Sign == "" ]]; do
		ShowStatus $Sign
		sleep 1
		StatusX="[$(_yellow "警告")] Openssl->sha256->hmac->base64->urlencode,[$(_yellow "重新生成...")]"
		ShowStatus "$StatusX"
		GetTimeStamp
		Sign="$(URLEncode $(echo -en "${TimeStamp}\n${Secret}" | openssl dgst -sha256 -hmac "${Secret}" -binary | openssl base64))"
		# echo $Sign

	done
}

from dingtalkrobot.

shadu120 avatar shadu120 commented on September 27, 2024

macOS Ventura 13.1

from dingtalkrobot.

hzgjq avatar hzgjq commented on September 27, 2024

奇怪,BASE64编码后只有 + / = 三个符号才会被URL编码。%6E对应的是字母n,不应该会被编码呀。

from dingtalkrobot.

shadu120 avatar shadu120 commented on September 27, 2024

可以看我上面截图,最后一个310000的返回值,所对应的计算结果就有%6E

from dingtalkrobot.

hzgjq avatar hzgjq commented on September 27, 2024

debian下用代码生成了600次签名,没有发现%6E。怪了,难道和macOS不兼容。

function TestMessage() {
	ShowStatus "[$(_white "信息")] 开始测试消息。"
	try=0
	error=0
	while true; do
		try="$((${try}+1))"
		if [[ -n "${Secret}" ]]; then
			GetTimeStamp
			Sign="$(URLEncode $(echo -en "${TimeStamp}\n${Secret}" | openssl dgst -sha256 -hmac "${Secret}" -binary | openssl base64))"
			[[ ${Sign} =~ "%6E" ]] && error="$((${error}+1))" && ShowStatus "[$(_yellow "错误")]: ${Sign}"
			ShowStatus "[$(_white "${error}/${try}")]: ${Sign}"
		fi
		sleep 1
	done
}

image

from dingtalkrobot.

shadu120 avatar shadu120 commented on September 27, 2024

神奇,先不纠结了。
感谢你的代码和思路,解决了我的问题!

from dingtalkrobot.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.