Skip to content

Instantly share code, notes, and snippets.

@noushi
Last active November 29, 2016 15:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noushi/f50468678a581023a8e2 to your computer and use it in GitHub Desktop.
Save noushi/f50468678a581023a8e2 to your computer and use it in GitHub Desktop.
GHOST check in
#!/bin/bash
check_ghost=https://gist.githubusercontent.com/noushi/f50468678a581023a8e2/raw/86f299e33958a13baaca7d2d2705184f973ea49a/check_ghost
for dock in `docker ps | awk '{print $2;}' | tail -n +2 ` ; do
echo -n -e "$dock\t=>\t" ; curl -s $check_ghost | docker run -i $dock bash
done
#!/bin/bash
# This script checks for GHOST vulnerability in the system, using Python by default, or C otherwise.
# the output is either "vulnerable" or "not vulnerable"
has_python() {
[ -e "`which python >/dev/null`" ]
}
if has_python ; then
python -c 'import socket;y="0"*50000000;socket.gethostbyname(y); print "not vulnerable"' 2>/dev/null || echo "vulnerable"
else
wget -q https://webshare.uchicago.edu/orgs/ITServices/itsec/Downloads/GHOST.c
gcc GHOST.c -o GHOST >/dev/null
./GHOST
rm -f GHOST.c GHOST
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment