test: add suite_outputformats for json output regression testing.

This suite uses different output formats to check against fixed
samples.

Change-Id: I8adccfefea35a6d3cfacf3da61e8a72d830ed3a0
Reviewed-on: https://code.wireshark.org/review/31056
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
This commit is contained in:
Dario Lombardo 2018-12-15 21:25:40 +01:00
parent a051c12f2c
commit 5444b41530
5 changed files with 3882 additions and 0 deletions

View File

@ -3128,6 +3128,7 @@ set(_test_group_list
suite_io
suite_mergecap
suite_nameres
suite_outputformats
suite_text2pcap
suite_sharkd
suite_unittests

8
test/baseline/dhcp.ek Normal file
View File

@ -0,0 +1,8 @@
{"index" : {"_index": "packets-2004-12-05", "_type": "pcap_file"}}
{"timestamp" : "1102274184317", "layers" : {"frame": {"frame_frame_encap_type": "1","frame_frame_time": "Dec 5, 2004 19:16:24.317453000 UTC","frame_frame_offset_shift": "0.000000000","frame_frame_time_epoch": "1102274184.317453000","frame_frame_time_delta": "0.000000000","frame_frame_time_delta_displayed": "0.000000000","frame_frame_time_relative": "0.000000000","frame_frame_number": "1","frame_frame_len": "314","frame_frame_cap_len": "314","frame_frame_marked": "0","frame_frame_ignored": "0","frame_frame_protocols": "eth:ethertype:ip:udp:dhcp"},"eth": {"eth_eth_dst": "ff:ff:ff:ff:ff:ff","eth_dst_eth_dst_resolved": "Broadcast","eth_dst_eth_addr": "ff:ff:ff:ff:ff:ff","eth_dst_eth_addr_resolved": "Broadcast","eth_dst_eth_lg": "1","eth_dst_eth_ig": "1","eth_eth_src": "00:0b:82:01:fc:42","eth_src_eth_src_resolved": "Grandstr_01:fc:42","eth_src_eth_addr": "00:0b:82:01:fc:42","eth_src_eth_addr_resolved": "Grandstr_01:fc:42","eth_src_eth_lg": "0","eth_src_eth_ig": "0","eth_eth_type": "0x00000800"},"ip": {"ip_ip_version": "4","ip_ip_hdr_len": "20","ip_ip_dsfield": "0x00000000","ip_dsfield_ip_dsfield_dscp": "0","ip_dsfield_ip_dsfield_ecn": "0","ip_ip_len": "300","ip_ip_id": "0x0000a836","ip_ip_flags": "0x00000000","ip_flags_ip_flags_rb": "0","ip_flags_ip_flags_df": "0","ip_flags_ip_flags_mf": "0","ip_flags_ip_frag_offset": "0","ip_ip_ttl": "250","ip_ip_proto": "17","ip_ip_checksum": "0x0000178b","ip_ip_checksum_status": "2","ip_ip_src": "0.0.0.0","ip_ip_addr": ["0.0.0.0","255.255.255.255"],"ip_ip_src_host": "0.0.0.0","ip_ip_host": ["0.0.0.0","255.255.255.255"],"ip_ip_dst": "255.255.255.255","ip_ip_dst_host": "255.255.255.255"},"udp": {"udp_udp_srcport": "68","udp_udp_dstport": "67","udp_udp_port": ["68","67"],"udp_udp_length": "280","udp_udp_checksum": "0x0000591f","udp_udp_checksum_status": "2","udp_udp_stream": "0","udp_text": "Timestamps","text_udp_time_relative": "0.000000000","text_udp_time_delta": "0.000000000"},"dhcp": {"dhcp_dhcp_type": "1","dhcp_dhcp_hw_type": "0x00000001","dhcp_dhcp_hw_len": "6","dhcp_dhcp_hops": "0","dhcp_dhcp_id": "0x00003d1d","dhcp_dhcp_secs": "0","dhcp_dhcp_flags": "0x00000000","dhcp_flags_dhcp_flags_bc": "0","dhcp_flags_dhcp_flags_reserved": "0x00000000","dhcp_dhcp_ip_client": "0.0.0.0","dhcp_dhcp_ip_your": "0.0.0.0","dhcp_dhcp_ip_server": "0.0.0.0","dhcp_dhcp_ip_relay": "0.0.0.0","dhcp_dhcp_hw_mac_addr": "00:0b:82:01:fc:42","dhcp_dhcp_hw_addr_padding": "00:00:00:00:00:00:00:00:00:00","dhcp_dhcp_server": "","dhcp_dhcp_file": "","dhcp_dhcp_cookie": "99.130.83.99","dhcp_dhcp_option_type": ["53","61","50","55","0"],"dhcp_option_type_dhcp_option_length": ["1","7","4","4"],"dhcp_option_type_dhcp_option_value": ["01","01:00:0b:82:01:fc:42","00:00:00:00","01:03:06:2a"],"dhcp_option_type_dhcp_option_dhcp": "1","dhcp_option_type_dhcp_hw_type": "0x00000001","dhcp_option_type_dhcp_hw_mac_addr": "00:0b:82:01:fc:42","dhcp_option_type_dhcp_option_requested_ip_address": "0.0.0.0","dhcp_option_type_dhcp_option_request_list_item": ["1","3","6","42"],"dhcp_option_type_dhcp_option_end": "255","dhcp_dhcp_option_padding": "00:00:00:00:00:00:00"}}}
{"index" : {"_index": "packets-2004-12-05", "_type": "pcap_file"}}
{"timestamp" : "1102274184317", "layers" : {"frame": {"frame_frame_encap_type": "1","frame_frame_time": "Dec 5, 2004 19:16:24.317748000 UTC","frame_frame_offset_shift": "0.000000000","frame_frame_time_epoch": "1102274184.317748000","frame_frame_time_delta": "0.000295000","frame_frame_time_delta_displayed": "0.000295000","frame_frame_time_relative": "0.000295000","frame_frame_number": "2","frame_frame_len": "342","frame_frame_cap_len": "342","frame_frame_marked": "0","frame_frame_ignored": "0","frame_frame_protocols": "eth:ethertype:ip:udp:dhcp"},"eth": {"eth_eth_dst": "00:0b:82:01:fc:42","eth_dst_eth_dst_resolved": "Grandstr_01:fc:42","eth_dst_eth_addr": "00:0b:82:01:fc:42","eth_dst_eth_addr_resolved": "Grandstr_01:fc:42","eth_dst_eth_lg": "0","eth_dst_eth_ig": "0","eth_eth_src": "00:08:74:ad:f1:9b","eth_src_eth_src_resolved": "Dell_ad:f1:9b","eth_src_eth_addr": "00:08:74:ad:f1:9b","eth_src_eth_addr_resolved": "Dell_ad:f1:9b","eth_src_eth_lg": "0","eth_src_eth_ig": "0","eth_eth_type": "0x00000800"},"ip": {"ip_ip_version": "4","ip_ip_hdr_len": "20","ip_ip_dsfield": "0x00000000","ip_dsfield_ip_dsfield_dscp": "0","ip_dsfield_ip_dsfield_ecn": "0","ip_ip_len": "328","ip_ip_id": "0x00000445","ip_ip_flags": "0x00000000","ip_flags_ip_flags_rb": "0","ip_flags_ip_flags_df": "0","ip_flags_ip_flags_mf": "0","ip_flags_ip_frag_offset": "0","ip_ip_ttl": "128","ip_ip_proto": "17","ip_ip_checksum": "0x00000000","ip_ip_checksum_status": "2","ip_ip_src": "192.168.0.1","ip_ip_addr": ["192.168.0.1","192.168.0.10"],"ip_ip_src_host": "192.168.0.1","ip_ip_host": ["192.168.0.1","192.168.0.10"],"ip_ip_dst": "192.168.0.10","ip_ip_dst_host": "192.168.0.10"},"udp": {"udp_udp_srcport": "67","udp_udp_dstport": "68","udp_udp_port": ["67","68"],"udp_udp_length": "308","udp_udp_checksum": "0x00002233","udp_udp_checksum_status": "2","udp_udp_stream": "1","udp_text": "Timestamps","text_udp_time_relative": "0.000000000","text_udp_time_delta": "0.000000000"},"dhcp": {"dhcp_dhcp_type": "2","dhcp_dhcp_hw_type": "0x00000001","dhcp_dhcp_hw_len": "6","dhcp_dhcp_hops": "0","dhcp_dhcp_id": "0x00003d1d","dhcp_dhcp_secs": "0","dhcp_dhcp_flags": "0x00000000","dhcp_flags_dhcp_flags_bc": "0","dhcp_flags_dhcp_flags_reserved": "0x00000000","dhcp_dhcp_ip_client": "0.0.0.0","dhcp_dhcp_ip_your": "192.168.0.10","dhcp_dhcp_ip_server": "192.168.0.1","dhcp_dhcp_ip_relay": "0.0.0.0","dhcp_dhcp_hw_mac_addr": "00:0b:82:01:fc:42","dhcp_dhcp_hw_addr_padding": "00:00:00:00:00:00:00:00:00:00","dhcp_dhcp_server": "","dhcp_dhcp_file": "","dhcp_dhcp_cookie": "99.130.83.99","dhcp_dhcp_option_type": ["53","1","58","59","51","54","0"],"dhcp_option_type_dhcp_option_length": ["1","4","4","4","4","4"],"dhcp_option_type_dhcp_option_value": ["02","ff:ff:ff:00","00:00:07:08","00:00:0c:4e","00:00:0e:10","c0:a8:00:01"],"dhcp_option_type_dhcp_option_dhcp": "2","dhcp_option_type_dhcp_option_subnet_mask": "255.255.255.0","dhcp_option_type_dhcp_option_renewal_time_value": "1800","dhcp_option_type_dhcp_option_rebinding_time_value": "3150","dhcp_option_type_dhcp_option_ip_address_lease_time": "3600","dhcp_option_type_dhcp_option_dhcp_server_id": "192.168.0.1","dhcp_option_type_dhcp_option_end": "255","dhcp_dhcp_option_padding": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"}}}
{"index" : {"_index": "packets-2004-12-05", "_type": "pcap_file"}}
{"timestamp" : "1102274184387", "layers" : {"frame": {"frame_frame_encap_type": "1","frame_frame_time": "Dec 5, 2004 19:16:24.387484000 UTC","frame_frame_offset_shift": "0.000000000","frame_frame_time_epoch": "1102274184.387484000","frame_frame_time_delta": "0.069736000","frame_frame_time_delta_displayed": "0.069736000","frame_frame_time_relative": "0.070031000","frame_frame_number": "3","frame_frame_len": "314","frame_frame_cap_len": "314","frame_frame_marked": "0","frame_frame_ignored": "0","frame_frame_protocols": "eth:ethertype:ip:udp:dhcp"},"eth": {"eth_eth_dst": "ff:ff:ff:ff:ff:ff","eth_dst_eth_dst_resolved": "Broadcast","eth_dst_eth_addr": "ff:ff:ff:ff:ff:ff","eth_dst_eth_addr_resolved": "Broadcast","eth_dst_eth_lg": "1","eth_dst_eth_ig": "1","eth_eth_src": "00:0b:82:01:fc:42","eth_src_eth_src_resolved": "Grandstr_01:fc:42","eth_src_eth_addr": "00:0b:82:01:fc:42","eth_src_eth_addr_resolved": "Grandstr_01:fc:42","eth_src_eth_lg": "0","eth_src_eth_ig": "0","eth_eth_type": "0x00000800"},"ip": {"ip_ip_version": "4","ip_ip_hdr_len": "20","ip_ip_dsfield": "0x00000000","ip_dsfield_ip_dsfield_dscp": "0","ip_dsfield_ip_dsfield_ecn": "0","ip_ip_len": "300","ip_ip_id": "0x0000a837","ip_ip_flags": "0x00000000","ip_flags_ip_flags_rb": "0","ip_flags_ip_flags_df": "0","ip_flags_ip_flags_mf": "0","ip_flags_ip_frag_offset": "0","ip_ip_ttl": "250","ip_ip_proto": "17","ip_ip_checksum": "0x0000178a","ip_ip_checksum_status": "2","ip_ip_src": "0.0.0.0","ip_ip_addr": ["0.0.0.0","255.255.255.255"],"ip_ip_src_host": "0.0.0.0","ip_ip_host": ["0.0.0.0","255.255.255.255"],"ip_ip_dst": "255.255.255.255","ip_ip_dst_host": "255.255.255.255"},"udp": {"udp_udp_srcport": "68","udp_udp_dstport": "67","udp_udp_port": ["68","67"],"udp_udp_length": "280","udp_udp_checksum": "0x00009fbd","udp_udp_checksum_status": "2","udp_udp_stream": "0","udp_text": "Timestamps","text_udp_time_relative": "0.070031000","text_udp_time_delta": "0.070031000"},"dhcp": {"dhcp_dhcp_type": "1","dhcp_dhcp_hw_type": "0x00000001","dhcp_dhcp_hw_len": "6","dhcp_dhcp_hops": "0","dhcp_dhcp_id": "0x00003d1e","dhcp_dhcp_secs": "0","dhcp_dhcp_flags": "0x00000000","dhcp_flags_dhcp_flags_bc": "0","dhcp_flags_dhcp_flags_reserved": "0x00000000","dhcp_dhcp_ip_client": "0.0.0.0","dhcp_dhcp_ip_your": "0.0.0.0","dhcp_dhcp_ip_server": "0.0.0.0","dhcp_dhcp_ip_relay": "0.0.0.0","dhcp_dhcp_hw_mac_addr": "00:0b:82:01:fc:42","dhcp_dhcp_hw_addr_padding": "00:00:00:00:00:00:00:00:00:00","dhcp_dhcp_server": "","dhcp_dhcp_file": "","dhcp_dhcp_cookie": "99.130.83.99","dhcp_dhcp_option_type": ["53","61","50","54","55","0"],"dhcp_option_type_dhcp_option_length": ["1","7","4","4","4"],"dhcp_option_type_dhcp_option_value": ["03","01:00:0b:82:01:fc:42","c0:a8:00:0a","c0:a8:00:01","01:03:06:2a"],"dhcp_option_type_dhcp_option_dhcp": "3","dhcp_option_type_dhcp_hw_type": "0x00000001","dhcp_option_type_dhcp_hw_mac_addr": "00:0b:82:01:fc:42","dhcp_option_type_dhcp_option_requested_ip_address": "192.168.0.10","dhcp_option_type_dhcp_option_dhcp_server_id": "192.168.0.1","dhcp_option_type_dhcp_option_request_list_item": ["1","3","6","42"],"dhcp_option_type_dhcp_option_end": "255","dhcp_dhcp_option_padding": "00"}}}
{"index" : {"_index": "packets-2004-12-05", "_type": "pcap_file"}}
{"timestamp" : "1102274184387", "layers" : {"frame": {"frame_frame_encap_type": "1","frame_frame_time": "Dec 5, 2004 19:16:24.387798000 UTC","frame_frame_offset_shift": "0.000000000","frame_frame_time_epoch": "1102274184.387798000","frame_frame_time_delta": "0.000314000","frame_frame_time_delta_displayed": "0.000314000","frame_frame_time_relative": "0.070345000","frame_frame_number": "4","frame_frame_len": "342","frame_frame_cap_len": "342","frame_frame_marked": "0","frame_frame_ignored": "0","frame_frame_protocols": "eth:ethertype:ip:udp:dhcp"},"eth": {"eth_eth_dst": "00:0b:82:01:fc:42","eth_dst_eth_dst_resolved": "Grandstr_01:fc:42","eth_dst_eth_addr": "00:0b:82:01:fc:42","eth_dst_eth_addr_resolved": "Grandstr_01:fc:42","eth_dst_eth_lg": "0","eth_dst_eth_ig": "0","eth_eth_src": "00:08:74:ad:f1:9b","eth_src_eth_src_resolved": "Dell_ad:f1:9b","eth_src_eth_addr": "00:08:74:ad:f1:9b","eth_src_eth_addr_resolved": "Dell_ad:f1:9b","eth_src_eth_lg": "0","eth_src_eth_ig": "0","eth_eth_type": "0x00000800"},"ip": {"ip_ip_version": "4","ip_ip_hdr_len": "20","ip_ip_dsfield": "0x00000000","ip_dsfield_ip_dsfield_dscp": "0","ip_dsfield_ip_dsfield_ecn": "0","ip_ip_len": "328","ip_ip_id": "0x00000446","ip_ip_flags": "0x00000000","ip_flags_ip_flags_rb": "0","ip_flags_ip_flags_df": "0","ip_flags_ip_flags_mf": "0","ip_flags_ip_frag_offset": "0","ip_ip_ttl": "128","ip_ip_proto": "17","ip_ip_checksum": "0x00000000","ip_ip_checksum_status": "2","ip_ip_src": "192.168.0.1","ip_ip_addr": ["192.168.0.1","192.168.0.10"],"ip_ip_src_host": "192.168.0.1","ip_ip_host": ["192.168.0.1","192.168.0.10"],"ip_ip_dst": "192.168.0.10","ip_ip_dst_host": "192.168.0.10"},"udp": {"udp_udp_srcport": "67","udp_udp_dstport": "68","udp_udp_port": ["67","68"],"udp_udp_length": "308","udp_udp_checksum": "0x0000dfdb","udp_udp_checksum_status": "2","udp_udp_stream": "1","udp_text": "Timestamps","text_udp_time_relative": "0.070050000","text_udp_time_delta": "0.070050000"},"dhcp": {"dhcp_dhcp_type": "2","dhcp_dhcp_hw_type": "0x00000001","dhcp_dhcp_hw_len": "6","dhcp_dhcp_hops": "0","dhcp_dhcp_id": "0x00003d1e","dhcp_dhcp_secs": "0","dhcp_dhcp_flags": "0x00000000","dhcp_flags_dhcp_flags_bc": "0","dhcp_flags_dhcp_flags_reserved": "0x00000000","dhcp_dhcp_ip_client": "0.0.0.0","dhcp_dhcp_ip_your": "192.168.0.10","dhcp_dhcp_ip_server": "0.0.0.0","dhcp_dhcp_ip_relay": "0.0.0.0","dhcp_dhcp_hw_mac_addr": "00:0b:82:01:fc:42","dhcp_dhcp_hw_addr_padding": "00:00:00:00:00:00:00:00:00:00","dhcp_dhcp_server": "","dhcp_dhcp_file": "","dhcp_dhcp_cookie": "99.130.83.99","dhcp_dhcp_option_type": ["53","58","59","51","54","1","0"],"dhcp_option_type_dhcp_option_length": ["1","4","4","4","4","4"],"dhcp_option_type_dhcp_option_value": ["05","00:00:07:08","00:00:0c:4e","00:00:0e:10","c0:a8:00:01","ff:ff:ff:00"],"dhcp_option_type_dhcp_option_dhcp": "5","dhcp_option_type_dhcp_option_renewal_time_value": "1800","dhcp_option_type_dhcp_option_rebinding_time_value": "3150","dhcp_option_type_dhcp_option_ip_address_lease_time": "3600","dhcp_option_type_dhcp_option_dhcp_server_id": "192.168.0.1","dhcp_option_type_dhcp_option_subnet_mask": "255.255.255.0","dhcp_option_type_dhcp_option_end": "255","dhcp_dhcp_option_padding": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"}}}

592
test/baseline/dhcp.json Normal file
View File

@ -0,0 +1,592 @@
[
{
"_index": "packets-2004-12-05",
"_type": "pcap_file",
"_score": null,
"_source": {
"layers": {
"frame": {
"frame.encap_type": "1",
"frame.time": "Dec 5, 2004 19:16:24.317453000 UTC",
"frame.offset_shift": "0.000000000",
"frame.time_epoch": "1102274184.317453000",
"frame.time_delta": "0.000000000",
"frame.time_delta_displayed": "0.000000000",
"frame.time_relative": "0.000000000",
"frame.number": "1",
"frame.len": "314",
"frame.cap_len": "314",
"frame.marked": "0",
"frame.ignored": "0",
"frame.protocols": "eth:ethertype:ip:udp:dhcp"
},
"eth": {
"eth.dst": "ff:ff:ff:ff:ff:ff",
"eth.dst_tree": {
"eth.dst_resolved": "Broadcast",
"eth.addr": "ff:ff:ff:ff:ff:ff",
"eth.addr_resolved": "Broadcast",
"eth.lg": "1",
"eth.ig": "1"
},
"eth.src": "00:0b:82:01:fc:42",
"eth.src_tree": {
"eth.src_resolved": "Grandstr_01:fc:42",
"eth.addr": "00:0b:82:01:fc:42",
"eth.addr_resolved": "Grandstr_01:fc:42",
"eth.lg": "0",
"eth.ig": "0"
},
"eth.type": "0x00000800"
},
"ip": {
"ip.version": "4",
"ip.hdr_len": "20",
"ip.dsfield": "0x00000000",
"ip.dsfield_tree": {
"ip.dsfield.dscp": "0",
"ip.dsfield.ecn": "0"
},
"ip.len": "300",
"ip.id": "0x0000a836",
"ip.flags": "0x00000000",
"ip.flags_tree": {
"ip.flags.rb": "0",
"ip.flags.df": "0",
"ip.flags.mf": "0",
"ip.frag_offset": "0"
},
"ip.ttl": "250",
"ip.proto": "17",
"ip.checksum": "0x0000178b",
"ip.checksum.status": "2",
"ip.src": "0.0.0.0",
"ip.addr": "0.0.0.0",
"ip.src_host": "0.0.0.0",
"ip.host": "0.0.0.0",
"ip.dst": "255.255.255.255",
"ip.addr": "255.255.255.255",
"ip.dst_host": "255.255.255.255",
"ip.host": "255.255.255.255"
},
"udp": {
"udp.srcport": "68",
"udp.dstport": "67",
"udp.port": "68",
"udp.port": "67",
"udp.length": "280",
"udp.checksum": "0x0000591f",
"udp.checksum.status": "2",
"udp.stream": "0",
"Timestamps": {
"udp.time_relative": "0.000000000",
"udp.time_delta": "0.000000000"
}
},
"dhcp": {
"dhcp.type": "1",
"dhcp.hw.type": "0x00000001",
"dhcp.hw.len": "6",
"dhcp.hops": "0",
"dhcp.id": "0x00003d1d",
"dhcp.secs": "0",
"dhcp.flags": "0x00000000",
"dhcp.flags_tree": {
"dhcp.flags.bc": "0",
"dhcp.flags.reserved": "0x00000000"
},
"dhcp.ip.client": "0.0.0.0",
"dhcp.ip.your": "0.0.0.0",
"dhcp.ip.server": "0.0.0.0",
"dhcp.ip.relay": "0.0.0.0",
"dhcp.hw.mac_addr": "00:0b:82:01:fc:42",
"dhcp.hw.addr_padding": "00:00:00:00:00:00:00:00:00:00",
"dhcp.server": "",
"dhcp.file": "",
"dhcp.cookie": "99.130.83.99",
"dhcp.option.type": "53",
"dhcp.option.type_tree": {
"dhcp.option.length": "1",
"dhcp.option.value": "01",
"dhcp.option.dhcp": "1"
},
"dhcp.option.type": "61",
"dhcp.option.type_tree": {
"dhcp.option.length": "7",
"dhcp.option.value": "01:00:0b:82:01:fc:42",
"dhcp.hw.type": "0x00000001",
"dhcp.hw.mac_addr": "00:0b:82:01:fc:42"
},
"dhcp.option.type": "50",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "00:00:00:00",
"dhcp.option.requested_ip_address": "0.0.0.0"
},
"dhcp.option.type": "55",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "01:03:06:2a",
"dhcp.option.request_list_item": "1",
"dhcp.option.request_list_item": "3",
"dhcp.option.request_list_item": "6",
"dhcp.option.request_list_item": "42"
},
"dhcp.option.type": "0",
"dhcp.option.type_tree": {
"dhcp.option.end": "255"
},
"dhcp.option.padding": "00:00:00:00:00:00:00"
}
}
}
},
{
"_index": "packets-2004-12-05",
"_type": "pcap_file",
"_score": null,
"_source": {
"layers": {
"frame": {
"frame.encap_type": "1",
"frame.time": "Dec 5, 2004 19:16:24.317748000 UTC",
"frame.offset_shift": "0.000000000",
"frame.time_epoch": "1102274184.317748000",
"frame.time_delta": "0.000295000",
"frame.time_delta_displayed": "0.000295000",
"frame.time_relative": "0.000295000",
"frame.number": "2",
"frame.len": "342",
"frame.cap_len": "342",
"frame.marked": "0",
"frame.ignored": "0",
"frame.protocols": "eth:ethertype:ip:udp:dhcp"
},
"eth": {
"eth.dst": "00:0b:82:01:fc:42",
"eth.dst_tree": {
"eth.dst_resolved": "Grandstr_01:fc:42",
"eth.addr": "00:0b:82:01:fc:42",
"eth.addr_resolved": "Grandstr_01:fc:42",
"eth.lg": "0",
"eth.ig": "0"
},
"eth.src": "00:08:74:ad:f1:9b",
"eth.src_tree": {
"eth.src_resolved": "Dell_ad:f1:9b",
"eth.addr": "00:08:74:ad:f1:9b",
"eth.addr_resolved": "Dell_ad:f1:9b",
"eth.lg": "0",
"eth.ig": "0"
},
"eth.type": "0x00000800"
},
"ip": {
"ip.version": "4",
"ip.hdr_len": "20",
"ip.dsfield": "0x00000000",
"ip.dsfield_tree": {
"ip.dsfield.dscp": "0",
"ip.dsfield.ecn": "0"
},
"ip.len": "328",
"ip.id": "0x00000445",
"ip.flags": "0x00000000",
"ip.flags_tree": {
"ip.flags.rb": "0",
"ip.flags.df": "0",
"ip.flags.mf": "0",
"ip.frag_offset": "0"
},
"ip.ttl": "128",
"ip.proto": "17",
"ip.checksum": "0x00000000",
"ip.checksum.status": "2",
"ip.src": "192.168.0.1",
"ip.addr": "192.168.0.1",
"ip.src_host": "192.168.0.1",
"ip.host": "192.168.0.1",
"ip.dst": "192.168.0.10",
"ip.addr": "192.168.0.10",
"ip.dst_host": "192.168.0.10",
"ip.host": "192.168.0.10"
},
"udp": {
"udp.srcport": "67",
"udp.dstport": "68",
"udp.port": "67",
"udp.port": "68",
"udp.length": "308",
"udp.checksum": "0x00002233",
"udp.checksum.status": "2",
"udp.stream": "1",
"Timestamps": {
"udp.time_relative": "0.000000000",
"udp.time_delta": "0.000000000"
}
},
"dhcp": {
"dhcp.type": "2",
"dhcp.hw.type": "0x00000001",
"dhcp.hw.len": "6",
"dhcp.hops": "0",
"dhcp.id": "0x00003d1d",
"dhcp.secs": "0",
"dhcp.flags": "0x00000000",
"dhcp.flags_tree": {
"dhcp.flags.bc": "0",
"dhcp.flags.reserved": "0x00000000"
},
"dhcp.ip.client": "0.0.0.0",
"dhcp.ip.your": "192.168.0.10",
"dhcp.ip.server": "192.168.0.1",
"dhcp.ip.relay": "0.0.0.0",
"dhcp.hw.mac_addr": "00:0b:82:01:fc:42",
"dhcp.hw.addr_padding": "00:00:00:00:00:00:00:00:00:00",
"dhcp.server": "",
"dhcp.file": "",
"dhcp.cookie": "99.130.83.99",
"dhcp.option.type": "53",
"dhcp.option.type_tree": {
"dhcp.option.length": "1",
"dhcp.option.value": "02",
"dhcp.option.dhcp": "2"
},
"dhcp.option.type": "1",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "ff:ff:ff:00",
"dhcp.option.subnet_mask": "255.255.255.0"
},
"dhcp.option.type": "58",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "00:00:07:08",
"dhcp.option.renewal_time_value": "1800"
},
"dhcp.option.type": "59",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "00:00:0c:4e",
"dhcp.option.rebinding_time_value": "3150"
},
"dhcp.option.type": "51",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "00:00:0e:10",
"dhcp.option.ip_address_lease_time": "3600"
},
"dhcp.option.type": "54",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "c0:a8:00:01",
"dhcp.option.dhcp_server_id": "192.168.0.1"
},
"dhcp.option.type": "0",
"dhcp.option.type_tree": {
"dhcp.option.end": "255"
},
"dhcp.option.padding": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"
}
}
}
},
{
"_index": "packets-2004-12-05",
"_type": "pcap_file",
"_score": null,
"_source": {
"layers": {
"frame": {
"frame.encap_type": "1",
"frame.time": "Dec 5, 2004 19:16:24.387484000 UTC",
"frame.offset_shift": "0.000000000",
"frame.time_epoch": "1102274184.387484000",
"frame.time_delta": "0.069736000",
"frame.time_delta_displayed": "0.069736000",
"frame.time_relative": "0.070031000",
"frame.number": "3",
"frame.len": "314",
"frame.cap_len": "314",
"frame.marked": "0",
"frame.ignored": "0",
"frame.protocols": "eth:ethertype:ip:udp:dhcp"
},
"eth": {
"eth.dst": "ff:ff:ff:ff:ff:ff",
"eth.dst_tree": {
"eth.dst_resolved": "Broadcast",
"eth.addr": "ff:ff:ff:ff:ff:ff",
"eth.addr_resolved": "Broadcast",
"eth.lg": "1",
"eth.ig": "1"
},
"eth.src": "00:0b:82:01:fc:42",
"eth.src_tree": {
"eth.src_resolved": "Grandstr_01:fc:42",
"eth.addr": "00:0b:82:01:fc:42",
"eth.addr_resolved": "Grandstr_01:fc:42",
"eth.lg": "0",
"eth.ig": "0"
},
"eth.type": "0x00000800"
},
"ip": {
"ip.version": "4",
"ip.hdr_len": "20",
"ip.dsfield": "0x00000000",
"ip.dsfield_tree": {
"ip.dsfield.dscp": "0",
"ip.dsfield.ecn": "0"
},
"ip.len": "300",
"ip.id": "0x0000a837",
"ip.flags": "0x00000000",
"ip.flags_tree": {
"ip.flags.rb": "0",
"ip.flags.df": "0",
"ip.flags.mf": "0",
"ip.frag_offset": "0"
},
"ip.ttl": "250",
"ip.proto": "17",
"ip.checksum": "0x0000178a",
"ip.checksum.status": "2",
"ip.src": "0.0.0.0",
"ip.addr": "0.0.0.0",
"ip.src_host": "0.0.0.0",
"ip.host": "0.0.0.0",
"ip.dst": "255.255.255.255",
"ip.addr": "255.255.255.255",
"ip.dst_host": "255.255.255.255",
"ip.host": "255.255.255.255"
},
"udp": {
"udp.srcport": "68",
"udp.dstport": "67",
"udp.port": "68",
"udp.port": "67",
"udp.length": "280",
"udp.checksum": "0x00009fbd",
"udp.checksum.status": "2",
"udp.stream": "0",
"Timestamps": {
"udp.time_relative": "0.070031000",
"udp.time_delta": "0.070031000"
}
},
"dhcp": {
"dhcp.type": "1",
"dhcp.hw.type": "0x00000001",
"dhcp.hw.len": "6",
"dhcp.hops": "0",
"dhcp.id": "0x00003d1e",
"dhcp.secs": "0",
"dhcp.flags": "0x00000000",
"dhcp.flags_tree": {
"dhcp.flags.bc": "0",
"dhcp.flags.reserved": "0x00000000"
},
"dhcp.ip.client": "0.0.0.0",
"dhcp.ip.your": "0.0.0.0",
"dhcp.ip.server": "0.0.0.0",
"dhcp.ip.relay": "0.0.0.0",
"dhcp.hw.mac_addr": "00:0b:82:01:fc:42",
"dhcp.hw.addr_padding": "00:00:00:00:00:00:00:00:00:00",
"dhcp.server": "",
"dhcp.file": "",
"dhcp.cookie": "99.130.83.99",
"dhcp.option.type": "53",
"dhcp.option.type_tree": {
"dhcp.option.length": "1",
"dhcp.option.value": "03",
"dhcp.option.dhcp": "3"
},
"dhcp.option.type": "61",
"dhcp.option.type_tree": {
"dhcp.option.length": "7",
"dhcp.option.value": "01:00:0b:82:01:fc:42",
"dhcp.hw.type": "0x00000001",
"dhcp.hw.mac_addr": "00:0b:82:01:fc:42"
},
"dhcp.option.type": "50",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "c0:a8:00:0a",
"dhcp.option.requested_ip_address": "192.168.0.10"
},
"dhcp.option.type": "54",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "c0:a8:00:01",
"dhcp.option.dhcp_server_id": "192.168.0.1"
},
"dhcp.option.type": "55",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "01:03:06:2a",
"dhcp.option.request_list_item": "1",
"dhcp.option.request_list_item": "3",
"dhcp.option.request_list_item": "6",
"dhcp.option.request_list_item": "42"
},
"dhcp.option.type": "0",
"dhcp.option.type_tree": {
"dhcp.option.end": "255"
},
"dhcp.option.padding": "00"
}
}
}
},
{
"_index": "packets-2004-12-05",
"_type": "pcap_file",
"_score": null,
"_source": {
"layers": {
"frame": {
"frame.encap_type": "1",
"frame.time": "Dec 5, 2004 19:16:24.387798000 UTC",
"frame.offset_shift": "0.000000000",
"frame.time_epoch": "1102274184.387798000",
"frame.time_delta": "0.000314000",
"frame.time_delta_displayed": "0.000314000",
"frame.time_relative": "0.070345000",
"frame.number": "4",
"frame.len": "342",
"frame.cap_len": "342",
"frame.marked": "0",
"frame.ignored": "0",
"frame.protocols": "eth:ethertype:ip:udp:dhcp"
},
"eth": {
"eth.dst": "00:0b:82:01:fc:42",
"eth.dst_tree": {
"eth.dst_resolved": "Grandstr_01:fc:42",
"eth.addr": "00:0b:82:01:fc:42",
"eth.addr_resolved": "Grandstr_01:fc:42",
"eth.lg": "0",
"eth.ig": "0"
},
"eth.src": "00:08:74:ad:f1:9b",
"eth.src_tree": {
"eth.src_resolved": "Dell_ad:f1:9b",
"eth.addr": "00:08:74:ad:f1:9b",
"eth.addr_resolved": "Dell_ad:f1:9b",
"eth.lg": "0",
"eth.ig": "0"
},
"eth.type": "0x00000800"
},
"ip": {
"ip.version": "4",
"ip.hdr_len": "20",
"ip.dsfield": "0x00000000",
"ip.dsfield_tree": {
"ip.dsfield.dscp": "0",
"ip.dsfield.ecn": "0"
},
"ip.len": "328",
"ip.id": "0x00000446",
"ip.flags": "0x00000000",
"ip.flags_tree": {
"ip.flags.rb": "0",
"ip.flags.df": "0",
"ip.flags.mf": "0",
"ip.frag_offset": "0"
},
"ip.ttl": "128",
"ip.proto": "17",
"ip.checksum": "0x00000000",
"ip.checksum.status": "2",
"ip.src": "192.168.0.1",
"ip.addr": "192.168.0.1",
"ip.src_host": "192.168.0.1",
"ip.host": "192.168.0.1",
"ip.dst": "192.168.0.10",
"ip.addr": "192.168.0.10",
"ip.dst_host": "192.168.0.10",
"ip.host": "192.168.0.10"
},
"udp": {
"udp.srcport": "67",
"udp.dstport": "68",
"udp.port": "67",
"udp.port": "68",
"udp.length": "308",
"udp.checksum": "0x0000dfdb",
"udp.checksum.status": "2",
"udp.stream": "1",
"Timestamps": {
"udp.time_relative": "0.070050000",
"udp.time_delta": "0.070050000"
}
},
"dhcp": {
"dhcp.type": "2",
"dhcp.hw.type": "0x00000001",
"dhcp.hw.len": "6",
"dhcp.hops": "0",
"dhcp.id": "0x00003d1e",
"dhcp.secs": "0",
"dhcp.flags": "0x00000000",
"dhcp.flags_tree": {
"dhcp.flags.bc": "0",
"dhcp.flags.reserved": "0x00000000"
},
"dhcp.ip.client": "0.0.0.0",
"dhcp.ip.your": "192.168.0.10",
"dhcp.ip.server": "0.0.0.0",
"dhcp.ip.relay": "0.0.0.0",
"dhcp.hw.mac_addr": "00:0b:82:01:fc:42",
"dhcp.hw.addr_padding": "00:00:00:00:00:00:00:00:00:00",
"dhcp.server": "",
"dhcp.file": "",
"dhcp.cookie": "99.130.83.99",
"dhcp.option.type": "53",
"dhcp.option.type_tree": {
"dhcp.option.length": "1",
"dhcp.option.value": "05",
"dhcp.option.dhcp": "5"
},
"dhcp.option.type": "58",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "00:00:07:08",
"dhcp.option.renewal_time_value": "1800"
},
"dhcp.option.type": "59",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "00:00:0c:4e",
"dhcp.option.rebinding_time_value": "3150"
},
"dhcp.option.type": "51",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "00:00:0e:10",
"dhcp.option.ip_address_lease_time": "3600"
},
"dhcp.option.type": "54",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "c0:a8:00:01",
"dhcp.option.dhcp_server_id": "192.168.0.1"
},
"dhcp.option.type": "1",
"dhcp.option.type_tree": {
"dhcp.option.length": "4",
"dhcp.option.value": "ff:ff:ff:00",
"dhcp.option.subnet_mask": "255.255.255.0"
},
"dhcp.option.type": "0",
"dhcp.option.type_tree": {
"dhcp.option.end": "255"
},
"dhcp.option.padding": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"
}
}
}
}
]

