Entradas

Mostrando las entradas etiquetadas como api

Palo Alto | Create a Security Zone on a Template using PANORAMA REST API call

## REST API POST call that creates a new Security Zone in an target Template in Panorama ## import requests import urllib3 import json urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) url = "https://{panoramaIP}/restapi/v10.2/Network/Zones?name={name_new_ZONE}&location=template&template={target_template}&vsys=vsys1" payload = json.dumps({ "entry": { "@name": "{name_new_ZONE}", "@location": "template", "@template": "{target_template}", "@vsys": "vsys1", "network": { "layer3": {}, "log-setting": "default" } } }) headers = { 'Content-Type': 'application/json', 'X-PAN-KEY': '{PANORAMA_API_KEY}' } response = requests.request("POST", url, headers=headers, data=payload, verify=False) print(response.text)

Fortigate | Rest APIs

# Paso 1: Introducir nuestras credenciales en el firewall Fortigate que nos conectaremos. Tener en cuenta que la secret key no soporta caracteres especiales. curl -k -i -X POST https://x.x.x.x/logincheck -d "username=yyy&secretkey=zzz" --dump-header headers.txt -c cookies.txt    # Paso 2:  Realizar la REST API call mediante curl curl -k -i -X GET https://x.x.x.x/api/v2/cmdb/router/static -b headers.txt curl -k -i -X GET https://x.x.x.x/api/v2/cmdb/system/interface -b headers.txt # Paso 3: Guardar output en un archivo curl -k -i -X GET https://x.x.x.x/api/v2/cmdb/router/static -b headers.txt --output /home/angel/scripts/fortigate_static_routes.txt curl -k -i -X GET https://x.x.x.x/api/v2/cmdb/system/interface -b headers.txt --output /home/angel/scripts/fortigate_interfaces.txt