#!/bin/bash # Install script for Wireshark/how to install Wireshark # 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 Wireshark # Must be run by user who can run 'make install'. # # # Will install the following in this script: # ADNS # Libgpg-error # Libgcrypt # GnuTLS # libpcap # libsmi # LUA # Net-SNMP # PCRE # PortAudio # Wireshark #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 #========================================================================================= PATH98="http://www.hacktoolrepository.com/files/Libraries/ADNS/adns-1.4.tar.gz" FILE98="adns-1.4.tar.gz" DIR98="adns-1.4" PROG98="adns" PATH109="http://www.hacktoolrepository.com/files/Libraries/Libgpg-error/libgpg-error-1.9.tar.gz" FILE109="libgpg-error-1.9.tar.gz" DIR109="libgpg-error-1.9" PROG109="libgpg" PATH108="http://www.hacktoolrepository.com/files/Libraries/Libgcrypt/libgcrypt-1.4.6.tar.bz2" FILE108="libgcrypt-1.4.6.tar.bz2" DIR108="libgcrypt-1.4.6" PROG108="libgcrypt" PATH94="http://www.hacktoolrepository.com/files/Libraries/GnuTLS/gnutls-2.8.6.tar.bz2" FILE94="gnutls-2.8.6.tar.bz2" DIR94="gnutls-2.8.6" PROG94="gnutls" 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" PATH97="http://www.hacktoolrepository.com/files/Libraries/libsmi/libsmi-0.4.8.tar.gz" FILE97="libsmi-0.4.8.tar.gz" DIR97="libsmi-0.4.8" PROG97="libsmi" PATH99="http://www.hacktoolrepository.com/files/Libraries/LUA/lua-5.1.4.tar.gz" FILE99="lua-5.1.4.tar.gz" DIR99="lua-5.1.4" PROG99="lua" PATH95="http://www.hacktoolrepository.com/files/Libraries/Net-SNMP/net-snmp-5.5.tar.gz" FILE95="net-snmp-5.5.tar.gz" DIR95="net-snmp-5.5" PROG95="net" PATH77="http://www.hacktoolrepository.com/files/Libraries/PCRE/pcre-8.10.tar.bz2" FILE77="pcre-8.10.tar.bz2" DIR77="pcre-8.10" PROG77="pcre" PATH100="http://www.hacktoolrepository.com/files/Libraries/PortAudio/pa_stable_v19_20071207.tar.gz" FILE100="pa_stable_v19_20071207.tar.gz" DIR100="portaudio" PROG100="pa" PATH3="http://www.hacktoolrepository.com/files/Sniffer/Wireshark/wireshark-1.4.0.tar.bz2" FILE3="wireshark-1.4.0.tar.bz2" DIR3="wireshark-1.4.0" PROG3="wireshark" #The directory where the source can be downloaded and build SRCDIR='/usr/local/src/Wireshark' #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 PATH98 FILE98 DIR98 export PATH109 FILE109 DIR109 export PATH108 FILE108 DIR108 export PATH94 FILE94 DIR94 export PATH4 FILE4 DIR4 export PATH97 FILE97 DIR97 export PATH99 FILE99 DIR99 export PATH95 FILE95 DIR95 export PATH77 FILE77 DIR77 export PATH100 FILE100 DIR100 export PATH3 FILE3 DIR3 umask 022 mkdir -p ${SRCDIR} chown ${USER} ${SRCDIR} cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR98} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE98}" ]; then echo retrieving adns-1.4.tar.gz ${DOWNLOAD} "${PATH98}" fi; tar -xzvf "${FILE98}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR98}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR98}" make install echo ${TRGDIR}/lib > /etc/ld.so.conf.d/${DIR98}.conf cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR109} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE109}" ]; then echo retrieving libgpg-error-1.9.tar.gz ${DOWNLOAD} "${PATH109}" fi; tar -xzvf "${FILE109}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR109}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR109}" make install cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR108} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE108}" ]; then echo retrieving libgcrypt-1.4.6.tar.bz2 ${DOWNLOAD} "${PATH108}" fi; tar -xjvf "${FILE108}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR108}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR108}" make install cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR94} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE94}" ]; then echo retrieving gnutls-2.8.6.tar.bz2 ${DOWNLOAD} "${PATH94}" fi; tar -xjvf "${FILE94}" -C "${SRCDIR}" sed -i "s/#include /#include \"\.\.\/\.\.\/lib\/minitasn1\/libtasn1.h\"/" ${DIR94}/lib/gnutls_cert.h && sed -i "s/# include /#include \"\.\.\/\.\.\/lib\/minitasn1\/libtasn1.h\"/" ${DIR94}/lib/gnutls_mpi.h cd "${SRCDIR}/${DIR94}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR94}" make install echo ${TRGDIR}/lib > /etc/ld.so.conf.d/${PROG94}.conf 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}/${DIR97} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE97}" ]; then echo retrieving libsmi-0.4.8.tar.gz ${DOWNLOAD} "${PATH97}" fi; tar -xzvf "${FILE97}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR97}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR97}" make install echo ${TRGDIR}/lib > /etc/ld.so.conf.d/${DIR97}.conf cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR99} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE99}" ]; then echo retrieving lua-5.1.4.tar.gz ${DOWNLOAD} "${PATH99}" fi; tar -xzvf "${FILE99}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR99}" make linux ' cd "${SRCDIR}/${DIR99}" make install echo ${TRGDIR}/lib > /etc/ld.so.conf.d/${DIR99}.conf cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR95} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE95}" ]; then echo retrieving net-snmp-5.5.tar.gz ${DOWNLOAD} "${PATH95}" fi; tar -xzvf "${FILE95}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR95}" ./configure --with-defaults --without-rpm make ' cd "${SRCDIR}/${DIR95}" make install cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR77} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE77}" ]; then echo retrieving pcre-8.10.tar.bz2 ${DOWNLOAD} "${PATH77}" fi; tar -xjvf "${FILE77}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR77}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR77}" make install cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR100} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE100}" ]; then echo retrieving pa_stable_v19_20071207.tar.gz ${DOWNLOAD} "${PATH100}" fi; tar -xzvf "${FILE100}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR100}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR100}" make install echo ${TRGDIR}/lib > /etc/ld.so.conf.d/${DIR100}.conf && ldconfig cd ${SRCDIR} rm -fr ${SRCDIR}/${DIR3} su ${USER} -c ' cd ${SRCDIR} if [ ! -f "${FILE3}" ]; then echo retrieving wireshark-1.4.0.tar.bz2 ${DOWNLOAD} "${PATH3}" fi; tar -xjvf "${FILE3}" -C "${SRCDIR}" cd "${SRCDIR}/${DIR3}" ./configure --prefix=${TRGDIR} make ' cd "${SRCDIR}/${DIR3}" make install echo "${TRGDIR}/lib" > /etc/ld.so.conf.d/wireshark.conf && ldconfig && find ${TRGDIR}/lib/ -name 'libw*.so*' -exec chcon -t texrel_shlib_t {} \; && find ${TRGDIR}/lib/wireshark/plugins/1.0.5/ -name '*.so*' -exec chcon -t texrel_shlib_t {} \; echo '#########################################################' echo '# #' echo '# Done installing Wireshark' echo '# #' echo '#########################################################' echo echo version info for Wireshark "${TRGDIR}/bin/${PROG99}" -v ${TRGDIR}/bin/snmpwalk -V ${TRGDIR}/bin/pcretest -C "${TRGDIR}/bin/${PROG3}" -v