Skip to content

opendxl/opendxl-openc2-client-python

Repository files navigation

OpenC2 DXL Python Client Library

OpenDXL Bootstrap Latest PyPI Version License Actions Status

Overview

The OpenC2 DXL Python client library provides a high level wrapper for sending and receiving OpenC2 command and control messages via the Data Exchange Layer (DXL) fabric.

This library utilizes Lycan, an implementation of the OpenC2 OASIS standard for command and control messaging.

Documentation

See the Wiki for an overview of the OpenC2 DXL Python Client Library and examples.

See the OpenC2 DXL Python Client Library for installation instructions, API documentation, and examples.

Installation

To start using the OpenC2 DXL Python Client Library:

  • Download the Latest Release
  • Extract the release .zip file
  • View the README.html file located at the root of the extracted files.
    • The README links to the documentation which includes installation instructions, API details, and samples.
    • The SDK documentation is also available on-line here.

Example

Below is an example usage of the OpenC2 DXL Python client library. In this particular case, a service is queried for a GeoLocation report using the OpenC2 command and control language.

# Create DXL configuration from file
config = DxlClientConfig.create_dxl_config_from_file(CONFIG_FILE)

# Create the client
with DxlClient(config) as dxl_client:

    # Connect to the fabric
    dxl_client.connect()

    logger.info("Connected to DXL fabric.")

    # Create client wrapper
    client = OpenC2Client(dxl_client)

    # Custom Actuator (MaxMind GeoLocation)
    @openc2.v10.CustomActuator(
        "x-maxmind", [
            ("host", stix2.properties.StringProperty(required=True))
        ]
    )
    class MaxMindActuator(object):
        pass

    # Send the command and receive the response
    cmd = openc2.v10.Command(
        action="query",
        target=openc2.v10.Properties(properties=["geolocation"]),
        actuator=MaxMindActuator(host="opendxl.com")
    )
    response = client.send_command('/openc2-maxmind/service/api', cmd)

Bugs and Feedback

For bugs, questions and discussions please use the GitHub Issues.

LICENSE

Copyright 2020 McAfee, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

OpenC2 client library for use with the OpenDXL Python Client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages