Index of code examples

This page provides a categorized list of samples that we provide in the Workload Security SDK Samples GitHub repository. The samples demonstrate how to use the SDKs to automate Workload Security administration tasks. They typically implement multi-operation algorithms.

Links are provided for each item:

  • The Python link open the sample in GitHub
  • The Guide link opens a topic in the Workload Security documentation that includes part of the sample in the discussion
The examples in the API Reference are not listed here. In the API Reference, for each operation, an example illustrates how to execute the operation using an SDK.

Anti-Malware

  • Set the real time Anti-Malware scan configuration [ Python | Guide ]
  • Add a directory to a directory list [ Python | Guide ]
  • Configure directory exclusions for a malware scan configuration [ Python | Guide ]
  • Create a schedule for business hours only [ Python | Guide ]
  • Report on module status [ Python | Guide ]
  • Obtain the Anti-Malware configuration of all computers [ Python | Guide ]

API Client

API keys

Application Control

Computers

  • Add a computer to Workload Security [ Python | Guide ]
  • Search for a policy and assign it to a computer [ Python | Guide ]
  • Get the overrides for a computer [ Python | Guide ]
  • Override reconnaissance scans for a computer [ Python | Guide ]
  • Block unrecognized software on a computer [ Python | Guide ]
  • Report on agent status [ Python | Guide ]
  • Report on module status [ Python | Guide ]
  • Obtain the Anti-Malware configuration of all computers [ Python | Guide ]
  • Retrieve applied Intrusion Prevention rules for all computers [ Python | Guide ]
  • Find computers that are not protected against a CVE [ Python | Guide ]
  • Add Intrusion Prevention rules to computers' policies [ Python | Guide ]
  • Get the date of the last recommendation scan [ Python | Guide ]
  • Obtain recommendations for Intrusion Prevention [ Python | Guide ]
  • Create a scheduled task that discovers computers [ Python | Guide ]
  • Create, run, and delete a scheduled task that checks for security updates [ Python | Guide ]
  • Run the discover computers scheduled task [ Python | Guide ]
  • Search using multiple criteria [ Python | Guide ]
  • Search computer sub objects [ Python | Guide ]
  • Search for null values [ Python | Guide ]
  • Paged results of a computer search [ Python | Guide ]
  • Generate an agent deployment script [ Python | Guide ]

Firewall

  • Search Firewall Rules by Name [ Python | Guide ]
  • Configure Firewall for a policy [ Python | Guide ]
  • Create a schedule for business hours only [ Python | Guide ]
  • Retrieve policy settings (Firewall network engine mode) [ Python | Guide ]
  • Configure a system setting for a policy (Firewall network engine mode) [ Python | Guide ]
  • Set Firewall fail open behavior  [ Python | Guide ]

Integrity Monitoring

  • Add integrity Monitoring rules to a policy [ Python | Guide ]
  • Report on module status [ Python | Guide ]
  • Get the date of the last recommendation scan [ Python | Guide ]

Intrusion Prevention (IDS/IPS)

  • Configure Intrusion Prevention settings [ Python | Guide ]
  • Report on module status [ Python | Guide ]
  • Retrieve applied Intrusion Prevention rules for all computers [ Python | Guide ]
  • Find the Intrusion Prevention rules for a CVE [ Python | Guide ]
  • Find computers that are not protected against a CVE [ Python | Guide ]
  • Add Intrusion Prevention rules to computers' policies [ Python | Guide ]
  • Get the date of the last recommendation scan [ Python | Guide ]
  • Obtain recommendations for Intrusion Prevention [ Python | Guide ]
  • Search Intrusion Prevention rules based on date updated [ Python | Guide ]

Lists

  • Add a directory to a directory list [ Python | Guide ]

Log Inspection

  • Add a Log Inspection rule to a policy [ Python | Guide ]
  • Create a basic Log Inspection rule [ Python | Guide ]
  • Create a Log Inspection rule using XML [ Python | Guide ]
  • Report on module status [ Python | Guide ]
  • Get the date of the last recommendation scan [ Python | Guide ]
  • Reset a subset of rule overrides for a policy [ Python | Guide ]

