我有兴趣将 torrent 文件渲染为可读形式(查看它引用了哪些文件,它包含哪些跟踪器信息等)。我可以使用什么工具来做到这一点?
答案1
您可以使用transmission-show
, 包含在Gnome Transmission BitTorrent 客户端。
$ transmission-show amd64cd-5.1.2.iso.torrent
Name: amd64cd-5.1.2.iso
File: amd64cd-5.1.2.iso.torrent
GENERAL
Name: amd64cd-5.1.2.iso
Hash: e30c05f2330ba4869eefb90bf5978a505303b235
Created by:
Created on: Sun Feb 5 01:31:29 2012
Piece Count: 967
Piece Size: 256.0 KiB
Total Size: 253.3 MB
Privacy: Public torrent
TRACKERS
Tier #1
http://tracker.netbsd.org:6969/announce
FILES
amd64cd-5.1.2.iso (253.3 MB)
如果您使用的是旧版本传播,您可以使用旧transmissioncli --info
命令:
$ transmissioncli --info amd64cd-5.1.2.iso.torrent
Transmission 2.03 (11030) - http://www.transmissionbt.com/
hash: e30c05f2330ba4869eefb90bf5978a505303b235
name: amd64cd-5.1.2.iso
tracker tier #1:
announce: http://tracker.netbsd.org:6969/announce
size: 253325312 (966 * 262144 + 94208)
file(s):
amd64cd-5.1.2.iso (253325312)
答案2
您可以使用aria2。从aria2c(1) 手册页:
-S, --show-files[=true|false]
打印“.torrent”、“.meta4”和“.metalink”文件的文件列表并退出。如果是“.torrent”文件,还会打印附加信息(infohash、片段长度等)。
$ aria2c -S ubuntu-14.04.2-desktop-i386.iso.torrent >>> 打印文件“ubuntu-14.04.2-desktop-i386.iso.torrent”的内容... *** BitTorrent 文件信息 *** 评论:Ubuntu CDreleases.ubuntu.com 创建日期:2015 年 2 月 19 日星期四 22:17:32 GMT 模式:单人 宣布: http://torrent.ubuntu.com:6969/announce http://ipv6.torrent.ubuntu.com:6969/announce 信息哈希:33678ec8b0dfb8a9061348c8af7194268c0b8310 片长:512KiB 件数:2006年 总长度:0.9GiB (1,051,721,728) 名称:ubuntu-14.04.2-desktop-i386.iso 磁铁 URI:magnet:?xt=urn:btih:33678EC8B0DFB8A9061348C8AF7194268C0B8310&dn=ubuntu-14.04.2-desktop-i386.iso&tr=http%3A%2F%2Ftorrent.ubuntu.com%3A6969%2Fannounce&tr=http%3A%2 F%2Fipv6。 torrent.ubuntu.com%3A6969%2Fannounce 文件: idx|路径/长度 ================================================== ============================= 1|./ubuntu-14.04.2-desktop-i386.iso |0.9GiB (1,051,721,728) ---+-------------------------------------------------------- ----------------------------
答案3
btshowmetainfo
以前包含在 BitTorrent 发行版中,但现在主要随 BitTornado(BitTorrent 3.x 代码库的一个分支)一起安装,它就是这样做的。
$ btshowmetainfo amd64cd-5.1.2.iso.torrent
btshowmetainfo 20030621 - decode BitTorrent metainfo files
metainfo file.: amd64cd-5.1.2.iso.torrent
info hash.....: e30c05f2330ba4869eefb90bf5978a505303b235
file name.....: amd64cd-5.1.2.iso
file size.....: 253325312 (966 * 262144 + 94208)
announce url..: http://tracker.netbsd.org:6969/announce
答案4
您可以使用torrenttools
。
torrenttools info test.torrent
Metafile: /home/fbdtemme/Downloads/Fedora-Workstation-Live-x86_64-33.torrent
Protocol version: v1
Infohash: 7707056a138a00dd9b9eff4fab29f46233e2bad9
Piece size: 256 KiB (262144 bytes)
Created by:
Created on: 2020-10-26 15:52:05 UTC
Private: false
Name: Fedora-Workstation-Live-x86_64-33
Source:
Comment:
Announces:
tier 1 - http://torrent.fedoraproject.org:6969/announce
Files:
Fedora-Workstation-Live-x86_64-33
├── [1.04 KiB] Fedora-Workstation-33-1.2-x86_64-CHECKSUM
└── [1.91 GiB] Fedora-Workstation-Live-x86_64-33-1.2.iso
1.91 GiB in 0 directories, 2 files
您还可以仅检索在 shell 脚本中有用的特定字段。
torrenttools show infohash test.torrent
17ebe3685a498afcc06e2241e875a1726e7c38c2
torrenttools show announce Fedora-Workstation-Live-x86_64-33.torrent
http://torrent.fedoraproject.org:6969/announce
查看 json 格式的解码 torrent 文件会很有用。
torrenttools info --raw Fedora-Workstation-Live-x86_64-33.torrent
{
"announce": "http://torrent.fedoraproject.org:6969/announce",
"creation date": 1603727525,
"info": {
"files": [
{
"length": 1062,
"path": [
"Fedora-Workstation-33-1.2-x86_64-CHECKSUM"
]
},
{
"length": 2049490944,
"path": [
"Fedora-Workstation-Live-x86_64-33-1.2.iso"
]
}
],
"name": "Fedora-Workstation-Live-x86_64-33",
"piece length": 262144,
"pieces": "<7819 piece hashes>"
}
}
您可以使用 --show-pieces 选项扩展pieces字段。
torrenttools info --raw --show-pieces Fedora-Workstation-Live-x86_64-33.torrent
{
"announce": "http://torrent.fedoraproject.org:6969/announce",
"creation date": 1603727525,
"info": {
"files": [
{
"length": 1062,
"path": [
"Fedora-Workstation-33-1.2-x86_64-CHECKSUM"
]
},
{
"length": 2049490944,
"path": [
"Fedora-Workstation-Live-x86_64-33-1.2.iso"
]
}
],
"name": "Fedora-Workstation-Live-x86_64-33",
"piece length": 262144,
"pieces": [
"<piece: 0, SHA1: 52095a748e9337d31631fce7fe6d7d5a40f60352>",
"<piece: 1, SHA1: 5a241db1f3d0e6b794d04594253b5c1931cacafe>",
"<piece: 2, SHA1: 06adbe76ca7764c142fd2c00f57fab5dc7667171>",
"<piece: 3, SHA1: 40893918608f042fe41abcc4e4f4e04f92ad3665>",
"<piece: 4, SHA1: 0b491f424e765b64ef38329e1935bd2c3ceff4e0>",
"<piece: 5, SHA1: deffa6b0a4ca6b11b04caa785a4ef80b0ee4a238>",
...
torrenttools 还可以使用新的 BitTorrent v2 图元文件和混合 torrent。
torrenttools info bittorrent-v2-hybrid-test.torrent
Metafile: /home/fbdtemme/Documents/project/torrent/torrenttools/tests/resources/bittorrent-v2-hybrid-test.torrent
Protocol version: v1 + v2 (hybrid)
Infohash: v1: 8c9a2f583949c757c32e085413b581067eed47d0
v2: d8dd32ac93357c368556af3ac1d95c9d76bd0dff6fa9833ecdac3d53134efabb
Piece size: 512 KiB (524288 bytes)
Created by: libtorrent
Created on: 2020-06-03 08:45:06 UTC
Private: false
Name: bittorrent-v1-v2-hybrid-test
Source:
Comment:
Announces:
Files:
bittorrent-v1-v2-hybrid-test
├── [6.23 MiB] Darkroom (Stellar, 1994, Amiga ECS) HQ.mp4
├── [19.6 MiB] Spaceballs-StateOfTheArt.avi
├── [ 326 MiB] cncd_fairlight-ceasefire_(all_falls_down)-1080p.mp4
├── [58.8 MiB] eld-dust.mkv
├── [ 265 MiB] fairlight_cncd-agenda_circling_forth-1080p30lq.mp4
├── [42.5 MiB] meet the deadline - Still _ Evoke 2014.mp4
├── [61.0 B] readme.txt
├── [25.1 MiB] tbl-goa.avi
└── [ 111 MiB] tbl-tint.mpg
854.06 MiB in 0 directories, 9 files
免责声明:我是该工具的作者。
欲了解更多信息,请参阅: