script.getscriptsbyevents

Beschrijving

object script.getscriptsbyevents(array eventIds)

Deze methode maakt het mogelijk om scripts op te halen die beschikbaar zijn voor de opgegeven gebeurtenissen.

Deze methode is beschikbaar voor gebruikers van elk type. Toestemming om de methode op te roepen kan worden ingetrokken in de instellingen van gebruikersrollen. Zie Gebruikersrollen voor meer informatie.

Parameters

(string/array) IDs van gebeurtenissen waarvoor scripts moeten worden opgehaald.

Retourwaarden

(object) Geeft een object terug met gebeurtenis-ID's als eigenschappen en arrays van beschikbare scripts als waarden.

De methode zal automatisch macro's uitbreiden in de tekst van bevestiging en url.

Voorbeelden

Scripts ophalen op basis van gebeurtenis-ID's

Haal alle beschikbare scripts op voor gebeurtenissen "632" en "614".

Aanvraag:

{
           "jsonrpc": "2.0",
           "method": "script.getscriptsbyevents",
           "params": [
               "632",
               "614"
           ],
           "id": 1
       }

Reactie:

{
           "jsonrpc": "2.0",
           "result": {
               "632": [
                   {
                       "scriptid": "3",
                       "name": "Besturingssysteem detecteren",
                       "command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "7",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   },
                   {
                       "scriptid": "1",
                       "name": "Ping",
                       "command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "0",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   },
                   {
                       "scriptid": "2",
                       "name": "Traceroute",
                       "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "0",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   }
               ],
               "614": [
                   {
                       "scriptid": "3",
                       "name": "Besturingssysteem detecteren",
                       "command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "7",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   },
                   {
                       "scriptid": "1",
                       "name": "Ping",
                       "command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "0",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   },
                   {
                       "scriptid": "2",
                       "name": "Traceroute",
                       "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "0",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   }
               ]
           },
           "id": 1
       }

Bron

CScript::getScriptsByEvents() in ui/include/classes/api/services/CScript.php.