mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
code cleanup
This commit is contained in:
@ -419,7 +419,6 @@ def parse_network(headers, entry):
|
|||||||
|
|
||||||
|
|
||||||
def parse_socket(header_text, headers, entry):
|
def parse_socket(header_text, headers, entry):
|
||||||
output_line = {}
|
|
||||||
# get the column # of first letter of "state"
|
# get the column # of first letter of "state"
|
||||||
state_col = header_text.find('state')
|
state_col = header_text.find('state')
|
||||||
# get the program name column area
|
# get the program name column area
|
||||||
@ -545,21 +544,17 @@ def parse(data, raw=False, quiet=False):
|
|||||||
network = False
|
network = False
|
||||||
socket = False
|
socket = False
|
||||||
bluetooth = False
|
bluetooth = False
|
||||||
headers = ''
|
headers = None
|
||||||
network_list = []
|
|
||||||
socket_list = []
|
|
||||||
|
|
||||||
for line in cleandata:
|
for line in cleandata:
|
||||||
|
|
||||||
if line.startswith('Active Internet'):
|
if line.startswith('Active Internet'):
|
||||||
network_list = []
|
|
||||||
network = True
|
network = True
|
||||||
socket = False
|
socket = False
|
||||||
bluetooth = False
|
bluetooth = False
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if line.startswith('Active UNIX'):
|
if line.startswith('Active UNIX'):
|
||||||
socket_list = []
|
|
||||||
network = False
|
network = False
|
||||||
socket = True
|
socket = True
|
||||||
bluetooth = False
|
bluetooth = False
|
||||||
@ -577,20 +572,17 @@ def parse(data, raw=False, quiet=False):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if network:
|
if network:
|
||||||
network_list.append(parse_network(headers, line))
|
raw_output.append(parse_network(headers, line))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if socket:
|
if socket:
|
||||||
socket_list.append(parse_socket(header_text, headers, line))
|
raw_output.append(parse_socket(header_text, headers, line))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if bluetooth:
|
if bluetooth:
|
||||||
# maybe implement later if requested
|
# not implemented
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for item in [network_list, socket_list]:
|
|
||||||
raw_output.extend(item)
|
|
||||||
|
|
||||||
raw_output = parse_post(raw_output)
|
raw_output = parse_post(raw_output)
|
||||||
|
|
||||||
if raw:
|
if raw:
|
||||||
|
@ -79,7 +79,6 @@ def parse(cleandata):
|
|||||||
active_kernel_event = False
|
active_kernel_event = False
|
||||||
active_kernel_control = False
|
active_kernel_control = False
|
||||||
socket = False
|
socket = False
|
||||||
headers = None
|
|
||||||
|
|
||||||
for line in cleandata:
|
for line in cleandata:
|
||||||
|
|
||||||
@ -93,7 +92,6 @@ def parse(cleandata):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if line.startswith('Active Multipath Internet connections'):
|
if line.startswith('Active Multipath Internet connections'):
|
||||||
# skip for now
|
|
||||||
network = False
|
network = False
|
||||||
multipath = True
|
multipath = True
|
||||||
socket = False
|
socket = False
|
||||||
@ -170,7 +168,7 @@ def parse(cleandata):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if multipath:
|
if multipath:
|
||||||
# skip for now
|
# not implemented
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if socket:
|
if socket:
|
||||||
|
Reference in New Issue
Block a user