-
Notifications
You must be signed in to change notification settings - Fork 7
API:Filters
This module requires membership in the 'filters' API access group.
- cidr-contents - Returns the contents for the linked Organization's CIDR report filter.
- cidr-update - Update the linked Organization's CIDR report filter.
- rhost-contents - Returns the contents for the linked Organization's RHost report filter.
- rhost-update - Update the linked Organization's RHost report filter.
Returns the contents for the linked Organization's CIDR report filter.
Required Fields:
apikey : string : Your API key
Response:
JSON object containing the filter data
Successful Example:
$ ./call-api.py filters/cidr-contents {} pretty
{
"data": "192.168.100.1/32\n192.168.103.6/32\n172.16.4.9/32\n"
}
Error Example:
$ ./call-api.py filters/cidr-contents {} pretty
{
"error": "API key is linked to multiple organizations"
}
Update the linked Organization's CIDR report filter.
Required Fields:
apikey : string : Your API key
data : string : filter contents
Optional Fields:
dry-run : boolean : perform a trial run with no changes made
Response:
JSON object containing result details
The filter data must contain one or more CIDRs separated by any combination of commas, spaces, or newlines.
Requirements:
- IPv4 CIDRs must be smaller than a /24.
- IPv6 CIDRs must be a /128.
Larger CIDRs that are not currently configured will be rejected. Rejected CIDRs can be added by emailing [email protected].
Partially Successful Example:
$ ./call-api.py filters/cidr-update '{ "dry-run":1, "data":"192.168.100.1/32\n192.168.103.6/32\n172.16.4.0/20\n"}' pretty
{
"accepted":
{ "count": 2 },
"rejected":
{ "count": 1, "cidr": [ "172.16.4.0/20" ] }
}
Error Example:
$ ./call-api.py filters/cidr-update {} pretty
{
"error": "API key is linked to multiple organizations"
}
A call-api-json.py script is available to send large updates as a JSON file:
$ python3 call-api-json.py filters/cidr-update update.json
Sample update.json:
{
"dry-run": 1,
"data": "192.168.100.1/32
192.168.103.6/32
172.16.4.0/20"
}
Returns the contents for the linked Organization's RHost report filter.
Required Fields:
apikey : string : Your API key
Response:
JSON object containing the filter data
Successful Example:
$ ./call-api.py filters/rhost-contents {} pretty
{
"data": "net.example\ncom.example\n"
}
Error Example:
$ ./call-api.py filters/rhost-contents {} pretty
{
"error": "API key is linked to multiple organizations"
}
Update the linked Organization's RHost report filter.
Required Fields:
apikey : string : Your API key
data : string : filter contents
Optional Fields:
dry-run : boolean : perform a trial run with no changes made
Response:
JSON object containing result details
The filter data must contain one or more reverse order domains separated by any combination of commas, spaces, or newlines.
Reverse domains must contain at least two elements and end with a '.'.
Partially Successful Example:
$ ./call-api.py filters/rhost-update '{ "dry-run":1, "data":"com.example.\nnet.example.\nmyexample\n"}' pretty
{
"accepted":
{ "count": 2 },
"rejected":
{ "count": 1, "rhost": [ "myexample" ] }
}
Error Example:
$ ./call-api.py filters/rhost-update {} pretty
{
"error": "API key is linked to multiple organizations"
}
A call-api-json.py script is available to send large updates as a JSON file:
$ python3 call-api-json.py filters/rhost-update update.json
Sample update.json:
{
"dry-run": 1,
"data": "com.example.
net.example.
myexample"
}