Metadata-Version: 2.1
Name: filebridging
Version: 0.0.6
Summary: Share files via a bridge server using TCP over SSL and end-to-end encryption.
Home-page: https://gogs.davte.it/davte/filebridging
Author: Davide Testa
Author-email: davide@davte.it
License: GNU General Public License v3.0
Keywords: file share tcp ssl tls end-to-end encryption python asyncio async
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Communications :: File Sharing
Description-Content-Type: text/markdown

# filebridging

Share files via a bridge server using TCP over SSL and end-to-end encryption.

## Requirements
Python3.8+ is needed for this package.
You may find it [here](https://www.python.org/downloads/).

OpenSSL 1.1.1+ is required as well to handle SSL connection and end-to-end cryptography.
On Windows, installing [git for Windows](https://gitforwindows.org/) will install OpenSSL as well.

## Usage
If you need a virtual environment, create it.
```bash
python3.8 -m venv env;
alias pip="env/bin/pip";
alias python="env/bin/python";
```

Install filebridging and read the help.
```bash
pip install filebridging
python -m filebridging.server --help
python -m filebridging.client --help
```

## Examples
* Client-server example
    ```bash
    # 3 distinct tabs
    python -m filebridging.server --host localhost --port 5000 --certificate ~/.ssh/server.crt --key ~/.ssh/server.key
    python -m filebridging.client s --host localhost --port 5000 --certificate ~/.ssh/server.crt --token 12345678 --password supersecretpasswordhere --path ~/file_to_send 
    python -m filebridging.client r --host localhost --port 5000 --certificate ~/.ssh/server.crt --token 12345678 --password supersecretpasswordhere --path ~/Downloads 
    ```


* Client-client example
    ```bash
    # 2 distinct tabs
    python -m filebridging.client s --host localhost --port 5000 --certificate ~/.ssh/server.crt --key ~/.ssh/private.key --token 12345678 --password supersecretpasswordhere --path ~/file_to_send --standalone
    python -m filebridging.client r --host localhost --port 5000 --certificate ~/.ssh/server.crt --token 12345678 --password supersecretpasswordhere --path ~/Downloads 
    ```
    The receiver client may be standalone as well: just add the `--key` parameter (for SSL-secured sessions) and the `--standalone` flag. 


* Configuration file example
    ```python
    #!/bin/python

    host = "www.example.com"
    port = 5000
    certificate = "/path/to/public.crt"
    key = "/path/to/private.key"

    action = 'r'
    password = 'verysecretpassword'
    token = 'sessiontok'
    file_path = '.'
    ```

## Generating SSL certificates


Store configuration in file `mycert.csr.cnf` and run the following command to generate a self-signed SSL certificate.
```bash
openssl req -newkey rsa:2048 -nodes -keyout ./mycert.key \
 -x509 -days 365 -out ./mycert.crt \
 -config <( cat mycert.csr.cnf )
```


**mycert.csr.cnf**
```text
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
req_extensions = v3_req
subjectAltName = @alt_names

[ v3_req ]
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names

[dn]
C=US
ST=YourState
L=YourTown
O=FileBridging
OU=filebridging
emailAddress=filebridging@yourdomain.com
CN = yourdomain.com

[ alt_names ]
DNS.1 = yourdomain.com
DNS.2 = 1.111.111.11
```

