Skip to content

Instantly share code, notes, and snippets.

@muffins
Created March 23, 2023 21:45
Show Gist options
  • Save muffins/59810da3dfd1d246f02ff27f6afb19a9 to your computer and use it in GitHub Desktop.
Save muffins/59810da3dfd1d246f02ff27f6afb19a9 to your computer and use it in GitHub Desktop.
osquery listening processes function
function listening_processes() {
type osqueryi > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "[-] osqueryi not found on the system, install it."
return 1
fi
osqueryi "select p.pid, p.name, lp.port, lp.address from listening_ports lp join processes p on lp.pid = p.pid where lp.port <> 0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment