This is a bash script I wrote that uses Termux and its Android api to allow you to send files from your Android device to KBFS using your device's 'share' menu. I wrote this mainly because (at the time of this writing) you can only upload certain file types (images and videos, I believe) from your mobile device to your KBFS, and I've seen a lot of people asking when Keybase will allow more filetypes.
It takes a little bit of setting up, but it's not too bad, and once you've set it up it should be pretty straight forward to use. I'll walk you through setting it up here.
Before we begin, you need to make sure to have both Termux, and the Termux:API apps installed on your phone. You can get them from either the Play Store, or F-Droid, but you need to make sure that you get them both from the same place.
Once you have Termux and the Termux:API installed, there are a few packages you need to install inside Termux. Termux gives you a Linux environment on Android, and Termux packages are installed with the APT package manager. If you've used Debian or Ubuntu you will likely already be familiar with the package manager. Termux provides a
pkg command, which is a wrapper for APT. As a side note, Termux:API is just a plugin for Termux that allows Termux to access certain parts of the Android system, but it's not an app that you will see in your app drawer, so from here on, we don't need to worry about Termux:API as long as it's installed (although in a second we're going to install the termux-api package, which is just a collection of bash scripts that lets you interact with the Android system through Termux... you don't have to worry about any of this if it's confusing at all, just follow along with my instructions).
Open Termux and run the following command:
$ pkg install termux-api jq expect keybase kbfs curl
Before you run this script for the first time you will need to log into Keybase from within Termux so you can add Termux as a device in Keybase. Just run the login command:
$ keybase login
... and follow the on-screen prompts.
Now we're ready to install the script. When you share a file to Termux, it will look in a specific folder for a script with a specific name, and use that script if it exists. For this reason, we first need to create that folder, and go into it:
$ mkdir ~/bin $ cd ~/bin
Now that we're in the folder where we want the script to be, we need to download the script and make it executable:
$ curl -O https://dxb.keybase.pub/scripts/termux-file-editor $ chmod +x termux-file-editor
That's it! You now have the ability to share files from your Android device directly to your KBFS!
Now that we have the script installed, we just need to share a file from any file explorer. I use Solid Explorer, but you should be able to use any file explorer, including whatever comes stock with your phone.
In any file explorer you use, you'll likely just need to navigate to the file you're sending, and long press on it, then choose 'share' from the menu. After choosing 'share' you'll be presented with a list of different apps you can share to. Find Termux in this list and select it. Now you should be presented with a dialog from Termux asking where you want to save the file to. At this point, you'll want to tap the 'edit' button on the bottom right of the dialog in order to send the file to the KBFS script. When you do this, you will see a Termux window come up and run the script. There are a few things to note about running the script itself:
termux-filesfolder, the script will fail. I may change this in the future to have the script prompt you to ask if the file should be overwritten.
This is a set of scripts I've been working on to run keybase bots in docker containers. This short writeup will mostly tell you how to use my scripts to build your own image, and I assume that you already have docker installed and configured on your own system. I'd also like to point out that this is a hobby project, and I likely did some stuff that you wouldn't see or want to see in a production environment. Feel free to contact me on Keybase if you can suggest any improvements.
|-- Dockerfile |-- build.sh `-- keybase `-- start.sh
This is the Dockerfile that holds the instructions for building our image
This is a bash script which will do the following:
All files in this folder will be copied into
/home/keybase when the image is built. This is where you should put any scripts you'll be running from
start.shin a text editor, and at the bottom of the script, replace
/bin/bashwith the command you want to run at start time.
Dockerfileto have them installed in the image.
build.sh, passing it your keybase username and paper key (paper key will need to be in quotes) -- run
build.sh -hfor more options, for example, if you're running an alternate account in this container you can pass
-b <your main username>to receive a message in keybase when the container comes up.
I've created a small site with keybase pages to share my personal contact info with certain keybase contacts. If you're on that list, you can run the following command from a bash terminal to grab my signed contact info. Your bash shell must have
jq installed for this to work. If you'd like to be added to the list, you can contact me on keybase.
user=$(keybase config get current_user | tr -d '"'); \ password=$(curl https://me.samhofi.us/passwords.txt | jq -r ".$user" | keybase decrypt); \ curl -u $user:$password https://me.samhofi.us/protected/contact.txt
I wrote a small script to upload an image from a URL to a team chat. This is mostly just a proof of concept. This script is to be run in a bash terminal. Your bash shell must have
./upload_image.sh <team> <channel> <url>
./upload_image.sh keybasefriends random https://keybase.io/images/icons/icon-keybase-logo-48.png
This file was last updated on 2018-11-16 at 14:30:19 Eastern