...
When beginning a new request, we always logon and store the returned cookie for future use. In addition to the cookie, if we want to create a resource (Orgs, Locations, Credentials, Discoveries, et al) we need to provide an access token. An access token is generated with every request (except logon) and any of the last 20 (by default, settable in the configuration) will be accepted. You should always aim to use the last access token issued. An example token is in the Get Device List response, below.
Updated for Open-AudIT 3.5.4 onward on 2021-11-29.
Logon
Request
Section | |||
---|---|---|---|
URL | POST | http://localhost/omk/open-audit/login | |
Headers | Accept | application/json | |
Body | Type | form-data | |
Key | username | admin | |
Key | password | password |
...
Code Block |
---|
{ "message": "Authenticated as user admin", "ok": 1 } |
...
Read Devices
Logon as above, then.
Request
...
Section | |||
---|---|---|---|
URL | POST | http://localhost/omk/open-audit/discoveries | |
Headers | Accept | application/json | |
Body | Type | form-data | |
Key | data | {
{23652075c7660006c281bf33589620dc093bdbedf8eb7ed1223449a95748 bcb3f959c14f0daf959e3de92e4213201a56bc205e31b63f35c3f9299670",
"name ": "My SubnetTesting Discovery", "type - 192.168.1.0/24",subnet", "network_address": "http://127.0.0.1/open-audit/", "org_id": 1, "other": { "subnet": "192.169.1.0/24" } } } |
Response
{\"match_dbus\":\"\",\"match_dns_fqdn\":\"\",\"match_dns_hostname\":\"\",\"match_fqdn\":\"\",\"match_hostname\":\"\",\"match_hostname_dbus\":\"\",\"match_hostname_serial\":\"\",\"match_hostname_uuid\":\"\",\"match_ip\":\"\",\"match_ip_no_data\":\"\",\"match_mac\":\"\",\"match_mac_vmware\":\"\",\"match_serial\":\"\",\"match_serial_type\":\"\",\"match_sysname\":\"\",\"match_sysname_serial\":\"\",\"match_uuid\":\"\"}", |
Response
Note, generated from a discoveries read. The actual output should be almost identical.
Code Block |
---|
{
"data":
[
{
"attributes":
{
"ad_domain": "",
"ad_server": "",
"cloud_id": 1,
"cloud_name": "",
"command_options": "",
"description": "Subnet - 192.168.1.0/24",
"devices_assigned_to_location": null,
"devices_assigned_to_org": null,
"discard": "n",
"duration": "00:00:00",
"edited_by": "Administrator",
"edited_date": "2021-11-29 13:16:53",
"id": 3,
"ip_all_count": 0, |
Code Block |
{ "data": [ { "attributes "ip_audited_count": {0, "descriptionip_discovered_count": "Subnet - 192.169.1.0/24", "devicesip_assignedresponding_to_locationcount": null0, "devicesip_assignedscanned_to_orgcount": null0, "discard": "nlast_finished": "2000-01-01 00:00:00", "durationlast_run": "2000-01-01 00:00:00", "editedmatch_byoptions": "Administrator", { "editedmatch_datedbus": "2020-03-24 13:53:08", "idmatch_dns_fqdn": 5"", "ipmatch_alldns_counthostname": 0"", "ipmatch_audited_countfqdn": 0"", "ipmatch_discovered_counthostname": 0"", "ipmatch_respondinghostname_countdbus": 0"", "ipmatch_scannedhostname_countserial": 0"", "lastmatch_hostname_finisheduuid": "2000-01-01 00:00:00", "lastmatch_runip": "2000-01-01 00:00:00", "name "match_ip_no_data": "My Testing Discovery", "network_address": "http://127.0.0.1/open-audit/match_mac": "", "options "match_mac_vmware": "", "orgmatch_idserial": 1"", "orgs.idmatch_serial_type": 1"", "other "match_sysname": {"", "nmapmatch_sysname_serial": {"", "discovery_scan_option_idmatch_uuid": "1", }, "exclude_ipname": "My Testing Discovery", "excludenetwork_tcp_portsaddress": "", "org_id": 1, "exclude_udp_portsorgs.id": ""1, "scan_options": "filtered": "n", { "nmapexclude_tcp_portsip": "0", "nmapexclude_udptcp_ports": "0", "ping"exclude_udp_ports": "y", "service_versionfiltered": "n", "ssh_ports"id": "221", "nmap_tcp_ports": "22,135,62078", "timeout"nmap_udp_ports": "0", "timing"open|filtered": "4", "udp_portsping": "161", }"script_timeout": "", "subnetservice_version": "192.169.1.0/24" ", } "snmp_timeout": "", "statusssh_ports": "", "system.idssh_timeout": 0"", "systemtcp_idports": 0"", "typetimeout": "subnet", }, "idtiming": 5"", "links": { "selfudp_ports": "/omk/open-audit/discoveries/5" ", }, "typewmi_timeout": "discoveries" }, ], "errors": [], "includedseed_ip": []"", "links": { "firstseed_ping": null"y", "last": null, "nextseed_restrict_to_private": null"y", "prev": null, "selfseed_restrict_to_subnet": "http://localhost/omk/open-audit/discoveries" y", }, "meta": { "access_tokenstatus": "94abae66d364697699d0a44e7cfba111c769882bf832014b2ea287623650", "action": "create", "baseurlsubnet": "http://localhost/omk/open-audit192.168.1.0/24", "collection": "discoveries", "currentsystem.id": "y"0, "data_order "system_id": [ 0, "discoveries.id","type": "subnet" "discoveries.name"}, "discoveries.org_id": 3, "discoveries.descriptionlinks",: "discoveries.type", { "discoveries.devices_assigned_to_org",self": "http://dev.local/omk/open-audit/discoveries/3" "discoveries.devices_assigned_to_location"}, "type"discoveries.network_address",: "discoveries" } "discoveries.system_id"], "included": [], "issues": [], "discoveries.optionsmeta",: { "access_token": "discoveries.discardef4421add7e6f2741a2830a1b0262d3b678cc33efdacdd9442d5a871f474", "action": "read", "discoveries.last_run "as_at": "", "baseurl": "discoveries.last_finishedhttp://dev.local/omk/open-audit", "collection": "discoveries.duration", "discoveries.status"current": "y", "data_order": "discoveries.ip_all_count",[ "discoveries.ip_responding_countid", "discoveries.ip_scanned_countname", "discoveries.iporg_discovered_countid", "discoveries.ip_audited_countdescription", "discoveries.edited_bytype", "discoveries.edited_datesubnet", "orgsdiscoveries.idseed_ip", "system.iddiscoveries.seed_restrict_to_subnet", "other.subnetdiscoveries.seed_restrict_to_private", "otherdiscoveries.nmap" seed_ping", ], "debug": falsediscoveries.ad_domain", "filter": [], "discoveries.ad_server", "filtered": "discoveries.devices_assigned_to_org", "format": "json "discoveries.devices_assigned_to_location", "groupby": "discoveries.network_address", "header": "HTTP/1.1 201 Createddiscoveries.system_id", "heading": "Discoveriesdiscoveries.scan_options", "id": 5, "ids": 0discoveries.match_options", "include": "discoveries.command_options", "limit": 1000discoveries.discard", "offset": 0, "discoveries.last_run", "properties": "*discoveries.last_finished", "query_parameters": [], "discoveries.duration", "query_string": "discoveries.status", "received_data": { "discoveries.ip_all_count", "access_token": "23652075c7660006c281bf33589620dc093bdbedf8eb7ed1223449a95748"discoveries.ip_responding_count", "attributes": { discoveries.ip_scanned_count", "description": "Subnet - 192.169.1.0/24discoveries.ip_discovered_count", "name": "My Testing Discovery"discoveries.ip_audited_count", "network_address": "http://127.0.0.1/open-audit/", "discoveries.cloud_id", "orgdiscoveries.cloud_idname": 1, "discoveries.edited_by", "other": "{\"subnet\":\"192.169.1.0\\/24\",\"nmap\":{\"discovery_scan_option_id\":\"1\",\"ping\":\"y\",\"service_version\":\"n\",\"filtered\":\"n\",\"timeout\":\"0\",\"timing\":\"4\",\"nmap_tcp_ports\":\"0\",\"nmap_udp_ports\":\"0\",\"tcp_ports\":\"22,135,62078\",\"udp_ports\":\"161\",\"exclude_tcp_ports\":\"\",\"exclude_udp_ports\":\"\",\"exclude_ip\":\"\",\"ssh_ports\":\"22\"}}", "discoveries.edited_date", "orgs.id", "system.id" ], "debug": false, "filter": [], "filtered": 1, "format": "json", "groupby": "", "header": "HTTP/1.1 200 OK", "heading": "Discoveries", "id": 3, "include": "", "limit": 1000, "typenmap_version": "subnet" 7, "offset": 0, "properties": ".*", }, "query_parameters": [], "typequery_string": "discoveries", }"received_data": [], "request_method": "POSTGET", "requestor": "commercial", "sortserver_app_version": "4.3.0", "sub_resourceserver_platform": "Debian GNU/Linux 9 (stretch)", "sort": "", "sub_resource_id": 0"", "timestamp": "20202021-0311-2429 13:5324:0845", "timezone": "UTC +1000", "total": 01, "version": 1 } } |
...
Update Discovery
Logon as above, then.
Request
Section | |||
---|---|---|---|
URL | PATCH | http://localhost/omk/open-audit/discoveries/5 | |
Headers | Accept | application/json | |
Body | Type | x-www-form-urlencoded | |
Key | data | { |
Response
Note - generated from pre 3.5.4. Attribute outputs will be as above for 3.5.4 onward.
Code Block |
---|
{ "data": [ { "attributes": { "description": "Subnet - 192.169.1.0/24", "devices_assigned_to_location": null, "devices_assigned_to_org": null, "discard": "n", "duration": "00:00:00", "edited_by": "Administrator", "edited_date": "2020-03-24 14:13:36", "id": 5, "ip_all_count": 0, "ip_audited_count": 0, "ip_discovered_count": 0, "ip_responding_count": 0, "ip_scanned_count": 0, "last_finished": "2000-01-01 00:00:00", "last_run": "2000-01-01 00:00:00", "name": "My New Name OMK", "network_address": "http://127.0.0.1/open-audit/", "options": "", "org_id": 1, "orgs.id": 1, "other": { "nmap": { "discovery_scan_option_id": "1", "exclude_ip": "", "exclude_tcp_ports": "", "exclude_udp_ports": "", "filtered": "n", "nmap_tcp_ports": "0", "nmap_udp_ports": "0", "ping": "y", "service_version": "n", "ssh_ports": "22", "tcp_ports": "22,135,62078", "timeout": "0", "timing": "4", "udp_ports": "161" }, "subnet": "192.169.1.0/24" }, "status": "", "system.id": 0, "system_id": 0, "type": "subnet" }, "id": 5, "links": { "self": "/omk/open-audit/discoveries/5" }, "type": "discoveries" } ], "errors": [], "included": [], "links": { "first": null, "last": null, "next": null, "prev": null, "self": "http://localhost/omk/open-audit/discoveries/5" }, "meta": { "access_token": "47049142d113e4e316ae4219afdf54d6a6d034ff779a42fd5198a720da2e", "action": "update", "baseurl": "http://localhost/omk/open-audit", "collection": "discoveries", "current": "y", "data_order": [ "discoveries.id", "discoveries.name", "discoveries.org_id", "discoveries.description", "discoveries.type", "discoveries.devices_assigned_to_org", "discoveries.devices_assigned_to_location", "discoveries.network_address", "discoveries.system_id", "discoveries.options", "discoveries.discard", "discoveries.last_run", "discoveries.last_finished", "discoveries.duration", "discoveries.status", "discoveries.ip_all_count", "discoveries.ip_responding_count", "discoveries.ip_scanned_count", "discoveries.ip_discovered_count", "discoveries.ip_audited_count", "discoveries.edited_by", "discoveries.edited_date", "orgs.id", "system.id", "other.subnet", "other.nmap" ], "debug": false, "filter": [], "filtered": "", "format": "json", "groupby": "", "header": "HTTP/1.1 200 OK", "heading": "Discoveries", "id": 5, "ids": 0, "include": "", "limit": 1000, "offset": 0, "properties": "*", "query_parameters": [], "query_string": "", "received_data": { "attributes": { "id": 5, "name": "My New Name OMK" }, "id": 5, "type": "discoveries" }, "request_method": "PATCH", "requestor": "", "sort": "", "sub_resource": "", "sub_resource_id": 0, "timestamp": "2020-03-24 14:13:36", "timezone": "UTC +1000", "total": 0, "version": 1 } } |
...
Logon as above, then.
Request
Section | ||
---|---|---|
URL | DELETE | http://localhost/omk/open-audit/discoveries/5 |
Headers | Accept | application/json |
Response
Code Block |
---|
{ "meta": { "access_token": "530d34dc6304ebd361d088d7831e4ce9d276ac8a4826837bdf36e8e84c87", "action": "delete", "baseurl": "http://localhost/open-audit/", "collection": "discoveries", "current": "y", "debug": false, "filtered": "", "format": "json", "groupby": "", "header": "HTTP/1.1 200 OK", "id": 5, "ids": 0, "include": "", "limit": 1000, "offset": 0, "properties": "*", "query_string": "", "request_method": "DELETE", "requestor": "", "sort": "", "sub_resource": "", "sub_resource_id": 0, "total": 0, "timestamp": "2020-03-24 14:22:38", "timezone": "UTC +1000", "version": 1, "filter": [], "query_parameters": [], "received_data": [], "heading": "Discoveries", "data_order": [] }, "links": { "self": "http://localhost/open-audit/index.php/discoveries/5", "first": null, "last": null, "next": null, "prev": null }, "included": [], "data": [ { "type": "discoveries" } ] } |
...