3228
test/baseline/dhcp.jsonraw Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
# Wireshark tests
# By Gerald Combs <gerald@wireshark.org>
#
# Copyright (c) 2018 Dario Lombardo <lomato@gmail.com>
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
'''outputformats tests'''
import json
import os.path
import subprocesstest
import fixtures
from matchers import *
@fixtures.fixture
def check_outputformat(cmd_tshark, dirs, capture_file):
def check_outputformat_real(self, pcap_file, format_option, format_file, multiline=False):
self.maxDiff = 1000000
tshark_proc = self.assertRun((cmd_tshark, '-r', capture_file(pcap_file), '-T', format_option,))
expected = open(os.path.join(dirs.baseline_dir, format_file)).read()
actual = tshark_proc.stdout_str
if multiline:
expected = expected.splitlines()
actual = actual.splitlines()
self.assertEqual(len(expected), len(actual))
for line1, line2 in zip(expected, actual):
json.loads(line1)
json.loads(line2)
self.assertEqual(json.loads(line1), json.loads(line2))
else:
expected = json.loads(expected)
actual = json.loads(actual)
self.assertEqual(expected, actual)
return check_outputformat_real
@fixtures.mark_usefixtures('base_env')
@fixtures.uses_fixtures
class case_outputformats(subprocesstest.SubprocessTestCase):
def test_outputformat_json(self, check_outputformat):
'''Decode some captures into json'''
check_outputformat(self, "dhcp.pcap", "json", "dhcp.json")
def test_outputformat_jsonraw(self, check_outputformat):
'''Decode some captures into jsonraw'''
check_outputformat(self, "dhcp.pcap", "jsonraw", "dhcp.jsonraw")
def test_outputformat_ek(self, check_outputformat):
'''Decode some captures into ek'''
check_outputformat(self, "dhcp.pcap", "ek", "dhcp.ek", True)