I want to fetch realtime information of my network as shown in image , my code is in python in that i import osquery model and when i change network that output also have to change
I reached hear only
import osquery
instance=osquery.SpawnInstance()
instance.open()
result=instance.client.query("SELECT (CASE family WHEN 2 THEN 'IP4' WHEN 10 THEN 'IP6' ELSE family END) AS family, (CASE protocol WHEN 6 THEN 'TCP' WHEN 17 THEN 'UDP' ELSE protocol END) AS protocol, local_address, local_port, remote_address, remote_port FROM process_open_sockets WHERE family IN (2, 10) AND protocol IN (6, 17)")
print(result.response[0])
can anyone help me??