スマートフォンとPC間のファイルのやり取りをするBifrost

AndroidスマートフォンとPC間のファイル転送にBluetoothをよく使っていました.最近2.4GHzのWi-Fiを使っているせいか転送に失敗することが多いです.
有線だと確実ですが少し面倒.アドホックにファイル転送用のhttpdを起動してスマートフォン<→PC間のファイルのやり取りが出来るBifrostというものを知ったので試した見ました.

導入

導入はGithub Releasesからビルド済バイナリをダウンロードするか, go install github.com/axiom0x0/bifrost@latest で導入できます.Linux armhfもあるのが嬉しい.

利用例

$ bifrost
bifrost v1.1.0 — bridge files to your phone via QR code

Usage:
  bifrost <file> [port]              send a file (+ upload)
  bifrost -f <file> [-p port]        send a file (+ upload)
  bifrost -r [-o dir] [-p port]      receive files only
  bifrost -d <dir> [-p port]         browse a directory (+ upload)

  Add -e to any mode for encrypted transfers.

Flags:
  -1	exit after first completed transfer
  -d string
    	directory to browse and serve
  -e	enable end-to-end encryption
  -f string
    	file to serve (send mode)
  -o string
    	output directory for received files (default ".")
  -p int
    	port to serve on (default 8888)
  -r	receive-only mode
  -v	print version and exit

Examples:
  bifrost myfile.gpx              send file, allow uploads back
  bifrost -f photo.jpg -p 9090    send on custom port
  bifrost -r -o ~/Downloads       receive files only
  bifrost -d ~/Photos             browse directory
  bifrost -e myfile.gpx           send with encryption
  bifrost -e -r                   receive with encryption

ファイル転送時にはQR codeが表示されるのでそれをスマートフォン側で読み込むと便利です.勿論URLの入力でもok.

pcからスマートフォンへのファイル送信例
$ bifrost file.txt

█████████████████████████████████
█████████████████████████████████
████ ▄▄▄▄▄ █ ▄ ▀▀▀▄█▄█ ▄▄▄▄▄ ████
████ █   █ █▀ ▀▄█▄▀▀▄█ █   █ ████
████ █▄▄▄█ ███ █▄▀▄█▀█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ █ █▄█▄█ █▄▄▄▄▄▄▄████
████ █  █ ▄▄▀▀▀▀▄ █ ▄█ ▀▀▄█ ▄████
██████▀▄ ▀▄ ▄▄█▄█▀█▄▄▄██ ▀▀██████
████▄██ █▄▄▄▀▄ ▀ ▀▄█ ▀ █▀█▄▄ ████
████▀▄ █▀▄▄▄ ▄█ █▄▄▄▄█▀▄█▀▄▄▀████
███████▄▄▄▄▄▀█ █▄█▄█ ▄▄▄ ▄▄▄ ████
████ ▄▄▄▄▄ █ █▀▀█ ██ █▄█ ▄▄▄ ████
████ █   █ █▀▄ ██▄██ ▄▄ ▄█▀▄▀████
████ █▄▄▄█ █▄▀ ▀▀▀▄██ ██ ▄ ▄█████
████▄▄▄▄▄▄▄█▄██▄▄████▄█▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

  Mode:  send
  File:  file.txt (126.6 KB)
  URL:   http://192.168.100.22:8888
  Port:  8888

Scan QR to download (uploads also accepted).
Press Ctrl+C to stop.

受診時には -r オプションと, -o で受信先(既定値はカレントディレクトリ)を指定します.

ファイル受信例
$ bifrost -r -o ~/Downloads/

E2EEを有効にしたいときは -e オプションを,そのままだと起動しっぱなしなので, -1 オプションや,timeoutコマンドを挟むと終了し忘れがなくて良さそうです.

timeoutで300秒に制限.1回だけ,E2EEを有効にして受信
$ timeout 300 bifrost -1 -e -r -o ~/Downloads/

█████████████████████████████████████████████
█████████████████████████████████████████████
████ ▄▄▄▄▄ █▄▀▄ █▀▄  ▄█ ▄▄▄█▀  █ █ ▄▄▄▄▄ ████
████ █   █ █▀▀▄▀▄▀█▄▄▄▀██▄ ▀ ▀▄▀██ █   █ ████
████ █▄▄▄█ █ ██▀ ▀▀   ▄▀▀ ▄▄ ██▄██ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ ▀▄▀▄▀▄▀ █▄▀▄▀ ▀▄█▄█▄█▄▄▄▄▄▄▄████
████▄▀██▄▀▄▄▄█  █▀█▄▄█▀ ▄ ▀ ▄ ▀▄▀▄▄▄ ▄█▀▄████
█████▀ ▄█ ▄  ▄█▄ █▄ ▀▀  ▀  ▄███ █▄▄▀▄█ ▀█████
████▀  ▀ ▀▄▀▀▄▀▄▄▄▄█▀█▀█▀ █▀▀▀▄ █▀▄▀▀▀▄▄ ████
████▀▄▀██▄▄███▀ ▀   █ ▀█    ██▄  █▄▄█▄ ██████
████▀ ▀█  ▄ ▄▄▄▀█▄ ▄▀█▄ ▀▄▄ █▀▀▄▀ ▄█    ▄████
████▀ █ █ ▄▀ ██▀█  █▄ ▀█▄▀▄ ▄██ ▄ ▀▀▀█▀▀█████
████ ▀██▀█▄▄██ ▄▀▄▄ ▀ █▄█▄ ▀▀█  ▄█▄▀▀█▄▀█████
████▄▀▀▀ ▄▄█▄▀ ▄███▄ █▄█ ▀█▄██▄▄▄▀▀    ▀█████
████ ▀ █  ▄ █▄▄ ▄▀ ▄▄█▀▀▄██▄██▄▀▀ ▄▄▀▄▄▄▄████
████████▀ ▄ ▄ █▀▀█▀ ▀▀▀ ▀▀ ▄ ▄▄▄▀▀ ▀▄█ ▀▀████
████▄▄█▄██▄█▀▄▄▀ ▄ ▀▀█▀▀▄ ▄▀▀█▄▀ ▄▄▄ █▀▄▄████
████ ▄▄▄▄▄ █▄█▄▄  ▀▄█ ▀█▀█▀▄██▀▀ █▄█  ▀▀█████
████ █   █ █▄▀▀ ▄▄ ▄▀▀▄ ▀█▄▀▀▀▄▀▄▄  ▄▀ ▄▀████
████ █▄▄▄█ ██▀▀▀▄ ▀█▄▀▄█▄ █ ▄▄█▄▄▀ ▀▀▀ ▀█████
████▄▄▄▄▄▄▄█▄▄█▄███▄▄██▄▄▄▄███▄▄██▄██▄▄▄▄████
█████████████████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

  Mode:  receive 🔒
  Save:  /home/matoken/Downloads
  URL:   http://192.168.100.22:8888#redMu2lgAsN_jmLduAoaM6lVmvxslMGNDl917QrfZ8g
  Port:  8888

Scan QR to upload files.
Press Ctrl+C to stop.

環境

$ bifrost -v
bifrost v1.1.0
$ lsb_release -dr
Description:	Debian GNU/Linux forky/sid
Release:	n/a
$ arch
x86_64

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)