#!/bin/ksh # # mkp224o-vanity-address-to-onionshare.ksh # # Take an mkp224o Vanity Tor v3 address and turn it into a runnable # instance using onionshare.cli. Serves a single file, index.html. # # Usage: ## in the mkp022o directory for the address with the secret key # ./mkp224o-vanity-address-to-onionshare.ksh # # This will produce a text file and a script to start OnionShare. # # http://kruhftykla2p7tr23o4amfcgkms7h2nmdsp6tzuoivf7yy6jpinvh5ad.onion # @kruhft # 2025 if pwd | grep -v '.onion'; then echo "Run this from the directory with the keys in it as found by mkp224o." exit 1 fi site="${1-$(basename $(pwd))}" site="${site/.onion/}" secret_key="$(dd if=hs_ed25519_secret_key bs=1 skip=32 | base64 -w 0)" cat < "start-onionshare.cli-${site}.sh" #!/bin/sh cp "${site}".json "${site}".json.bak onionshare.cli --public \ --persistent "${site}".json \ --website \ --disable-files \ --log-filenames \ index.html EOF cat < "${site}.json" { "onion": { "private_key": "${secret_key}", "client_auth_priv_key": null, "client_auth_pub_key": null }, "persistent": { "mode": "website", "enabled": true, "autostart_on_launch": true }, "general": { "title": "OnionShare for ${site}.", "public": true, "autostart_timer": 0, "autostop_timer": 0, "service_id": "${site}" }, "share": { "autostop_sharing": true, "filenames": [ "index.html" ], "log_filenames": true }, "receive": { "data_dir": "/var/tmp", "webhook_url": null, "disable_text": true, "disable_files": true }, "website": { "disable_csp": false, "custom_csp": null, "filenames": [ "index.html" ], "log_filenames": true }, "chat": {} } EOF [[ ! -e index.html ]] && touch index.html echo "Created start-onionshare.cli-${site}.sh." exit 0 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 kruhft