3 ms·
This is great! For any SWEs that would be more comfortable in a Python REPL, you can do the same thing like this: import subprocess import json d
by gemstones 4y ago
This is great! For any SWEs that would be more comfortable in a Python REPL, you can do the same thing like this:
import subprocess
import json
def osquery(query):
return json.loads(subprocess.check_output(["osqueryi", "--json", query]))
#>>> osquery("select * from routes where destination = '::1'")
#>>> [{'destination': '::1', 'flags': '2098181', 'gateway': '::1', 'hopcount': '0', 'interface': 'lo0', 'metric': '0', 'mtu': '16384', 'netmask': '128', 'source': '', 'type': 'local'}]
I hadn't heard of osquery - thanks for pointing me to that!