Skip to main content

CSFalcon-Client

Python API client wrapper for CrowdStrike Falcon Query API.

Features

  • Retrieve prevention policy details
  • Search for falcon agents
  • Retrieve falcon agent details
  • Contain host (RTR)

References

Install

pip install falcon-client

Configuration file

[falcon]
client_id = 4uxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
client_key = bAt1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# HTTP Interception Proxy
;proxy_host = localhost
;proxy_port = 8080

Examples

Initialize client

try:
    # default config ~/.crowdstrike/csfalcon.ini
    fc = falcon_client.FalconClient()
    # fc = falcon_client.FalconClient(config_file_path='~/csfalcon.ini')
    # fc = FalconClient.basic(client_id='',
    #                         client_key='',
    #                         proxy_host='localhost', proxy_port=8080)
except Exception as err:
    sys.exit(err)
else:
    fc.login()
    print(fc)

Retrieve prevention policy details

# POLICY DETAILS
print("Prevention Policies")
for result in fc.prevention_policies_details(ids=None):
    print(json.dumps(result, indent=2))

Device Scroll

Search for hosts in your environment by platform, hostname, IP, and other criteria with continuous pagination capability (based on offset pointer which expires after 2 minutes with no maximum limit)

print("DEVICE SCROLL")
hosts_resp = fc.device_scroll(limit=10, fql_filter='platform_name: "Linux" +first_seen: >= "2020-12-11T00:00:00Z"')
for host in hosts_resp:
    print(json.dumps(host, indent=2))

Search for hosts in your environment by platform, hostname, IP, and other criteria.

Device Search supports the same options as Device Scroll. The only difference between Device Search and Device Scroll is their pagination and response limit:

  • Device Search: Standard pagination (page number, page size) up to 150,000 devices
  • Device Scroll: Continuous pagination (based on an offset pointer) with no maximum limit
print("DEVICE SEARCH")
hosts_resp = fc.device_search(limit=10, fql_filter='platform_name: "Windows"',  q="dubai")
# hosts_resp = fc.device_search(limit=10, q="rooster")
for host in hosts_resp:
    print(json.dumps(host, indent=2))

Device Details

Get details on one or more hosts by providing agent IDs (AID).

# find host AIDs
hosts_resp = fc.device_search(limit=10, q="rooster")
aids = set()
for host in hosts_resp:
    aids.update(host)

# Get details for each AID
host_details = fc.device_details(aids)
for host in host_details:
    print(json.dumps(host, indent=2))

Device Containment

Contain or lift containment on a specified host. When contained, a host can only communicate with the CrowdStrike cloud and any IPs specified in your containment policy.

# DEVICE CONTAINMENT
aids = set(['7983795a198d40xxxxxxxxxx418aa385', 'fb8456dfe15xxxxxxxxxxxc9893e1a06'])
print("DEVICE CONTAINMENT")
for hosts in fc.device_details(list(aids)):
    for host in hosts:
        print(json.dumps(host['hostname'], indent=2))
success, fail, err = fc.lift_containment(list(aids))
print(f"Success: {success}")
print(f"Failure: {fail}")
print(f"Errors: {err}")

Metadata

Release files for falcon-client 0.0.7

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

Built distribution (wheel)

Table of built distributions (wheels) for falcon-client 0.0.7
File Interpreter ABI Platform Actions
falcon_client-0.0.7-py3-none-any.whl Python 3 none any Details for falcon_client-0.0.7-py3-none-any.whl

Release files / falcon_client-0.0.7-py3-none-any.whl

Download URL falcon_client-0.0.7-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e90c4e969b41db2bd1b247bb87dd5fc4c5da8efe0baa5208f7c0e4e4592c86b0
BLAKE2b-256 checksum
How to use checksums
bf1137ce54709dafc81d5098f5779d97dd17c40f6eee48af96bef863150131a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.8

Security for falcon-client 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.7 This release

1 release file No provenance

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