Example #1
0
def main():

    fqdn = '*****@*****.**''
    location_description = "Test driving the new Python SDK"

    print("\n\n ##########  STARTING SDK ##########\n\n")
    z = zia.zscaler()
    z.get_zia_partner_creds_from_env(True)
    z.set_cloud('betacloud')
    z.authenticate_partner_api()

    # Get Locations
    print("\n\n ##########  GET LOCATIONS (AFTER)  ##########\n\n")
    z.get_locations()

    # Get a Location ID from get_location() output, comment exit below.  After,
    # insert the Location ID as the first parameter in z.create_sub_location below.
    exit()

    # Create Sub-Location
    z.create_sub_location(
        INSERT-LOCATION-ID,
        "Python SDK Created Sub-Location",
        "10.10.0.0/16",
        gateway_options,
    )

    # Activate change
    print("\n\n ##########  ACTIVATE CHANGES  ##########\n\n")
    z.activate()

    # Get Locations
    print("\n\n ##########  GET LOCATIONS (AFTER)  ##########\n\n")
    z.get_locations()
Example #2
0
def main():

    print("\n\n ##########  STARTING SDK  ##########\n\n")
    z = zia.zscaler()
    z.get_zia_creds_from_env(True)
    z.set_cloud('betacloud')
    z.authenticate_zia_api()

    # Get ZIA blacklist
    print("\n\n ##########  GET BLACKLIST (BEFORE)  ##########\n\n")
    z.get_blacklist_urls()

    # Python list of URLs to filter
    print("\n\n ##########  URL LIST TO ADD TO BLACKLIST  ##########\n\n")
    url_list = [
        'umbrella.cisco.com', '.paloaltonetworks.com', '.versa-networks.com'
    ]
    print(url_list)

    # Add URL list to blacklist
    print("\n\n ##########  ADD URL LIST TO BLACKLIST  ##########\n\n")
    z.add_blacklist_urls(url_list)

    # Activate changes
    print("\n\n ##########  ACTIVATE CHANGES  ##########\n\n")
    z.activate()

    # Sleep for 10 seconds
    print("\n\n ##########  Sleep for 10 seconds  ##########")
    time.sleep(10)

    # Get ZIA blacklist a second time to compare
    print("\n\n ##########  GET BLACKLIST (AFTER)  ##########\n\n")
    z.get_blacklist_urls()
Example #3
0
def main():

    print("\n\n ##########  STARTING SDK ##########\n\n")
    z = zia.zscaler()
    z.get_zia_partner_creds_from_env(True)
    z.set_cloud('betacloud')
    z.authenticate_partner_api()

    # Get all GRE tunnel details
    print("\n\n ##########  GET ALL GRE tunnel details ##########\n\n")
    z.get_gre_tunnel_details()
Example #4
0
def main():

    fqdn = '*****@*****.**'
    location_description = "Test driving the new Python SDK"

    print("\n\n ##########  STARTING SDK ##########\n\n")
    z = zia.zscaler()
    z.get_zia_partner_creds_from_env(True)
    z.set_cloud('betacloud')
    z.authenticate_partner_api()

    # Get Locations (Before add)
    print("\n\n ##########  GET LOCATIONS (BEFORE) ##########\n\n")
    z.get_locations()

    # Pass FQDN.  Will resposnd with VPN credential id
    print("\n\n ##########  CREATE VPN CREDENTIAL  ##########\n\n")
    res = z.create_vpn_credential(fqdn, None)

    # Extract ID from the prior response.
    print("\n\n ##########  EXTRACT VPN CREDENTIAL ID  ##########\n\n")
    vpn_id = z.extract_vpn_credential_id(res.content)

    # Pass location name, VPN credential id, and FQDN
    print("\n\n ##########  CREATE LOCATION  ##########\n\n")
    res = z.create_location(location_description, vpn_id, fqdn)

    # Extract ID from the prior response.
    print("\n\n ##########  EXTRACT LOCATION ID  ##########\n\n")
    location_id = z.extract_location_id(res.content)

    # Activate change
    print("\n\n ##########  ACTIVATE CHANGES  ##########\n\n")
    z.activate()

    # Get Locations (After add)
    print("\n\n ##########  GET LOCATIONS (AFTER)  ##########\n\n")
    z.get_locations()

    # Get VPN Credentials
    print("\n\n ##########  GET VPN CREDENTIALS  ##########\n\n")
    z.get_vpn_credentials()

    # Get VPN Credentials by Id
    print("\n\n ##########  GET VPN CREDENTIALS BY ID ##########\n\n")
    z.get_vpn_credential_by_id(vpn_id)
Example #5
0
def main():

    print("\n\n ##########  STARTING SDK  ##########\n\n")
    z = zia.zscaler()
    z.get_zia_creds_from_env(True)
    z.set_cloud('zscalerthree')
    z.authenticate_zia_api()

    # Query Known Benign MD5 hash
    print("\n\n ##########  Query Known Benign MD5 hash  ##########\n\n")
    query1 = z.get_sanbox_report_md5('d732eef37d941722c8b23221bf173161')

    # Query Known Malicious MD5 hash (summary)
    print(
        "\n\n ##########  Query Known Malicious MD5 hash - summary report  ##########\n\n"
    )
    query2 = z.get_sanbox_report_md5_summary(
        '1acd57deafcbc29617a15708f45c31f0')

    # Query Known Malicious MD5 hash (full report)
    print(
        "\n\n ##########  Query Known Malicious MD5 hash - full report  ##########\n\n"
    )
    query3 = z.get_sanbox_report_md5('1acd57deafcbc29617a15708f45c31f0')

    # Parse report using is_md5hash_suspicious method to determine if file is malicious
    print(
        "\n\n ##########  Parse report output to detemine if file is Suspicious  ##########\n\n"
    )
    if z.is_md5hash_suspicious(query3):
        print("The File Is Suspicious\n\n")
    else:
        print("The File Is Not Suspicious\n\n")

    # Parse report using is_md5hash_malicious method to determine if file is malicious
    print(
        "\n\n ##########  Parse report output to detemine if file is Malicious  ##########\n\n"
    )
    if z.is_md5hash_malicious(query3):
        print("The File Is Malicious\n\n")
    else:
        print("The File Is Not Malicious\n\n")
def main():

    print("\n\n ##########  STARTING SDK ##########\n\n")
    z = zia.zscaler()
    z.get_zia_partner_creds_from_env(True)
    z.set_cloud('betacloud')
    z.authenticate_partner_api()

    # Get all public and private Zscaler Datacenter VIPs
    print("\n\n ##########  GET ALL PUBLIC AND PRIVATE VIPS ##########\n\n")
    z.get_all_vips()

    time.sleep(2)

    # Get all public Zscaler Datacenter VIPs
    print("\n\n ##########  GET ALL PUBLIC VIPS ##########\n\n")
    z.get_all_public_vips()

    time.sleep(2)

    # Get all private Zscaler Datacenter VIPs
    print("\n\n ##########  GET ALL PRIVATE VIPS ##########\n\n")
    z.get_all_private_vips()