Skip to main content

File sharing (images, code snippets, movies...) made easy.

Project description

What is shup?

shup is a small tool made for those who care about sharing files, or simply for those who want to frequently upload files to some redundant targets. The primary reason why shup was built is uploading files to a directory under the supervision of an http server so that it becomes super easy to share files with urls like http://files.example.com/surprise.png just by running:

shup mywebsite ~/Pictures/surprise.png

mywebsite is a rule tag, we’ll see that later.

Demo

Demo

Install

You can install shup using pypi like so: pip3 install shup.

Also be sure to have at command on your remote machines (and the atd running): - Debian - Arch - CentOs 7

at is used to delay the remove command, otherwise your files won’t be deleted later.

How to use it?

Intro

Let’s say you own example.com and the subdomain files.example.com point to a directory managed by your http server like /www/static/. The goal of shup is to avoid doing the same boring thing everytime. Let’s write a basic configuration rule once for this directory on example.com. If you have the same session name on your remote machine as your local machine, no need to specify it. Let’s say you also want that every file expire one week after creation by default on that directory. Since we dont share critical info here no need to use anything else than simple rm command for deletion. Also in this example you’re using a key protected with a password that you don’t want to save in your configuration file. Here is the configuration you would write in that situation:

[example_static]
ssh_host = example.com
ssh_keyfile = ~/.ssh/id_rsa
file_path = /www/static
file_ttl = 1w

Now we can start uploading file as simply as: shup -u example_static look_at_this.webm. As the arguments supersede the configuration files we can also overwrite the TTL of the file and the way it’s deleted for example: shup -t 2h -d 'shred -n 200 -z -u' -u example_static sensible_file.tar.bz2 If you only have one rule and what it to be your default one just use the rule tag [default]. The first command can now be run shup look_at_this.webm.

Configuration files

shup will automatically try to read configurations files (shup.cfg) in both your pip3 installation folder and ~/.config/shup/shup.cfg in that order. Please note that the latter supersede the former as the arguments do with configuration files. A default target should be specified in one of the configuration files in order to use shup withou the rule argument (-u).

Help

Here is the output of shup -h:

usage: shup [-h] [-u name] [-v] [-d path] [-t time] [-p perms] [-l ret]
            [-r | -c | --cksum algorithm]
            file [file ...]

positional arguments:
  file                  file that should be upload following the rule given by
                        the optional `--rule' argument

optional arguments:
  -h, --help            show this help message and exit
  -u name, --rule name  target rule to follow, contains everything from host
                        informations to the destination folder and the TTL of
                        the file if specified. If not specified, shup search
                        for a section 'default' in the configuration files
  -v, --verbose         increase the output verbosity during the operation
                        (increase with vv or vvv)
  -d path, --delwith path
                        set the binary used to delete the binary when the TTL
                        reach 0
  -t time, --ttl time   set the time while the file will stay on the remote
                        host before being deleted
  -p perms, --permissions perms
                        set the file permissions in octal mode, default is
                        0644
  -l ret, --file-return ret
                        set the file return path
  -r, --randomize       randomize filename
  -c                    replace the filename by the file's checksum following
                        'file_cksum' rule in configuration files or SHA1 if
                        nothing specified
  --cksum algorithm     like -c but following the command line argument
                        'algorithm'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shup-0.2.0.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shup-0.2.0-py2-none-any.whl (12.8 kB view details)

Uploaded Python 2

File details

Details for the file shup-0.2.0.tar.gz.

File metadata

  • Download URL: shup-0.2.0.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for shup-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c44326b626bcb9e90c9f734eb5fc1c6600dab336470dfde6b602de4418afbdb0
MD5 9af57098dd368ac942663b4ac9ebc5b9
BLAKE2b-256 d4e480cb087058e870c8af615db02886866e31a8c8755295c63e296a5246e215

See more details on using hashes here.

File details

Details for the file shup-0.2.0-py2-none-any.whl.

File metadata

  • Download URL: shup-0.2.0-py2-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for shup-0.2.0-py2-none-any.whl
Algorithm Hash digest
SHA256 c1928bf91b5e4adf1d61526c621ce839298a224958c9f7e28770edce12c9d933
MD5 c2df4efc9cc3695a2c9402b983c8c0fb
BLAKE2b-256 c977e5b72f438ead474df75a5cf00e0c4e6c648e56a491225906928e10582f77

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page