Python Client Library

We've created what will one day be the entrypoint for all things FireEye in Python: The FireEye Python Client Library. Today, this client library only supports FireEye's new Detection On Demand service, but will soon support all FireEye services and products that are accessible via API.

Installation


To install the Python client library:

pip install fireeyepy

To upgrade your installed library:

pip install fireeyepy --upgrade

Alternatively, you can clone the repository via the command line:

git clone https://github.com/fireeye/fireeye-python.git

Usage


Begin by importing the 'fireeye' module:

import fireeyepy

Detection On Demand

Construct a Detection object with your api key:

detection = fireeyepy.Detection(key=api_key)

Upload A File

response = detection.submit_file(
  files={
    "file": ('filename', open('./path/to/filename', 'r'))
  }
)

Retrieve File Report

response = detection.get_report(report_id)

You may also provide the optional extended=True flag to get the full, in-depth report:

response = detection.get_report(report_id, extended=True)

Perform Hash Lookup

response = detection.get_hash(hash)