-
Notifications
You must be signed in to change notification settings - Fork 3
Basic Core Help Example
This sample invokes and displays the results of the “core help” remote command via the ePO DXL service. The “core help” command lists the remote commands that are exposed by the specified ePO server.
The majority of the sample code is shown below:
# The ePO unique identifier
EPO_UNIQUE_ID = "epo1"
# Create the client
with DxlClient(config) as client:
# Connect to the fabric
client.connect()
# Create the request
req = Request("/mcafee/service/epo/remote/{0}".format(EPO_UNIQUE_ID))
# Set the payload for the request (core.help remote command)
req.payload = \
json.dumps({
"command": "core.help",
"output": "verbose",
"params": {}
}).encode(encoding="utf-8")
# Send the request
res = client.sync_request(req)
if res.message_type != Message.MESSAGE_TYPE_ERROR:
# Display resulting payload
print res.payload.decode(encoding='utf-8')
else:
print "Error: {0} ({1}) ".format(res.error_message, str(res.error_code))After connecting to the DXL fabric, a request message is created with a topic that targets the ePO DXL service with a unique identifier that is associated with the ePO server to invoke the remote command on.
The next step is to set the payload of the request message. The contents of the payload include the remote command to invoke, the output style for the ePO server response (json, xml, verbose, or terse), and any parameters for the command. In this particular case the core.help command is being invoked with an output style of verbose. This particular command requires no parameters so an empty dictionary (dict) is specified.
The final step is to perform a synchronous request via the DXL fabric. If the response message is not an error its contents are displayed.
McAfee ePolicy Orchestrator (ePO) DXL Python Service
Documentation
-
Release Documentation
- (Steps to install, configure, and run the service)
-
Docker Support
- (Steps to run the service in a Docker container)
Examples