内容へ移動
wiki.matoken.org
ユーザ用ツール
ユーザー登録
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ユーザー登録
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
トレース:
linux:fileshare:droopy
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
# Droopy * [stackp/Droopy: Mini Web server that let others upload files to your computer](https://github.com/stackp/Droopy) ファイルのアップロードに使えるミニウェブサーバ Debian pkgが存在する(jessie以降)ので導入もお手軽.UbuntuはXenial(16.04)以降. RaspberryPi OS armhf(buster) にもpkgあり. * [Debian \-\- パッケージ検索結果 \-\- droopy](https://packages.debian.org/search?keywords=droopy) * [Ubuntu – パッケージ検索結果 \-\- droopy](https://packages.ubuntu.com/search?keywords=droopy) ちなみにw3mでも利用可能. ## install ``` $ sudo apt install droopy ``` ## help ``` $ droopy -h _____ | \.----.-----.-----.-----.--.--. | -- | _| _ | _ | _ | | | |_____/|__| |_____|_____| __|___ | |__| |_____| usage: droopy [-h] [-d DIRECTORY] [-m MESSAGE] [-p PICTURE] [--publish-files] [-a AUTH] [--ssl SSL] [--chmod CHMOD] [--save-config] [--delete-config] [--config-file CONFIG_FILE] [port] Usage: droopy [options] [PORT] positional arguments: port port number to host droopy upon optional arguments: -h, --help show this help message and exit -d DIRECTORY, --directory DIRECTORY set the directory to upload files to -m MESSAGE, --message MESSAGE set the message -p PICTURE, --picture PICTURE set the picture --publish-files, --dl provide download links -a AUTH, --auth AUTH set the authentication credentials, in form USER:PASS --ssl SSL set up https using the certificate file --chmod CHMOD set the file permissions (octal value) --save-config save options in a configuration file --delete-config delete the configuration file and exit --config-file CONFIG_FILE configuration file to load terminal arguments from. Example: droopy -m "Hi, this is Bob. You can send me a file." -p avatar.png ``` ## 起動 ``` $ droopy _____ | \.----.-----.-----.-----.--.--. | -- | _| _ | _ | _ | | | |_____/|__| |_____|_____| __|___ | |__| |_____| No configuration file found Files will be uploaded to /home/matoken/Documents HTTP server starting... Check it out at http://localhost:8000 ``` http://localhost:8000 にアクセスするとアップロードページが表示される.ポート変更も可能. ※同じネットワークからも見える. {{:linux:fileshare:20201224_22_12_20-4078272.jpg?400|}} ``` $ droopy -d ~/tmp/upload/ -m 'hello droopy' -p ~/tmp/upload/13-3733667.jpg --publish-files --chmod 400 ``` * `-d, --directory` アップロードディレクトリ指定(既定値はカレントディレクトリ) * `-m, --message` メッセージ * `-p, --picture` バナー画像 * `--publish-files, --dl` アップロードディレクトリのファイルをダウンロードできるようリンクを表示する.※このオプションを付けなくてもファイル名がわかっていればダウンロードできてしまう. * `--chmod` 8進数で指定したパーミッションになる {{:linux:fileshare:20201224_22_12_42-4084954.jpg?400|}} メモリ利用量の目安 ``` $ ps -eo rss,pid,args | egrep -i droopy | grep -v grep 19180 4126876 /usr/bin/python3 /usr/bin/droopy -d /tmp/upload -m hello droopy. -p /tmp/upload/20201224_18:12:13-3733667.jpg --chmod 400 $ ps -eo rss,pid,args | egrep -i droopy | grep -v egrep | awk '{sum += $1} END {print sum}' 22040 ``` ngrokでhttps公開する例 ``` $ ngrok http localhost:8000 --region jp --log stdout --bind-tls true ``` 同名のファイルガップロードされたときの動き `hoge.jpg` が既に存在する状態で同名のファイルをアップロードした場合,`hoge.jpg` は保持され,新たにアップロードされたファイルは `hoge-1.jpg` となった ## 問題 ### 認証が使えない debian packege版で `-a, --auth` で認証をかけようとするとこのようなエラーメッセージが表示されてdroopyが利用できない ``` Exception occurred during processing of request from ('127.0.0.1', 35512) Traceback (most recent call last): File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread self.finish_request(request, client_address) File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python3.9/socketserver.py", line 720, in __init__ self.handle() File "/usr/bin/droopy", line 397, in handle httpserver.BaseHTTPRequestHandler.handle(self) File "/usr/lib/python3.9/http/server.py", line 427, in handle self.handle_one_request() File "/usr/lib/python3.9/http/server.py", line 415, in handle_one_request method() File "/usr/bin/droopy", line 122, in decorated expected = 'Basic ' + base64.b64encode(self.auth) File "/usr/lib/python3.9/base64.py", line 58, in b64encode encoded = binascii.b2a_base64(s, newline=False) TypeError: a bytes-like object is required, not 'str' ``` 修正済のよう * [\-\-auth does not work with Python 3 · Issue \#24 · stackp/Droopy](https://github.com/stackp/Droopy/issues/24) * [Make basic authentication work for python 2 & python 3 · hdf/Droopy@3ac476f](https://github.com/hdf/Droopy/commit/3ac476fe4a703c1df99aa5208e1646468ee6aa65) この修正で動作するのを確認. ``` $ wget https://raw.githubusercontent.com/hdf/Droopy/3ac476fe4a703c1df99aa5208e1646468ee6aa65/droopy $ python3 ./droopy -a user:pass ``` reportbugした * [\#978020 \- droopy: Authentication option not available \- Debian Bug report logs](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=978020)
linux/fileshare/droopy.txt
· 最終更新: 2020/12/25 00:04 by
matoken
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