Skip to main content

Useful tooling for the Firepower Threat Defense on-box REST API

Project description

ftd_api

This repository is dedicated to useful tooling for the Firepower Threat Defense on-box REST API

Please note that this API is only accessible when the device is not managed by an FMC.

Installation

From Pypi

pip install ftd_api

Usage

Right now we are only "exposing" the bulk tool. Keep a lookout in this space for more good stuff coming.

Bulk Tool

If you have installed the package the bulk tool ftd_bulk_tool should be in your path already.

usage: ftd_bulk_tool [-h] [-c FILE_NAME] [-D] [-a ADDRESS] [-P PORT]
                    [-u USERNAME] [-p PASSWORD] [-l LOCATION]
                    [-f {CSV,JSON,YAML}] [--url URL] [-e] [-i ID_LIST]
                    [-n NAME_LIST] [-t TYPE_LIST]
                    {IMPORT,EXPORT,LIST_TYPES}

This tool provides a simple abstraction to handle bulk import/export tasks via
the Firepower Threat Defese REST API.

positional arguments:
{IMPORT,EXPORT,LIST_TYPES}
                        The various different modes in which the tool runs

optional arguments:
-h, --help            show this help message and exit
-c FILE_NAME, --config_file FILE_NAME
                        A properties file allowing you to specify any of the
                        tool's options. If the option is set in both places,
                        the command-line options will override the
                        configuration file. The format is key=value each on
                        it's own line. '#' comments are supported.
-D, --debug             Enable debug logging
-a ADDRESS, --address ADDRESS
                        FTD hostname or IP. Default: 'localhost'
-P PORT, --port PORT  FTD port. Default: 443
-u USERNAME, --username USERNAME
                        The username to login with. Default: 'Admin'
-p PASSWORD, --password PASSWORD
                        The password to login with. Default: 'Admin123'
-l LOCATION, --location LOCATION
                        Directory path for EXPORT mode. One or more file paths
                        (comma delimited) for IMPORT mode. Required by IMPORT,
                        and EXPORT modes
-f {CSV,JSON,YAML}, --format {CSV,JSON,YAML}
                        Specify the import or output format. Default: 'JSON'
--url URL               The URL you would like to export data from instead of
                        doing a full export. Only valid for EXPORT mode.
-e, --pending           Export only pending changes. Only valid for EXPORT
                        mode. Ignored if 'url' is supplied
-i ID_LIST, --id_list ID_LIST
                        A Comma-separated list of ID values to export or remove
                        from an import. This is essentially a filter by id
                        on the export or an exclusion filter on import. Valid
                        for IMPORT and EXPORT mode. Ignored if 'url' or 'pending'
                        are supplied.
-n NAME_LIST, --name_list NAME_LIST
                        A Comma-separated list of names to export or remove
                        from an import. This is essentially a filter by name
                        on the export or an exclusion filter on import. Valid
                        for IMPORT and EXPORT modes. Ignored if 'url' or 'pending'
                        are supplied.
-t TYPE_LIST, --type_list TYPE_LIST
                        A Comma-separated list of types to export or remove
                        from an import. This is essentially a filter by type
                        on the export or an exclusion filter on import. Valid
                        for IMPORT and EXPORT modes. Ignored if 'url' or 'pending'
                        are supplied.

Contributing

Development Environment

For those of you wishing to contribute: Fork this repo, clone your fork, then execute the following commands:

cd ftd_api
python3 setup.py sdist
pip3 install -e .

This will build the source distribution and then install it onto your development system using symlinks (as opposed to installing a copy of it) so that as you modify the code it will take effect immediately. Note that this will work just the way you want it to in a virtualenv

Running Tests

Please add unit tests using standard unittest library and put them in the top level tests folder. To run the tests from the top level directory just run pytest. Alteratively, you can call unittest directly python -m unittest tests/*.py, but pytest is definitely prettier ;).

Note that pytest is not an explicit dependency of this package. Thus, you may want to install it: pip install pytest

License

MIT License - See LICENSE.TXT for full text

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

ftd_api-0.0.8.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

ftd_api-0.0.8-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file ftd_api-0.0.8.tar.gz.

File metadata

  • Download URL: ftd_api-0.0.8.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9

File hashes

Hashes for ftd_api-0.0.8.tar.gz
Algorithm Hash digest
SHA256 090a83881b4b70d495fd000849baa15b92c93f7d6904fcd8dbd48c050193d9a6
MD5 d3303a98ccb18d198c25c31aea9f030e
BLAKE2b-256 d6f4659f3af7d55dd911c71f10c3835c98a45d98613bef75ea80837cd02bdc2a

See more details on using hashes here.

File details

Details for the file ftd_api-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: ftd_api-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 31.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9

File hashes

Hashes for ftd_api-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d07c01e2976af0cff02c55ca065c0ba8b48573e3a8f92c74d612bdaa4883617c
MD5 d8fd4df17bb19b7fa2c0c035413deb94
BLAKE2b-256 097789a49b21e50414aade578e5efc19b7c898ec2251601d9aafcd9584bd0cab

See more details on using hashes here.

Supported by

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