如何将 Bit Torrent info_hash(从 Wireshark 获取)转换为 SHA1 哈希
我正在运行 Snort,它检测一些 P2P 活动,特别是 BitTorrent 公告请求。我看到 HTTP GET /announce.php?info_hash=XXX... 请求,我正在尝试将此 XXX 转换为正确的 SHA1 哈希值,以尝试了解正在下载的内容。
我读过各种内容,说这是 URL 编码的,还有其他人说只需删除 % 字符 - 但我无法重现这一点。
谁能建议如何做到这一点?
I'm running Snort which detects some P2P activity, specifically the BitTorrent announce request. I see the HTTP GET /announce.php?info_hash=XXX... request and I'm trying to convert this XXX into a proper SHA1 hash to try and get an idea of what is being downloaded.
I've read various things that say this is URL encoded, and others that say just remove the % character - however I am unable to reproduce this.
Can anyone suggest how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,知道我知道。
info_hash
是 SHA1 哈希值。例如:%5d%97%dbA%d7a%2b%92%f5%c2%ef%dcv%bf%e7%e6%03%24%85%0a
。如果您使用$_GET['info_hash']
,它将不起作用,因为%
s。您需要使用
$_SERVER['QUERY_STRING']
。如何在 PHP 中获取 info_hash 的 SHA1 哈希值的代码示例:
Hash: %5d%97%dbA%d7a%2b%92%f5%c2%ef%dcv%bf%e7%e6%03%24%85%0a -> ; 5d97db41d7612b92f5c2efdc76bfe7e60324850a
Okay, know I know.
info_hash
is an SHA1 hash. And an example of it is:%5d%97%dbA%d7a%2b%92%f5%c2%ef%dcv%bf%e7%e6%03%24%85%0a
. If you use$_GET['info_hash']
, it will not work, because of the%
s.You need to use
$_SERVER['QUERY_STRING']
.Code example how to get SHA1 hash of info_hash in PHP:
Hash: %5d%97%dbA%d7a%2b%92%f5%c2%ef%dcv%bf%e7%e6%03%24%85%0a -> 5d97db41d7612b92f5c2efdc76bfe7e60324850a
不,可以,
但是您可以使用 info_hash 作为键在 DHT 网络上搜索它
No, you can,
But you could use info_hash as key to search it on DHT network
info_hash
是 SHA1 哈希值。它是一个二进制哈希值,经过 URL 编码以包含在 URL 中。如果要将其转换为十六进制编码的哈希值,则需要从 URL 中提取它,进行 URL 解码和十六进制编码。例如在 Python 中:
info_hash
is an SHA1 hash. It's a binary hash, URL-encoded for inclusion in a URL.If you want to turn it into a hex-encoded hash, you will need to extract it from the URL, URL-decode, and hex-encode. For example in Python: