1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

fix transport protocol

This commit is contained in:
Kelly Brazil
2019-10-21 18:22:51 -07:00
parent 8e71b8e352
commit b5ea08e55b
4 changed files with 20 additions and 20 deletions

View File

@ -13,7 +13,7 @@ Examples:
$ netstat -p | jc --netstat -p
[
{
"session_protocol": "tcp",
"transport_protocol": "tcp",
"network_protocol": "ipv4",
"local_address": "localhost.localdo",
"local_port": "34480",
@ -26,7 +26,7 @@ $ netstat -p | jc --netstat -p
"send_q": 0
},
{
"session_protocol": "tcp",
"transport_protocol": "tcp",
"network_protocol": "ipv4",
"local_address": "localhost.localdo",
"local_port": "34478",
@ -43,7 +43,7 @@ $ netstat -p | jc --netstat -p
$ netstat -lpn | jc --netstat -p
[
{
"session_protocol": "tcp",
"transport_protocol": "tcp",
"network_protocol": "ipv4",
"local_address": "127.0.0.1",
"local_port": "42351",
@ -56,7 +56,7 @@ $ netstat -lpn | jc --netstat -p
"send_q": 0
},
{
"session_protocol": "tcp",
"transport_protocol": "tcp",
"network_protocol": "ipv4",
"local_address": "127.0.0.53",
"local_port": "53",
@ -69,7 +69,7 @@ $ netstat -lpn | jc --netstat -p
"send_q": 0
},
{
"session_protocol": "tcp",
"transport_protocol": "tcp",
"network_protocol": "ipv4",
"local_address": "0.0.0.0",
"local_port": "22",
@ -82,7 +82,7 @@ $ netstat -lpn | jc --netstat -p
"send_q": 0
},
{
"session_protocol": "tcp",
"transport_protocol": "tcp",
"network_protocol": "ipv6",
"local_address": "::",
"local_port": "22",
@ -95,7 +95,7 @@ $ netstat -lpn | jc --netstat -p
"send_q": 0
},
{
"session_protocol": "udp",
"transport_protocol": "udp",
"network_protocol": "ipv4",
"local_address": "127.0.0.53",
"local_port": "53",
@ -107,7 +107,7 @@ $ netstat -lpn | jc --netstat -p
"send_q": 0
},
{
"session_protocol": "udp",
"transport_protocol": "udp",
"network_protocol": "ipv4",
"local_address": "192.168.71.131",
"local_port": "68",
@ -129,7 +129,7 @@ def parse_line(entry):
output_line = {}
if entry.find('tcp') == 0:
output_line['session_protocol'] = 'tcp'
output_line['transport_protocol'] = 'tcp'
if entry.find('p6') == 2:
output_line['network_protocol'] = 'ipv6'
@ -138,7 +138,7 @@ def parse_line(entry):
output_line['network_protocol'] = 'ipv4'
elif entry.find('udp') == 0:
output_line['session_protocol'] = 'udp'
output_line['transport_protocol'] = 'udp'
if entry.find('p6') == 2:
output_line['network_protocol'] = 'ipv6'