bittorrent – matoken's blog https://matoken.org/blog Is there no plan B? Mon, 11 Mar 2024 02:37:48 +0000 ja hourly 1 https://wordpress.org/?v=7.0 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg bittorrent – matoken's blog https://matoken.org/blog 32 32 wget 的に使える bittorrent ダウンロードコマンドの tget コマンド https://matoken.org/blog/2024/03/10/tget-command-of-bittorrent-download-command-that-can-be-used-like-wget/ https://matoken.org/blog/2024/03/10/tget-command-of-bittorrent-download-command-that-can-be-used-like-wget/#respond Sat, 09 Mar 2024 21:24:31 +0000 https://matoken.org/blog/?p=3984

tget

tget という wget 的に利用できる bittorrent コマンドを試してみました.

go install で導入しました.

install & help
$ go install github.com/sweetbbak/tget@latest
$ which tget
/home/matoken/go/bin/tget
$ tget --help
Usage:
  tget [OPTIONS]

Application Options:
  -t, --torrent=    path to torrent or magnet link
  -o, --output=     path to a directory to output the torrent (default: /home/matoken)
  -4, --ipv4        dont use ipv6
  -q, --quiet       dont output text or progress bar
  -n, --no-cleanup  dont delete torrent database files on exit

Help Options:
  -h, --help        Show this help message

今回 Debian の iso image で試してみました.torrent file をダウンロードしなくても url をそのまま渡しても大丈夫でした.
logo はカラーじゃないとうまく見えません.

$ tget -t https://cdimage.debian.org/debian-cd/current/amd64/bt-cd/debian-12.5.0-amd64-netinst.iso.torrent
████████  ██████  ███████ ████████
   ██          ██           ██              ██
   ██          ██   ███  █████        ██
   ██          ██    ██   ██              ██
   ██           ██████  ███████    ██

 SUCCESS  Downloaded torrent file
 SUCCESS  Got torrent info!
debian-12.5.0-amd64-netinst.iso
peers [50] [051/100] ██████████████████████████████████████████████  51% | 7m33s[2024-03-09 02:39:29 +0900 WRN github.com/anacrolix/torrent client.go:1577]
  dropping peer *torrent.PeerConn 0xc000fc8008 [id="-qB4630-(FmL4fYxaelg", exts=0000000000100005 (ltep, fast, dht), v="qBittorrent/4.6.3"] with banned ip 192.140.152.200
peers [49] [100/100] ██████████████████████  100% | 14m30s ███████████████ 100% | 14m30sss
 SUCCESS  Downloaded: debian-12.5.0-amd64-netinst.iso
検証
$ wget https://cdimage.debian.org/debian-cd/current/amd64/bt-cd/SHA512SUMS \
  https://cdimage.debian.org/debian-cd/current/amd64/bt-cd/SHA512SUMS.sign
$ sha512sum --ignore-missing --check ./SHA512SUMS
debian-12.4.0-amd64-netinst.iso: OK
$ gpg --verify ./SHA512SUMS.sign
gpg: assuming signed data in './SHA512SUMS'
gpg: Signature made Mon Dec 11 09:46:27 2023 JST
gpg:                using RSA key DF9B9C49EAA9298432589D76DA87E80D6294BE9B
gpg: Good signature from "Debian CD signing key <debian-cd@lists.debian.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: DF9B 9C49 EAA9 2984 3258  9D76 DA87 E80D 6294 BE9B

お手軽に使えます.でもダウンロードが終わると seed せずに終了してしまいます.seed する機能は実装予定とのことなのでそれまでは lftp コマンドなどを使ったほうが良さそうです.

環境
$ ls ~/go/pkg/mod/github.com/sweetbbak/
tget@v0.0.0-20240308040335-76c53b4462e7
$ dpkg-query -W golang
golang:amd64    2:1.22~3
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
Codename:       trixie
$ arch
x86_64
]]>
https://matoken.org/blog/2024/03/10/tget-command-of-bittorrent-download-command-that-can-be-used-like-wget/feed/ 0
Bittorrentでダウンロードしたファイルのハッシュ値が一致しなくて困る https://matoken.org/blog/2018/07/02/trouble-because-the-hash-values-of-files-downloaded-with-bittorrent-do-not-match/ https://matoken.org/blog/2018/07/02/trouble-because-the-hash-values-of-files-downloaded-with-bittorrent-do-not-match/#respond Sun, 01 Jul 2018 21:24:59 +0000 http://matoken.org/blog/?p=1981 Raspbianの新しいバージョンがリリースされていた(2018-06-27)ので,Bittorentファイルを入手してTransmission-gtkでダウンロードしました.

