0x0.st - temporary file hoster
Posted on December 26, 2024 • 2 minutes • 231 words
Temporary File Hosting with 0x0.st
Sometimes you need a quick way to upload and share temporary files, like logs, for troubleshooting. 0x0.st is a simple and open-source solution that
- Upload files for free
- Keep them at least 30 days (which should be more than enough for most cases)
- Has an API for you to use.
How I use it
I wrote a small script to upload files or data directly to 0x0.st. Here’s the script:
#!/bin/env bash
# Check if the script is receiving input from a pipe
if [ -p /dev/stdin ]; then
curl -sS -F "file=@-" https://0x0.st | tee >(xclip -selection clipboard)
# Check if a file argument is provided
elif [[ -n "$1" && -f "$1" ]]; then
curl -sS -F "file=@$1" https://0x0.st | tee >(xclip -selection clipboard)
else
echo "Usage: $0 <file> or pipe data to the script"
exit 1
fi
How it works is that it detects input: checks if data comes from a pipe or a provided file & send them over to 0x0.st. The script then print the upload URL & copy the URL to clipboard. You need curl
, tee
& xclip
for this to work.
Example usage
To upload logs or other output, you can pipe data like this:
journalctl -u foo | upload_0x0
Or upload a file:
upload_0x0 somefile.log
This generates a URL you can share with others for troubleshooting. Simple and effective!