Giter Club home page Giter Club logo

notesock's Introduction

notesock icon

notesock

Terminal pastebin server utilizing unix sockets, with exact expiry per paste to alleviate filesystem clutter.

It is meant to be used with netcat:

$ echo "Hello world" | ncat notesock.example.org 1234
https://notesock.example.org/abc123 | expires in 5m

This saves the paste do /configured/dir/abc123/index.txt which makes sure that browsers accessing the URL will interpret the file as .txt only, as only UTF-8 encoded data is accepted by the server.

To receive the paste:

$ curl https://notesock.example.org/abc123
Hello world

The files are stored unencrypted, thus, the user is made responsible to make their information private, e.g. by using gpg:

$ echo "hehe" > mysecret.file
$ gpg -cao mysecret.file.gpg mysecret.file
$ ncat notesock.example.org 1234 < mysecret.file.gpg  
https://notesock.example.org/def456 ...
$ curl https://notesock.example.org/def456 | gpg -d
hehe

Getting started:

Important

Because this server listens on an unix socket, a reverse proxy is necessary if it is supposed to be reachable from the interwebz. (Benefits of this are advanced rate-limiting features of the reverse proxy, with a lean-and-mean backend server that only manages validation, id generation and saving of the pastes.)

Packages

Build

$ git clone https://github.com/Sir-Photch/notesock.git && cd notesock
$ cargo build --release
$ target/release/notesock -h

Inspect possible arguments and choose sensible values for your setup.

Reverse proxy

The same webserver that you would need for serving the pastes via http can be used for this. You just need to forward a network port of your choice to the unix socket created by notesock.

Tip

For nginx, you can refer to the example configuration.

systemd

This pastebin implementation does not rely on dropping privileges for fool-proofing, rather, usage via a systemd unit is preferred.

Tip

If you like to use systemd, you can refer to the example unit.

Useful terminal shenanigans

Some commands that you can alias in your shell's resource file to save you some time.

fish on wayland

Fits right into your ~/.config/fish/config.fish!

Workflow: copy something on your desktop (Ctrl+C, or rightclick -> copy), execute this pipe (preferably with an alias) and observe Ctrl+V now inserting the link to the paste!

$ wl-paste | string trim | ncat notesock.example.org 1234 | tee /dev/tty | string split -f1 '|' | string trim | wl-copy

With encryption:

$ ncat notesock.example.org 1234 <(wl-paste | gpg -ca | psub) | tee /dev/tty | string split -f1 '|' | string trim | wl-copy

notesock's People

Contributors

sir-photch avatar

Stargazers

 avatar

Watchers

 avatar

notesock's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.