2018-06-27:
  * New first-boot configuration wizard added
  * Recommended Software installer added
  * Bluej, Greenfoot, NodeRED, Claws Mail, VNC Viewer removed from image - can now be installed from Recommended Applications
  * Qpdfview PDF viewer installed instead of Xpdf
  * Version 65.0 of Chromium browser included, with latest Flash player
  * Volume up / down keys now change by 5% increments and affect currently-selected output device rather than internal device only
  * Network plugin now remembers previously-entered WiFi network passwords when prompting for reconnection
  * Serial port and serial console can now be switched separately in Raspberry Pi Configuration
  * Lxkeymap keyboard language setting application removed - replaced with dialog within Raspberry Pi Configuration
  * Wifi country and keyboard language setting dialogs in Raspberry Pi Configuration now callable from other applications
  * New version of Piboto font included to render with correct weight under some rogue applications
  * Reconnection to Bluetooth audio devices on reboot improved
  * Disable click-to-rename behaviour in file manager if single-click selection enabled
  * Appearance Settings dialog makes config changes to some Qt files to match selected theme
  * MIME file type associations improved
  * Multiple desktop management options removed from mouse middle-click menu
  * Menu shortcuts to Raspberry Pi website amended
  * Python 2 IDLE menu link removed
  * Sample Magpi PDF installed in /home/pi/MagPi
  * Various minor tweaks, bug fixes and appearance changes
  * Bluetooth updates
    - Firmware with Bluetooth 4.2 features
    - SCO profile suppot added via bthelper.service
  * Linux kernel 4.14.50+
  * Raspberry Pi firmware 748fb17992426bb29d99224b93cb962fefbdc833  

一晩経って確認するとダウンロードが終わっていたので念の為ハッシュ値を確認すると合いません.

$ ls -l ./2018-06-27-raspbian-stretch-lite.zip
-rw-r--r-- 1 mk mk 366870528 6月 30 03:02 ./2018-06-27-raspbian-stretch-lite.zip
$ sha256sum 2018-06-27-raspbian-stretch-lite.zip
ce2d2babed81d5b2d6b919dc8dc92bc915a7d89f09f3aaad1d9ae01f2471eb25 2018-06-27-raspbian-stretch-lite.zip
$ echo 3271b244734286d99aeba8fa043b6634cad488d211583814a2018fc14fdca313
3271b244734286d99aeba8fa043b6634cad488d211583814a2018fc14fdca313

Transmission-gtk の該当Torrentで右クリックし,「ローカルデータを検証」を行うとダウンロードファイルが99%になりました.この状態でしばらく放置すると再度100%になり,今度はハッシュ値が合致しました.なぜこういう動きになったのかは謎です…….

shutter_18-06-30_06:29:30_001

環境

$ dpkg-query -W transmission-gtk
transmission-gtk        2.94-1+b1
$ dpkg-query -W transmission-common
transmission-common     2.94-1
$ lsb_release -d
Description:    Debian GNU/Linux unstable (sid)
$ uname -m
x86_64
]]>
https://matoken.org/blog/2018/07/02/trouble-because-the-hash-values-of-files-downloaded-with-bittorrent-do-not-match/feed/ 0
wgetライクにbittorrentを取得するtget https://matoken.org/blog/2016/12/08/wget-like-bittorrent-client-tget/ https://matoken.org/blog/2016/12/08/wget-like-bittorrent-client-tget/#respond Thu, 08 Dec 2016 08:27:02 +0000 http://matoken.org/blog/?p=1481 wgetコマンドのような使い勝手のBittorrentクライアントのtgetを試してみました. node製MITライセンスのアプリケーションです.

導入はnpmで.tgetではなくt-getなので注意.

$ npm install -g t-get

torrentファイル,マグネットリンクの他torrent URLでもダウンロードできるようです. 実行すると以下のようなプログレスが表示されてダウンロードが始まります.行幅はハードコードされているようです.

$ tget https://downloads.raspberrypi.org/raspbian_latest.torrent
 downloading 1 files (1.4GB) [============================= ] 97% 64.0s 588.8KB/s 99 peers

ダウンロード完了時は以下のような感じ.ダウンロード完了後直ちに終了します.

$ tget https://downloads.raspberrypi.org/raspbian_latest.torrent
------------------
2016-11-25-raspbian-jessie.zip 1.4GB
------------------
 downloaded 1 files (1.4GB)

ファイルの保存先はカレントディレクトリで,カレントディレクトリに書き込めない場合はエラーにならずファイルが消えてしまうようです.

便利だけどアップロード関係なく終了してしまうのでBittorrentへの貢献度は低そうです. ちなみに最近はリモートのTransmissionをfile serverで動作させて,Transmission-remote-gtkで操作しています.

]]>
https://matoken.org/blog/2016/12/08/wget-like-bittorrent-client-tget/feed/ 0