#!/bin/bash # Install script for Nikto/how to install Nikto # This script is provided as is and the author does not accept any responsibility # It is generated for you convenience to install tools automatically # If you have comments or perhaps some suggestions you can contact me at # info (at) hacktoolrepository.com # (c) http://www.hacktoolrepostory.com # Script to automatically download and install Nikto # Must be run by user who can run 'make install'. # # # Will install the following in this script: # Libwhisker # OpenSSL # Net SSLeay # nmap # Nikto #XVER = version number of software package X #XFILE = The file to download and untar #XDIR = The Directory which comes from the untar (i.e. XFILE without extention) #XPATH = Download path #XINSTDIR = The directory where the software should be installed #========================================================================================= PATH86="http://www.hacktoolrepository.com/files/Libraries/Libwhisker/libwhisker2-2.5.tar.gz" FILE86="libwhisker2-2.5.tar.gz" DIR86="libwhisker2-2.5" PROG86="libwhisker" PATH68="http://www.hacktoolrepository.com/files/Libraries/OpenSSL/openssl-1.0.0a.tar.gz" FILE68="openssl-1.0.0a.tar.gz" DIR68="openssl-1.0.0a" PROG68="openssl" PATH90="http://www.hacktoolrepository.com/files/Libraries/Net%20SSLeay/Net-SSLeay-1.32.tar.gz" FILE90="Net-SSLeay-1.32.tar.gz" DIR90="Net-SSLeay-1.32" PROG90="Net" PATH1="http://www.hacktoolrepository.com/files/Scanning/nmap/nmap-5.21.tar.bz2" FILE1="nmap-5.21.tar.bz2" DIR1="nmap-5.21" PROG1="nmap" PATH19="http://www.hacktoolrepository.com/files/Web%20applications/Nikto/nikto-2.1.2.tar.bz2" FILE19="nikto-2.1.2.tar.bz2" DIR19="nikto-2.1.2" PROG19="nikto" #The directory where the source can be downloaded and build SRCDIR='/usr/local/src/Nikto' #The directory where the software should be installed TRGDIR='/usr/local' REDOWNLOAD='no' #Remove downloaded files and download again #Variables will be discovered with which. Only change when prompted by the install script DOWNLOAD='' AWK='' SED='' #========================================================================================= # Don't change anything past here if [ -f /etc/redhat-release ]; then MANPATH='/usr/local/share/man' # for hping fi if [ -z "$1" ]; then echo usage $0 username echo username is the person you normally log on with that will configure and make the program exit fi #The download program to use (i.e. lwp-dowload or wget including full path and options) if [ -d ${DOWNLOAD} ]; then DOWNLOAD=`which wget` fi if [ -z ${DOWNLOAD} ]; then echo Could not find wget to download files. Please set the variable download at the top of the script. exit 3 else TEMPDOWN="${DOWNLOAD} -nc -t 2 --referer=http://www.hacktoolrepository.com/" DOWNLOAD=${TEMPDOWN} fi if [ -z ${SED} ]; then SED=`which sed` fi if [ -z ${SED} ]; then echo Could not find sed program. Please set variable sed at the top of the script. exit 4 fi if [ -z ${AWK} ]; then AWK=`which awk` fi if [ -z ${AWK} ]; then echo Could not find awk program. Please set variable AWK at the top of the script. exit 5 fi # Ran by superuser? eval `/usr/bin/id | ${SED} 's/[^a-z0-9=].*//'` if [ "${uid:=0}" -ne 0 ] then echo $0: You must be root to run $0 exit 2 fi SCRIPTPATH=`pwd` USER=$1 export SRCDIR TRGDIR USER DOWNLOAD SED AWK SCRIPTPATH REDOWNLOAD export PATH86 FILE86 DIR86 export PATH68 FILE68 DIR68 export PATH90 FILE90 DIR90 export PATH1 FILE1 DIR1 export PATH19 FILE19 DIR19 umask 022 mkdir -p ${SRCDIR} chown ${USER} ${SRCDIR} cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR86} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE86}" ]; then echo retrieving libwhisker2-2.5.tar.gz ${DOWNLOAD} "${PATH86}" fi; tar -xzvf "${FILE86}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR86}" make ' cd "${SRCDIR}/${DIR86}" make install cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR68} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE68}" ]; then echo retrieving openssl-1.0.0a.tar.gz ${DOWNLOAD} "${PATH68}" fi; tar -xzvf "${FILE68}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR68}" ./config --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR68}" make install echo "${TRGDIR}/lib" > /etc/ld.so.conf.d/openssl.conf && ldconfig cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR90} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE90}" ]; then echo retrieving Net-SSLeay-1.32.tar.gz ${DOWNLOAD} "${PATH90}" fi; tar -xzvf "${FILE90}" -C "${SRCDIR}" echo y > ${SRCDIR}/answer.txt cd "${SRCDIR}/${DIR90}" perl ./Makefile.PL < ${SRCDIR}/answer.txt make ' cd "${SRCDIR}/${DIR90}" make install cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR1} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE1}" ]; then echo retrieving nmap-5.21.tar.bz2 ${DOWNLOAD} "${PATH1}" fi; tar -xjvf "${FILE1}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR1}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR1}" make install cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR19} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE19}" ]; then echo retrieving nikto-2.1.2.tar.bz2 ${DOWNLOAD} "${PATH19}" fi; tar -xjvf "${FILE19}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR19}" ' cd "${SRCDIR}/${DIR19}" cd .. && cp -R ${DIR19}/* ${TRGDIR}/bin/ cd ${TRGDIR}/bin && ./nikto.pl -update echo '#########################################################' echo '# #' echo '# Done installing Nikto' echo '# #' echo '#########################################################' echo echo version info for Nikto ${TRGDIR}/bin/openssl version ${TRGDIR}/bin/nmap -V cd ${TRGDIR}/bin && ./nikto.pl