5.13.4 api pcap live
The api/pcap/live function is used for starting of the chunked packet capture.
Service and Privileges Groups
Service group is System.
Privileges group is System Control.
Methods
GET
POST
Request
The request contains parameters in the URL (or in the application/x-www-form-urlencoded format when POST is used).
Table 1. Request Parameters
Parameter Name | Mandatory | Expected Values | Default Value | Description |
---|---|---|---|---|
duration | No | Integer defining duration of download in seconds | indefinitely | Defines the duration of the packet capture. If the parameter is omitted or 0, the duration is infinite (i.e. until it is stopped by api/pcap/live/stop or the download is severed by the target device). |
Example of a Request
URL: https://192.168.1.1/api/pcap/live?duration=10
Response
The device starts streaming chunked data upon a successful request.
command = requests.post( "https://" + address + "/api/pcap/live?duration=120", verify=False, stream=True, auth=HTTPBasicAuth("admin", "pass") ) with open("trace.pcap", 'wb') as f: for chunk in command.iter_content(chunk_size=None): f.write(chunk)