Code Monkey home page Code Monkey logo

brchd's Introduction

brchd

Starting the receiver somewhere

 brchd -Hd drop/

Run the background uploader

brchd -vDd http://127.0.0.1:7070

Manage uploads

brchd passwords.txt
brchd imgs/
brchd /var/log/*.log
brchd # attaches status monitor
brchd --wait # blocks until all pending uploads are done

Run as standalone spider

brchd -d ./download/ https://ftp.example.com/some/folder/

Install dependencies

apt install pkg-config libsodium-dev
pacman -S pkg-config libsodium
brew install pkg-config libsodium

Windows

There's basic windows support. You need to force a statically linked libsodium with:

cargo build --release --no-default-features --features=crypto,httpd,spider,native-tls

Running the receiver (-H) on windows is considered insecure and highly discouraged.

brchd's People

Contributors

kpcyrd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

isgasho kursh

brchd's Issues

Encrypted uploads

There should be a way to make brchd encrypt everything with a public key before uploading it. This is useful if the server that is receiving the upload is not trusted and the data is eventually downloaded by a trusted system.

We explicitly do not care about the authenticity of the sender, so it's sufficient to do something along the lines of:

use sodiumoxide::crypto::secretstream::{gen_key, Stream, Tag};
use sodiumoxide::crypto::box_;

let filekey = gen_key();
let (mut enc_stream, header) = Stream::init_push(&filekey).unwrap();

// this key doesn't matter
let (ourpk, oursk) = box_::gen_keypair();
// normally theirpk is passed as an argument
let (theirpk, theirsk) = box_::gen_keypair();

let nonce = box_::gen_nonce();
let ciphertext = box_::seal(filekey + header, &nonce, &theirpk, &oursk);

// write(nonce)
// write(len(ciphertext))
// write(ciphertext)

let ciphertext = enc_stream.push(msg1.as_bytes(), None, Tag::Message).unwrap();
// write(ciphertext)

The first crypto_box that we open contains metadata, we may want to switch to an extendable format like json so we can use this to encrypt the filename as well in the future. Preferably we would use something that can handle binary better than json does.

For decryption we would read the nonce, then the length of the crypto_box and then the rest of the file in CHUNK_SIZE + crypto_secretstream_xchacha20poly1305_ABYTES chunks until we reach the end.

The cli interface to decrypt individual files is trivial, we need to come up with something for folders though since they may mix both encrypted and unencrypted uploads. We could consider adding a magic header that we test for, in addition to a file extension.

Restrict spider by css selector

It should be possible to restrict the spider to only process the child elements of an element that is selected with a css selector.

Encryption at rest

We can't encrypt in all cases beforehand as described in #3, so the http daemon should also be able to encrypt every upload received with a preconfigured public key.

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.