Skip to main content

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

Release files for ftd-api 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ftd-api 0.0.8
File Size Uploaded
ftd_api-0.0.8.tar.gz 30.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ftd-api 0.0.8
File Interpreter ABI Platform
ftd_api-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size:62.7 kB

Release files / ftd_api-0.0.8.tar.gz

Download URL ftd_api-0.0.8.tar.gz
Size 30.9 kB
Tags Source
SHA-256 checksum
How to use checksums
090a83881b4b70d495fd000849baa15b92c93f7d6904fcd8dbd48c050193d9a6
BLAKE2b-256 checksum
How to use checksums
d6f4659f3af7d55dd911c71f10c3835c98a45d98613bef75ea80837cd02bdc2a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / ftd_api-0.0.8-py3-none-any.whl

Download URL ftd_api-0.0.8-py3-none-any.whl
Size 31.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d07c01e2976af0cff02c55ca065c0ba8b48573e3a8f92c74d612bdaa4883617c
BLAKE2b-256 checksum
How to use checksums
097789a49b21e50414aade578e5efc19b7c898ec2251601d9aafcd9584bd0cab
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page