#!/bin/bash # Install script for fragroute/how to install fragroute # 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 fragroute # Must be run by user who can run 'make install'. # # # Will install the following in this script: # libdnet # libevent # libpcap # fragroute #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 #========================================================================================= PATH47="http://www.hacktoolrepository.com/files/Libraries/libdnet/libdnet-1.11.tar.gz" FILE47="libdnet-1.11.tar.gz" DIR47="libdnet-1.11" PROG47="libdnet" PATH157="http://www.hacktoolrepository.com/files/Libraries/libevent/libevent-1.4.13-stable.tar.gz" FILE157="libevent-1.4.13-stable.tar.gz" DIR157="libevent-1.4.13-stable" PROG157="libevent" PATH4="http://www.hacktoolrepository.com/files/Libraries/libpcap/libpcap-1.1.1.tar.gz" FILE4="libpcap-1.1.1.tar.gz" DIR4="libpcap-1.1.1" PROG4="libpcap" PATH158="http://www.hacktoolrepository.com/files/Networking%20Tools/fragroute/fragroute-1.2.tar.gz" FILE158="fragroute-1.2.tar.gz" DIR158="fragroute-1.2" PROG158="fragroute" #The directory where the source can be downloaded and build SRCDIR='/usr/local/src/fragroute' #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 PATH47 FILE47 DIR47 export PATH157 FILE157 DIR157 export PATH4 FILE4 DIR4 export PATH158 FILE158 DIR158 umask 022 mkdir -p ${SRCDIR} chown ${USER} ${SRCDIR} cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR47} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE47}" ]; then echo retrieving libdnet-1.11.tar.gz ${DOWNLOAD} "${PATH47}" fi; tar -xzvf "${FILE47}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR47}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR47}" make install echo "${TRGDIR}/lib" > /etc/ld.so.conf.d/libdnet.conf && ldconfig && ln -s /usr/local/lib/libdnet.1 /usr/lib/ cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR157} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE157}" ]; then echo retrieving libevent-1.4.13-stable.tar.gz ${DOWNLOAD} "${PATH157}" fi; tar -xzvf "${FILE157}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR157}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR157}" make install cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR4} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE4}" ]; then echo retrieving libpcap-1.1.1.tar.gz ${DOWNLOAD} "${PATH4}" fi; tar -xzvf "${FILE4}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR4}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR4}" make install mkdir ${TRGDIR}/include/net && ln -sf ${TRGDIR}/include/pcap-bpf.h ${TRGDIR}/include/net/bpf.h && echo "${TRGDIR}/lib" > /etc/ld.so.conf.d/tcpdump.conf && ldconfig cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR158} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE158}" ]; then echo retrieving fragroute-1.2.tar.gz ${DOWNLOAD} "${PATH158}" fi; tar -xzvf "${FILE158}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR158}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR158}" make install echo '#########################################################' echo '# #' echo '# Done installing fragroute' echo '# #' echo '#########################################################' echo echo version info for fragroute ${TRGDIR/sbin/fragrouter