Skip to main content

An API for the Thinkst Canary Console

Project description

Thinkst Applied Research

Overview

The Python Canary API Wrapper allows access to the Canary Web API.

Installation

The API is supported on python 2.7. The recommended way to install the API Wrapper is via pip.

pip install canarytools

For instructions on installing python and pip see “The Hitchhiker’s Guide to Python” Installation Guides.

Quickstart

Assuming you have your API key handy as well as the domain of your website:

import canarytools
console = canarytools.Console(api_key='API_KEY', domain='CLIENT_DOMAIN')

Note: You can find your API key and domain on your console. Head over to the console’s setup page and under Canary Console API you’ll find your API key. Your domain is the tag in-front of ‘canary.tools’ in the console’s url. For example in https://testconsole.canary.tools/settings testconsole is the domain.

Alternatively, you can download a configurations file from the Canary Console API tab. Inside the file you’ll find instructions on where to place it. If you have this on your system the api_key and domain parameters are no longer necessary when instantiating a Console object.

With the console instance you can then interact with a Canary Console:

# Get all devices
console.devices.all()

# Acknowledge all incidents for a device older than 3 days
console.incidents.acknowledge(node_id='329921d242c30b5e', older_than='3d')

# Iterate all devices and start the update process
for device in console.devices.all():
    device.update(update_tag='4ae023bdf75f14c8f08548bf5130e861')

# Acknowledge and delete all host port scan Incidents
for incident in console.incidents.unacknowledged():
    if isinstance(incident, canarytools.IncidentHostPortScan):
        incident.acknowledge()
        incident.delete()

# Create a web image Canarytoken
console.tokens.create(
    kind=canarytools.CanaryTokenKinds.KIND_WEB_IMAGE,
    memo='Drop this token on DC box',
    web_image='/path/to/test.png',
    mimetype='image/png')

# Print out the name of all incidents and the source IP address
for incident in console.incidents.all():
    print incident.description, incident.src_host

Please see the API doc’s documentation for more examples of what you can do with the Canary Console API.

Discussion and Support

Please file bugs and feature requests as issues on GitHub after first searching to ensure a similar issue was not already filed. If such an issue already exists please give it a thumbs up reaction. Comments to issues containing additional information are certainly welcome.

Documentation

The documentation is located at http://canarytools.readthedocs.io.

License

The Python Canary API Wrapper’s source (v1.0.0+) is provided under the Revised BSD License.

  • Copyright (c), 2017, Thinkst Applied Research

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

canarytools-1.0.8.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

canarytools-1.0.8-py2.py3-none-any.whl (20.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file canarytools-1.0.8.tar.gz.

File metadata

  • Download URL: canarytools-1.0.8.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10

File hashes

Hashes for canarytools-1.0.8.tar.gz
Algorithm Hash digest
SHA256 85544bd953a7c130a888793a97a2c0a3c4b0a4882ddb01b8e9d1987b9a774861
MD5 058f83e50d82a90772cbeeb91e4c515f
BLAKE2b-256 4300b2e689111f4a3b335df13a208326c7851c8eb336e216be3c8912f82b9f72

See more details on using hashes here.

File details

Details for the file canarytools-1.0.8-py2.py3-none-any.whl.

File metadata

  • Download URL: canarytools-1.0.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10

File hashes

Hashes for canarytools-1.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e426b9a008853b925c847bb9a64cd16aae13253f0ee101654dc5f247203f40a6
MD5 a5bfa14a5af93a372db2c5c7d7e0436f
BLAKE2b-256 2e9b0d0411b6353d592d730c9eff4910612eb8d88f8cf1e090f25a2f56e4c3bb

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