Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:07
Show Gist options
  • Save ZEROF/065b8708cbe3cd62d83d to your computer and use it in GitHub Desktop.
Save ZEROF/065b8708cbe3cd62d83d to your computer and use it in GitHub Desktop.
Node watch installation script
# This script will help you to set Nodewatch (
# Tested with Debian 7 32/64bit.
# Script 2nd hand author ZEROF <>
# Idea was born here
# If you like Linux and security join
# Script version 0.3b
# This script is distributed under a DO WHAT THE F*** YOU WANT TO PUBLIC LICENSE.
# If you are not root, find a place where you can be
# Check user
if [ $USER != 'root' ]; then
echo "[!]Are you root? NO. Then try again."
# Check path
print=$(printf '%s\n' "${PWD##*/}");
if [ $print != root ];then
echo "Wrong path, run this script from /root directory"
# Simple next/go function
function enter ()
echo ""
read -sn 1 -p "Press any key to continue..."
# Install Nodewatch
function installation ()
apt-get update
apt-get -y install patch zlib1g-dev libbz2-dev gcc openssl libssl-dev make re2c bison flex libltdl-dev libltdl7 libsslcommon2-dev libcurl4-openssl-dev libmcrypt-dev
rm -rf /root/nodewatch/build/*
rm -rf /nodewatch/php/*
mkdir -p /root/nodewatch/build
mkdir -p /nodewatch/php
cd /root/nodewatch/build
tar -zxf php-*
cd php-*
#Disable SSLv2
wget -O ssl.patch
patch -p1 < ssl.patch
./configure --silent --with-config-file-path=/nodewatch/php --prefix=/nodewatch/php --disable-all --enable-ipv6 --disable-json --enable-magic-quotes --without-sqlite --with-zlib --without-gd --without-ttf --disable-debug --disable-rpath --without-pear --without-pgsql --enable-mbstring --with-bz2 --without-iconv --without-gettext --without-curl --with-pcre-regex --with-openssl
make -j8 --silent
make install
rm -rf /root/nodewatch/build/*
cd /nodewatch/php
rm -f
cd /nodewatch/php
rm -f php.ini
wget -nv
echo '*/5 * * * * root /nodewatch/php/bin/php /nodewatch/scripts/nodewatch_cron5min.php' > /etc/cron.d/vpsantiabuse
rm -rf /root/nodewatch/jripper
mkdir -p /root/nodewatch/jripper
cd /root/nodewatch/jripper
tar -zxf john-*
cd john-*/src
make -j8 linux-x86-64i
cd ../run
mkdir -p /nodewatch/bin/john/
mv -f ./john /nodewatch/bin/john/
cd ..
wget -nv
mv -f ./password.lst /nodewatch/bin/john/
cd ~
rm -rf /root/nodewatch/jripper
cd /nodewatch/bin/john
rm -f john.conf
wget -nv
echo 'watch -n 1 cat /tmp/nodewatch_stats' > /
chmod 0700 /
mkdir -p /nodewatch/scripts
cd /nodewatch/scripts
rm -f
wget -nv
chmod 0700
echo **************************************************************
echo Installation complete. Updating nodewatch to latest version...
echo **************************************************************
sleep 2
# By default, Nodewatch gets the VPS infos from /etc/sysconfig/vz-scripts/, this directory is different on Debian (it’s /etc/vz/conf/ on debian).
# The solution: Create a symlink to link the vm configuration directory to /etc/sysconfig/vz-scripts/.
function symlink1 ()
mkdir /etc/sysconfig
ln -s /etc/vz/conf /etc/sysconfig/vz-scripts
# You have to do the same for the directory /vz/root. Nodewatch searches for server infos in this directory and it doesn’t exist,
# that’s why we you also have to create a symlink, pointing /var/lib/vz to /vz/root.
function symlink2 ()
ln -s /var/lib/vz /vz
# Set mail to get alerts
function mailos ()
cd /nodewatch/scripts
echo -e -n "Set your mail for Nodewatch alerts: "
read mailito
mail1="$admin_email = '';"
mail2="$admin_email = '$mailito';"
sed -i "21s|$mail1|$mail2|" nodewatch_config.php
# Set licence key from
function serialos ()
cd /nodewatch/scripts
echo -e -n "Put your Nodewatch licence key: "
read key
key1="$license_key = '';"
key2="$license_key = '$key';"
sed -i "24s|$key1|$key2|" nodewatch_config.php
# Remove Nodewatch
function remove () {
rm -f /etc/cron.d/vpsantiabuse
bash /nodewatch/scripts/
rm -rf /root/nodewatch
unlink /etc/sysconfig/vz-scripts
unlink /vz
rm -rf /etc/sysconfig
until [ "$selection" = "0" ]; do
echo ""
echo "Nodewatch Debian 7 installation"
echo ""
echo "1 - install Nodewatch"
echo "2 - create symlinks [!]"
echo "3 - set your email for Nodewatch alerts"
echo "4 - set your Nodewatch licence key"
echo "5 - restart Nodewatch"
echo "6 - remove Nodewatch"
echo ""
echo "0 - exit program"
echo ""
echo -n "Enter selection: "
read selection
echo ""
case $selection in
1 ) installation;enter ;;
2 ) symlink1;symlink2;enter ;;
3 ) mailos;enter ;;
4 ) serialos;enter ;;
5 ) bash /nodewatch/scripts/; enter ;;
6 ) remove;enter ;;
0 ) exit ;;
* ) echo "Please enter 1, 2, 3, 4, 5, 6 or 0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment