Skip to main content

RESTful datastore. A simple way to store large amounts of average sized files.

Project description

Why reststore?

reststore is used by my friends and I as a simple way to share and store samples of malware. Large volumes of files are what we’re in it for. The advantage we get from using reststore is in its ability to return slices of hashes based on chronological ordering of data insert. It implements a simple yet powerful fetch, cache, and store pattern that makes handling large volumes of data a trivial problem.

What is reststore:

  • A convenient way to store large quantities of data.
  • Ability to access data locally or access it via a server hosting the reststore webapp.
  • Chain together multiple webapp servers until they reach the single authoritative reststore webapp.

What’s in reststore:

  • A simple interface called Files which gives full control over and access to reststore’s capabilities.
  • Flexible configuration to support more complex deployments of reststore.
  • A set of command line operations to get, put, and list data.
  • A RESTful webapi so data can be accessed in a client agnostic manner.

Project hosting provided by


Simply run the following:

> python install

or PyPi:

> pip install reststore

Getting started

Coding with reststore

Files and FilesClient are the two main classes used to access data from a store.

A local session:

$ ipython

In [1]: import reststore

In [2]: files = reststore.Files()

In [3]: files.
files.get        files.hash_len   files.put
files.hash_func  files.index

In [3]: files.put("test data")
Out[3]: 'eb733a00c0c9d336e65691a37ab54293'

In [4]: files.put("test with some more data")
Out[4]: 'a99fb3880c8ac126b3cf6163aa965305'

In [5]: files.put("test with some more data... and more")
Out[5]: 'e93a9d514c57f96d158864754f1ca330'

In [6]: files['e93a9d514c57f96d158864754f1ca330']
Out[6]: u'/tmp/files/00195/00065/3'

In [7]:,-1)
Out[7]: ['e93a9d514c57f96d158864754f1ca330']

In [8]:,-1)
Out[8]: [a99fb3880c8ac126b3cf6163aa965305', e93a9d514c57f96d158864754f1ca330']

In [9]: for hexdigest in files:
   ...:     print hexdigest

The exact same code above will work using the FilesClient class which will seamlessly interface with a reststore webapp server.

Configuring reststore

reststore has a very simple configuration system. Configuration is applied in the following order:

  • defaults from reststore.config
  • /etc/reststore.yaml
  • ~/reststore.yaml
  • environ <- each config value is written RESTSTORE_[INTERFACE]_[NAME]=Value

Example of the default config:

$ cat ~/.reststore.yaml

client: {uri: ''}
files: {assert_data_ok: false, hash_function: md5, name: files, root: /tmp, tune_size: 100000000}
webapp: {debug: false, host:, port: 8586, proxy_requests: false, quiet: false,
server: wsgiref}

Command line interface

Exploring the command line interface should expose the core features of reststore:

$ reststorei -h

NAME reststore - control over the reststore

    reststore [COMMAND]

        Return a filepath to the data behind hexdigest.

            HEXDIGEST of the data to lookup in reststore.

    read [FILE-OPTIONS] [HEXDIGEST] > stdout
        Attempt to retrieve a file and write it out to stdout.  A check is
        made in the local reststore first, if the file is in available, an
        attempt to read the file from the web reststore is made.

            HEXDIGEST of the data to lookup in reststore.

        Put a file into the reststore.

            Path(s) of files to be loaded into the reststore.

        Extra files from a zipfile straight into the reststore.

            A path to the zip file to extract into the reststore.

                Define a password for unzipping the zip file.
                Number of files to read into memory before flushing through
                to the reststore.

        list out hexdigests found in the reststore.

                List all of the hashes between A:B.  Hashes are stored
                chronologically.  0 is the first file inserted, -1 is the last
                file inserted.  i.e. select the last 1000 hexdigests -1001:-1

    len [FILE-OPTIONS]
        print out the number of files stored in the reststore.

        Run the RESTful web app.

            HOST:PORT defaults to

                Choose the server adapter to use.
                Run in debug mode.
                Run in quite mode.
                If True, this web app will proxy requests through to
                the authoritative server defined by the client uri.

File options:
        Set the default reststore name (i.e. domain or realm)
        Set the hash function to be used
        Set the approximate size the reststore may grow up to.
        Set the root for the reststore.
        Do extra checks when reading and writing data.
        This flag forces access to a local repository only.
        The uri to the upstream reststore web server.


Source code for reststore is hosted on GitHub. Please file bug reports with GitHub’s issues system.

Change log

version 0.0.1 (08/06/2013)

  • unzip insert and bulk put

version 0.0.0 (06/05/2013)

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

reststore-0.0.2.tar.gz (18.2 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page