Skip to content

Latest commit

 

History

History
155 lines (110 loc) · 3.97 KB

README.md

File metadata and controls

155 lines (110 loc) · 3.97 KB

filerail

Host file transfer service for free on your Linux machine.


Features

  • Single command upload and download feature.
  • Checkpointing download and upload, and resume back whenever you are back online.
  • Compresses your data before sending.
  • Encryption using AES-128 in CBC mode of operation.
  • Uses MD5 hash to verify integrity at receiver side.
  • Uses MessagePack for data interchange, to increase portablility among linux different systems.

How filerail works ?

An application layer protocol built on top of TCP. After connection establishment, client and server exchange messages to check if request made by client is feasible. Once request is deemed feasible, file/directory transfer process starts.


Install

$ git clone https://github.com/vi88i/filerail.git
$ cd filerail
$ chmod +x setup.sh
$ ./setup.sh

Setup

On server side

  • Spin filerail server.
$ gcc -I./deps/zip/src -o filerail_server filerail_server.c ./deps/msgpack-c/libmsgpackc.a ./deps/openssl/libcrypto.a -Wall
# usage: -v -d [-i ipv4 address] [-p port] [-k key path] [-c checkpoints directory]
$ ./filerail_server -v -i 127.0.0.1 -p 8000 -k /home/key.txt -c /home/server_ckpts
options:
1. -u : usage
2. -v : verbose mode on
3. -d : DNS resolution of provided DNS name
4. -i : IPv4 address of server
5. -p : port
6. -k : key path (requires absolute path to key file)
7. -c : checkpoints directory (requires absolute path to checkpoints directory)
  • To check if server is running
$ sudo netstat -pln | grep 8000
# if it doen't display anything something went wrong, refer syslog
$ cat /var/log/syslog | grep filerail

On client side

  • Compile client side code.
$ gcc -I./deps/zip/src -o filerail_client filerail_client.c ./deps/msgpack-c/libmsgpackc.a ./deps/openssl/libcrypto.a -Wall
  • Create a symbolic link, so filerail client can be invoked from anywhere.
$ cd filerail # move to filerail home folder
$ sudo ln -s ./filerail_client /usr/local/bin/filerail
# usage: -v -d [-i ipv4 address] [-p port] [-o operation] [-r resource path] 
#           [-d destination path] [-k key path] [-c checkpoints directory]
options:
1. -u : usage
2. -v : verbose mode on
3. -n : DNS resolution of provided DNS name
4. -i : IPv4 address of server
5. -p : port
6. -o : operation {put, get, ping}
7. -r : resource path (requires absolute path to resource)
8. -d : destination path (requires absolute path to destination)
9. -k : key path (requires absolute path to key file)
10. -c : checkpoints directory (requires absolute path to checkpoints directory)

Operations

ping

$ filerail -i 127.0.0.1 -p 8000 -o ping -k /home/key.txt -c /home/ckpt
PONG

Upload file/directory

$ filerail -i 127.0.0.1 -p 8000 -o put -r /home/user/a -d /home/user/fun -k /home/key.txt -c /home/ckpt

Download file/directory

$ filerail -i 127.0.0.1 -p 8000 -o get -r /home/user/fun -d /home/user2 -k /home/key.txt -c /home/ckpt

Setup keys

  • filerail uses AES-128 (CBC mode).
  • It requires two paramaters IV (initialization vector) and key, both are of 128 bit length.
  • First 48 bytes of key file consists of IV, and the remaining 48 bytes are keys.
  • Pair of hex digits are separated by space, and last hex digit of each parameter is delimited by newline (\n).
  • Same key and IV must be stored on server side and client side.

Example

A9 51 D3 CC B5 F9 56 48 31 1B 5E 25 A9 E3 A1 DB
54 68 61 74 73 20 6D 79 20 4B 75 6E 67 20 46 75


Dependencies

  1. kuba--/zip
  2. openssl/openssl
  3. msgpack/msgpack-c

Note

  • Windows and OS X not supported.