3. Traffic Extraction¶
3.1. Run an Extraction¶
Schedules a traffic extraction task.
URL
/api-bin/scheduler.cgi
Method
POST
URL Params
None
Data Params
Required
action=create
The action.
ifname=[string]
The interface name.
from_date=[YYYY-MM-DD]
The start date.
from_time=[HH:MM:SS]
The start time.
to_date=[YYYY-MM-DD]
The end date.
to_time=[HH:MM:SS]
The end time.
Optional
bpf=[string]
The BPF filter.
max_file_size=[number]
Maximum size in Mbytes for extracted PCAP files (Default: 100 MB).
Success Response
- Code: 200
- Content: { “result” : “OK”, “task_id” : “<task id>” }
Error Response
- Code: 200
- Content: { “result” : “KO”, “error” : “<description>” }
Curl example:
curl -k "https://nbox:password@192.168.0.1:443/api-bin/scheduler.cgi?action=create&ifname=eth1&from_date=2018-11-06&to_date=2018-11-06&from_time=14:30:00&to_time=14:35:00"
{ "task_id" : "1_1541512925", "result" : "OK" }
- JS (JQuery) example:
$.ajax({
url: "/api-bin/scheduler.cgi",
dataType: "json",
type : "POST",
data: {
action: "create",
ifname: "eth1",
from_date: "2018-01-01",
from_time: "00:00:00",
to_date: "2018-01-01",
to_time: "00:00:10",
bpf: "host 1.2.3.4 and port 80",
max_file_size: "100"
},
success : function(response) {
console.log(response);
}
});
3.2. Delete an Extraction¶
Delete a traffic extraction task.
URL
/api-bin/scheduler.cgi
Method
POST
URL Params
None
Data Params
Required
action=delete
The action.
task_id=[string]
The task id.
Success Response
- Code: 200
- Content: { “result” : “OK” }
Error Response
- Code: 200
- Content: { “result” : “KO”, “error” : “<description>” }
Curl example:
curl -k "https://nbox:password@192.168.0.1:443/api-bin/scheduler.cgi?action=delete&task_id=1_1541512925"
{ "result" : "OK" }
- JS (JQuery) example:
$.ajax({
url: "/api-bin/scheduler.cgi",
dataType: "json",
type : "POST",
data: {
action: "delete",
task_id: "12421983120"
},
success : function(response) {
console.log(response);
}
});
3.3. Extractions Status¶
Shows the status of all scheduled extraction tasks.
URL
/api-bin/scheduler.cgi
Method
GET
URL Params
None
Data Params
Required
action=status
The action.
Success Response
- Code: 200
- Content: { “result” : “OK”, “tasks” : <tasks data> }
Error Response
- Code: 200
- Content: { “result” : “KO”, “error” : “<description>” }
Curl example:
curl -k "https://nbox:password@192.168.0.1:443/api-bin/scheduler.cgi?action=status"
{ "tasks" : { "1_1541512925" : { "status":"done", "files" : { "1" : "/storage/n2disk/eth1/1_1541512925_1.pcap" } } }, "result" : "OK"}
- JS (JQuery) example:
$.ajax({
url: "/api-bin/scheduler.cgi",
dataType: "json",
type : "GET",
data: {
action: "status"
},
success : function(response) {
console.log(response);
}
});
3.4. Download a PCAP¶
Downloads a PCAP file generated by an extraction tasks.
URL
/api-bin/scheduler.cgi
Method
GET
URL Params
None
Data Params
Required
action=download
The action.
pcap_name=<path>
The PCAP file to download.
Success Response
- Code: 200
- Content: PCAP file
Error Response
- Code: 200
- Content: Empty PCAP file
Curl example:
curl -k "https://nbox:password@192.168.0.1:443/api-bin/scheduler.cgi?action=download&pcap_name=/storage/n2disk/eth1/1_1541512925_1.pcap" -o 1_1541512925_1.pcap