-
Notifications
You must be signed in to change notification settings - Fork 3
Basic System Find Example
This sample invokes and displays the results of a “system find” remote command via the ePO DXL service. The results of the find command are displayed in JSON format.
The majority of the sample code is shown below:
# The ePO unique identifier
EPO_UNIQUE_ID = "epo1"
# The search text
SEARCH_TEXT = "broker"
# Create the client
with DxlClient(config) as client:
# Connect to the fabric
client.connect()
req = Request("/mcafee/service/epo/remote/{0}".format(EPO_UNIQUE_ID))
req.payload = \
json.dumps({
"command": "system.find",
"output": "json",
"params": {"searchText": SEARCH_TEXT}
}).encode(encoding="utf-8")
# Send the request
res = client.sync_request(req, timeout=30)
if res.message_type != Message.MESSAGE_TYPE_ERROR:
response_dict = json.loads(res.payload, encoding='utf-8')
print json.dumps(response_dict, sort_keys=True, indent=4, separators=(',', ': '))
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 including 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 system.find command is being invoked with an output style of json. A searchText parameter is specified with the value of broker.
The final step is to perform a synchronous request via the DXL fabric. If the response message is not an error, the resulting JSON is loaded into a Python dictionary (dict) and ultimately displayed to the screen.
The output should appear similar to the following:
ComputerMgmt.createAgentDeploymentUrlCmd deployPath groupId [edit] [ahId]
[fallBackAhId] [urlName] [agentVersionNumber] [agentHotFix] - Create Agent
Deployment URL Command
ComputerMgmt.createCustomInstallPackageCmd deployPath [ahId] [fallBackAhId] -
Create Custom Install Package Command
ComputerMgmt.createDefaultAgentDeploymentUrlCmd tenantId - Create Default
Non-Editable Agent Deployment URL Command
ComputerMgmt.createTagGroup parentTagGroupId newTagGroupName - Create a new
subgroup under an existing tag group.
ComputerMgmt.deleteTag tagIds [forceDelete] - Delete one or more tags.
ComputerMgmt.deleteTagGroup tagGroupIds [deleteTags] - Delete one or more Tag
Groups.
ComputerMgmt.listAllTagGroups - List All Tag Groups in Tag Group Tree
ComputerMgmt.moveTagsToTagGroup tagIds tagGroupId - Move tags to an existing tag
group.
...Each remote command exposed by the particular ePO server is listed along with its associated parameters.
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