Policies

  • List Policies [ Python | Guide ]
  • Create a policy below Base Policy [ Python | Guide ]
  • Configure Firewall for a policy [ Python | Guide ]
  • Configure Intrusion Prevention settings [ Python | Guide ]
  • Set the real time Anti-Malware scan configuration [ Python | Guide ]
  • Turn on Web Reputation and configure settings [ Python | Guide ]
  • Add integrity Monitoring rules to a policy [ Python | Guide ]
  • Add a Log Inspection rule to a policy [ Python | Guide ]
  • Turn on Application Control [ Python | Guide ]
  • Search for a policy and assign it to a computer [ Python | Guide ]
  • Retrieve policy settings (Firewall network engine mode) [ Python | Guide ]
  • Configure a system setting for a policy (Firewall network engine mode) [ Python | Guide ]
  • Configure multiple system settings for a policy (Firewall fail open behavior)  [ Python | Guide ]
  • Add Intrusion Prevention rules to computers' policies [ Python | Guide ]
  • Search for policies by name [ Python | Guide ]
  • Search using multiple criteria [ Python | Guide ]
  • Search for null values [ Python | Guide ]
  • Reset a subset of rule overrides for a policy [ Python | Guide ]

Recommendations

  • Get the date of the last recommendation scan [ Python | Guide ]
  • Obtain recommendations for Intrusion Prevention [ Python | Guide ]

Reporting

  • Get the date of the last recommendation scan [ Python | Guide ]
  • Report on agent status [ Python | Guide ]
  • Report on module status [ Python | Guide ]
  • Obtain the Anti-Malware configuration of all computers [ Python | Guide ]

Roles

  • Create a role with specific rights [ Python | Guide ]
  • Search for a role [ Python | Guide ]
  • Change the role for an API key [ Python | Guide ]
  • Retrieve applied Intrusion Prevention rules for all computers [ Python | Guide ]

Rules

  • Add integrity Monitoring rules to a policy [ Python | Guide ]
  • Search Firewall Rules by Name [ Python | Guide ]
  • Add a Log Inspection rule to a policy [ Python | Guide ]
  • Create a basic Log Inspection rule [ Python | Guide ]
  • Create a Log Inspection rule using XML [ Python | Guide ]
  • Create a schedule for business hours only [ Python | Guide ]
  • Retrieve applied Intrusion Prevention rules for all computers [ Python | Guide ]
  • Find the Intrusion Prevention rules for a CVE [ Python | Guide ]
  • Find computers that are not protected against a CVE [ Python | Guide ]
  • Add Intrusion Prevention rules to computers' policies [ Python | Guide ]
  • Obtain recommendations for Intrusion Prevention [ Python | Guide ]
  • Search Intrusion Prevention rules based on date updated [ Python | Guide ]
  • Reset a subset of rule overrides for a policy [ Python | Guide ]
  • Add global Application Control rules [ Python | Guide ]

Scheduled tasks

  • Create a daily schedule for a scheduled task [ Python | Guide ]
  • Create a monthly schedule for a scheduled task [ Python | Guide ]
  • Create a scheduled task that discovers computers [ Python | Guide ]
  • Create, run, and delete a scheduled task that checks for security updates [ Python | Guide ]
  • Run the discover computers scheduled task [ Python | Guide ]

Schedules

  • Create a schedule for business hours only [ Python | Guide ]

Security updates

  • Create, run, and delete a scheduled task that checks for security updates [ Python | Guide ]

Settings

  • Set the maximum number of sessions for users [ Python | Guide ]
  • Configure Firewall for a policy [ [ Python | Guide ]
  • Configure Intrusion Prevention settings [ [ Python | Guide ]
  • Turn on Web Reputation and configure settings [ Python | Guide ]
  • Retrieve policy settings (Firewall network engine mode) [ Python | Guide ]
  • Configure a setting for a policy (Firewall network engine mode) [ Python | Guide ]
  • Configure multiple settings for a policy (Firewall fail open behavior)  [ Python | Guide ]
  • Override reconnaissance scans for a computer [ Python | Guide ]
  • Set a single system setting (allow agent-initiated activation) [ Python | Guide ]

Web Reputation