Last active
May 17, 2017 08:23
-
-
Save rexcze-zz/14d6e0bbba96eed388bc481903ac38c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This script needs to be run by root or with root privileges (which is far better) | |
#check distribution to use right tools | |
if [ -f /etc/redhat-release ]; then | |
PKG="rpm -qf" | |
else | |
PKG="dpkg -S" | |
fi | |
#get all running pids | |
PIDS=`ps aux|awk '{ print $2 }'` | |
#get all binary to pids | |
BINARY=`for PID in ${PIDS}; do lsof -p ${PID} 2>/dev/null |grep txt|awk '{ print $9 }' ; done|sort |uniq` | |
#List the bad guys | |
for BIN in ${BINARY} | |
do | |
${PKG} "${BIN}" &> /dev/null | |
if [[ $? -gt 0 ]] ;then | |
echo -e "\e[1m\e[31m[FALSE]\e[0m ${BIN}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment