Skip to content

Instantly share code, notes, and snippets.

@colejhudson
Last active February 13, 2019 19:02
Show Gist options
  • Select an option

  • Save colejhudson/4c1678a4af883fa6f2f00bf7b8d2810a to your computer and use it in GitHub Desktop.

Select an option

Save colejhudson/4c1678a4af883fa6f2f00bf7b8d2810a to your computer and use it in GitHub Desktop.
function nameof -a pid
pidof | grep $pid | awk '{ print $3 }'
end
set n 0
function find-leaks
sudo echo (printf "%*s" 4 "id")" | "(printf "%*s" 25 "name")" | "(printf "%*s" 10 "pid")" | "(printf "%*s" 5 "found leak?")
for pid in (ps aux | grep -v root | awk '{ print $2 }' | sed '1d;p' | head -n 100)
set name (nameof $pid)
set found_leak "no"
sudo leaks $pid >/dev/null 2>&1
if test $status -eq 1
sudo leaks $pid 2>/dev/null >> $name.log
set found_leak "yes"
end
echo (printf "%*s" 4 $n)" | "(printf "%*s" 25 $name)" | "(printf "%*s" 10 $pid)" | "(printf "%*s" 5 $found_leak)
set n (math $n + 1)
end
end
function current-pid
ps | grep -e (status filename) | grep -v grep | awk '{ print $1 }'
end
find-leaks > leaks.log 2>&1
# fish gimme-vulnerabilites.fish
# Ctrl+Z
# bg
# jo
# disown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment