Ads

Script defence and attack

#!/bin/sh
# script config Infondlinux
# distributed under New BSD Licence
# created by t0ka7a
# version 0.5
# 2011-04-10
# this script provides a post-installation on Ubuntu
# careful: the script closes current firefox instances.

# debian packages
# - imagemagick
# - vim
# - less
# - gimp
# - build-essential
# - wipe
# - xchat
# - pidgin
# - vlc
# - nautilus-open-terminal
# - nmap
# - zenmap
# - sun-java6-plugin et jre et jdk
# - bluefish
# - flash-plugin-nonfree
# - aircrack-ng
# - wireshark
# - ruby
# - ascii
# - webhttrack
# - socat
# - nasm
# - w3af
# - subversion
# - wireshark
# - mercurial
# - libopenssl-ruby
# - ruby-gnome2
# - traceroute
# - filezilla
# - gnupg
# - rubygems
# - php5
# - libapache2-mod-php5
# - mysql-server
# - php5-mysql
# - phpmyadmin
# - extract
# - p0f
# - spikeproxy
# - ettercap
# - dsniff :
#    * arpspoof - Send out unrequested (and possibly forged) arp replies.
#    * dnsspoof - forge replies to arbitrary DNS address / pointer queries on the Local Area Network.
#    * dsniff - password sniffer for several protocols.
#    * filesnarf - saves selected files sniffed from NFS traffic.
#    * macof - flood the local network with random MAC addresses.
#    * mailsnarf - sniffs mail on the LAN and stores it in mbox format.
#    * msgsnarf - record selected messages from different Instant Messengers.
#    * sshmitm - SSH monkey-in-the-middle. proxies and sniffs SSH traffic.
#    * sshow - SSH traffic analyser.
#    * tcpkill - kills specified in-progress TCP connections.
#    * tcpnice - slow down specified TCP connections via “active” traffic shaping.
#    * urlsnarf - output selected URLs sniffed from HTTP traffic in CLF.
#    * webmitm - HTTP / HTTPS monkey-in-the-middle. transparently proxies.
#    * webspy - sends URLs sniffed from a client to your local browser
# - unrar
# - torsocks
# - secure-delete
# - nautilus-gksu
# - sqlmap
# - john the ripper

# third party packages
# - tor
# - tor-geoipdb
# - virtualbox 4.0
# - google-chrome-stable

# manually downloaded softwares and version
# - DirBuster (1.0RC1)
# - truecrypt (7.0a)
# - metasploit framework (3.6)
# - webscarab (latest)
# - burp suite (1.3.03)
# - parosproxy (3.2.13)
# - jmeter (2.4)
# - rips (0.35)
# - origami-pdf (latest)
# - pdfid.py (0.0.11)
# - pdf-parser.pym (0.3.7)
# - fierce (latest)
# - wifite (latest)
# - pyloris (3.2)
# - skipfish (1.86 beta)
# - hydra (6.2)
# - Maltego (3.0)
# - set
# - volatilty (1.3 beta)

# home made scripts
# - hextoasm
# - md5crack.py (written by Corbiero)
# - chartoascii.py
# - asciitochar.py
# - rsa.py

# firefox extensions
# - livehttpheaders
# - firebug
# - tamperdata
# - noscript
# - flashblock
# - flashgot
# - foxyproxy
# - certificatepatrol
# - chickenfoot 1.0.7

######################################################
# trick to know: to share the current directory:
# $ sudo python -m SimpleHTTPServer 8080
######################################################


#####################################
# define extension directory for mozilla firefox
#####################################

mozillaApplicationId="$(ls /usr/share/mozilla/extensions)"
extensionDir="/usr/share/mozilla/extensions/$mozillaApplicationId"


#####################################
# function log()
#####################################
# write in /usr/share/Infond/log/install.log
# @param1: type '+' or 'E' or 'I'
# @param2: 'message'
log() (
  echo $1": $(date +%D' '%R':'%S) "$2 >> /usr/share/Infond/log/install.log
  echo $1": $(date +%D' '%R':'%S) "$2 > /dev/stdout
)

###########################
# function addBinEntry()
###########################
# adds a file .sh with the command line in the application directory
# adds a symbolic link in /usr/bin
# param1: name of the application
# param2: command line
# param3: term (default=NULL). To start the application in a new term
# ex: addBinEntry dirbuster "java -jar /usr/share/Infond/bin/DirBuster-1.0-RC1/DirBuster-1.0-RC1.jar" term
#     creates a file dirbuster.sh in /usr/share/Infond/bin
addBinEntry() (
  # exit if file already in /usr/bin
  if [ -z $(ls /usr/share/Infond/bin | grep $1.sh ) ]; then
    echo "#!/bin/sh" > /usr/share/Infond/bin/$1.sh
    echo "" >> /usr/share/Infond/bin/$1.sh
    echo "# $1.sh" >> /usr/share/Infond/bin/$1.sh
    echo "# generated by Infond post installation Infond" >> /usr/share/Infond/bin/$1.sh
    echo "# launcher to start $1 in a terminal" >> /usr/share/Infond/bin/$1.sh
    echo "# a symbolic link was created in /usr/bin" >> /usr/share/Infond/bin/$1.sh

    # run application from terminal if $4 set to 'term'
    if ( [ ! -z $3 ] && [ $3 = 'term' ] ); then
      echo "gnome-terminal --title=$1 --working-directory=\"/tmp\" --command=\"$2\"" >> /usr/share/Infond/bin/$1.sh
    else
      echo "$2" >> /usr/share/Infond/bin/$1.sh
    fi

    # log
    log "+" "$1.sh created in /usr/share/Infond/bin/."

    # make $1.sh executable
    chmod +x /usr/share/Infond/bin/$1.sh
    log "+" "$1.sh chmod +x"

  else
    log "I" "$1 already in /usr/share/Infond/bin. Not added."
  fi

  # create symbolic link in /usr/bin
  if [ -z $(ls /usr/bin | grep $1 ) ]; then
    ln -s /usr/share/Infond/bin/$1.sh /usr/bin/$1
    log "+" "symbolic link to $1.sh created in /usr/bin/."
  else
    log "I" "$1 already in /usr/bin. Not added." && return 1
  fi
)

#####################################
# function aptremove()
#####################################
# remove package using apt
aptremove() (
  # if package not installed
  [ -z "$(dpkg --list $1 | grep ii)" ] && log "I" "$1 not installed. can't be removed" && return 1
  # remove package
  apt-get --auto-remove -y --allow-unauthenticated remove $1
  # if package well removed
  [ -z "$(dpkg --list $1 | grep ii)" ] && log "+" "$1 removed"   
)

#####################################
# function aptinstall()
#####################################
# install package using apt
aptinstall() (
  # if package already installed
  [ ! -z "$(dpkg --list $1 | grep ii)" ] && log "I" "$1 already installed. can't be installed" && return 1
  # install package
  apt-get --auto-remove -y --allow-unauthenticated install $1
  # if package well installed
  [ ! -z "$(dpkg --list $1 | grep ii)" ] && log "+" "$1 installed"
)

#################################
# function firefoxadd()
#################################
# download firefox extension .xpi into ~/.mozilla/firefox/*.default/extensions/
# it is possible to install extension into /usr/lib/firefox-addons/extensions
# firefox will install it at next start
# @param1: name of the extension
# @param2: number of extension on addons.mozilla.org
firefoxadd() (
  if [ -z "$(ls -R $extensionDir | grep $1)" ]; then
    # download
   # log
   log "+" "$1 firefox extension installed."
  else
   log "I" "$1 firefox extension already installed. .xpi not downloaded."
  fi
)

###########################
# function downloadicon()
###########################
# download picture and create icon
# @param1: name for the icon
# @param2: downloading address
# ex: downloadicon msf http://metasploit.com/icon.jpg
downloadicon() (
  if [ -z "$(ls /usr/share/Infond/pictures | grep $1.png )" ]; then
    wget $2 -P /tmp
    convert -size 48x48 /tmp/$(echo $2|awk -F/ '{print $NF}') -resize 48x48 -extent 48x48 +profile '*' /usr/share/Infond/pictures/$1.png
    log "+" "$1 icon downloaded"
    rm /tmp/$(echo $2|awk -F/ '{print $NF}')
  else
    log "I" "$1 icon already exists. Not downloaded."
  fi
)

###########################
# function addmenu()
###########################
# add an entry to gnome menu
# @param1: name
# @param2: comment
# @param3: command line
# @param4: terminal (true or false)
# @param5: categorie
addmenu() (
  if [ -z "$(ls /usr/share/applications | grep $1.desktop)" ];then
    echo "
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=$1
Comment=$2
Icon=/usr/share/Infond/pictures/$1.png
Exec=$3
Terminal=$4
Categories=$5
" > /usr/share/applications/$1.desktop
    log "+" "$1.desktop created"
  else
    log "I" "$1.desktop already exists. Not updated."
  fi
)


###########################
# function addcategory()
###########################
# add a category to .desktop file
# @param1: name
# @param2: category
addcategory() (
  if [ -z "$(cat /usr/share/applications/$1.desktop | grep Categories | grep $2)"]; then
    # replace all Categories entries by $2. Ex: Categories=Network;GTK => Categories=Transport;
    sed -i "s/Categories.*/Categories=$2;/" /usr/share/applications/$1.desktop
    # add $2 to Categories entries. Ex: Categories=Network;GTK => Categories=Network;GTK;Transport;
    #[ -z $(cat /usr/share/applications/$1.desktop | grep $2) ] && sed -i "/Categories/s|$|;$2;|" /usr/share/applications/$1.desktop
    log "+" "$2 put in Categories in $1.desktop"
  else
    log "I" "$2 already in Categories in $1.desktop"
  fi
)

###########################
# function adddirectory()
###########################
# add a directory entry in /usr/share/desktop-directories
# this directory entry will be used in /etc/xdg/menus/applications.menu
# it needs an icon. You can use downloadicon function
# @param: name for the directory entry

adddirectory() (
if [ -z "$(ls /usr/share/desktop-directories | grep $1.directory)" ]; then
  echo "[Desktop Entry]
Name=$1
Comment=$1 tools
Icon=/usr/share/Infond/pictures/$1.png
Type=Directory
Categories=$1
" > /usr/share/desktop-directories/$1.directory
  log "+" "$1.directory written"
else
  log "I" "$1.directory already exists. Not updated."
fi
)

#####################################
# installation start
#####################################
# test sudo
[ $(id -u) -ne "0" ] && echo "You must be sudo to use this script." && exit 1

# mode verbose
#set -v
1>/dev/null
2>/dev/null

# catch CTRL-C
trap "echo ''; echo CTR-C was pressed. Exit; log 'E' 'CTRL-C pressed.; exit 1" 2

# create install directory
if [ -z "$(ls /usr/share | grep Infond)" ]; then
  mkdir /usr/share/Infond
  mkdir /usr/share/Infond/bin
  mkdir /usr/share/Infond/pictures
  mkdir /usr/share/Infond/log
fi

# create log file if not already created
echo "****************" >> /usr/share/Infond/log/install.log
log "+" "install begin"
echo "****************" >> /usr/share/Infond/log/install.log

##############################
# 1st start
###############################

# if dist-upgrade not done yet
if [ -z "$(cat /usr/share/Infond/log/install.log | grep dist-upgrade )" ]; then

  # dist-upgrade
  apt-get --auto-remove -y --allow-unauthenticated dist-upgrade

  # update log
  log "+" "dist-upgrade"

  # reboot
  echo "System will reboot. Please restart script after reboot"
  read pause

  # reboot
  log "I" "reboot"
  reboot
fi


#################################
# further installs
#################################

# close firefox (necessary to install firefox extensions)
[ ! -z $(pidof firefox-bin) ] && kill -9 $(pidof firefox-bin)

#################################
# apt
#################################

# add Commercial repository
if [ -z "$(cat /etc/apt/sources.list | grep Commercial)" ]; then
  echo "" >> /etc/apt/sources.list
  echo "## Commercial" >> /etc/apt/sources.list
  echo "deb http://archive.canonical.com/ubuntu $(lsb_release -sc) partner " >> /etc/apt/sources.list
  log "+" "repository Commercial added to apt sources list"
else
  log "I" "repository Commercial already in apt sources list. Not added"
fi

# add torproject repository
if [ -z "$(cat /etc/apt/sources.list | grep torproject)" ]; then
  echo "" >> /etc/apt/sources.list
  echo "## tor" >> /etc/apt/sources.list
  echo "deb http://deb.torproject.org/torproject.org $(lsb_release -sc) main" >> /etc/apt/sources.list
  gpg --keyserver keys.gnupg.net --recv 886DDD89
  gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
  log "+" "repository torproject added to apt sources list"
else
  log "I" "repository torproject already in apt sources list. Not added"
fi

# add non-free repository to apt
if [ -z "$(cat /etc/apt/sources.list | grep virtualbox)" ]; then
  echo "" >> /etc/apt/sources.list
  echo "## virtualbox" >> /etc/apt/sources.list
  echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list
  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 98AB5139  
  log "+" "virtualbox added to apt sources list"
else
  log "I" "virtualbox already in apt sources list. Not added"
fi

# add google repository
if [ -z "$(cat /etc/apt/sources.list | grep google)" ]; then
  echo "" >> /etc/apt/sources.list
  echo "## google" >> /etc/apt/sources.list
  echo "deb http://dl.google.com/linux/deb/ stable main" >> /etc/apt/sources.list
  wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
  log "+" "google added to apt sources list"
else
  log "I" "google already in apt sources list. Not added"
fi


# update
apt-get update > /dev/null
log "+" "apt-get update"
apt-get upgrade -y
log "+" "apt-get upgrade"

# apt remove useless packages
aptremove gwibber
aptremove empathy
aptremove gbrainy
aptremove f-spot
aptremove evolution
aptremove quadrapassel
aptremove totem

# apt install
aptinstall imagemagick
aptinstall vim
aptinstall less
aptinstall build-essential
aptinstall gimp
aptinstall tor
aptinstall tor-geoipdb
aptinstall vlc
aptinstall nautilus-open-terminal
aptinstall sun-java6-plugin
aptinstall sun-java6-jdk
aptinstall flashplugin-nonfree
aptinstall bluefish
aptinstall xchat
aptinstall pidgin
aptinstall ruby
aptinstall nasm
aptinstall subversion
aptinstall traceroute
aptinstall filezilla
aptinstall gnupg
aptinstall unrar
aptinstall secure-delete
aptinstall nautilus-gksu

# add category to .desktop
addcategory bluefish Accessories
addcategory xchat Accessories
addcategory pidgin Accessories

##################################
# menu GNOME
##################################

# see $ gnome-help , (search for keyword ".desktop")

# add pictures (if not already in directory)

# add directory entries in /usr/share/Infond/desktop-directories
adddirectory Infond
adddirectory Pentest
adddirectory Forensics
adddirectory pdf
adddirectory Transport
adddirectory Ddos

# modify /etc/xdg/menus/applications.menu
# the directory /etc/xdg is in $XDG_CONFIG_DIRS (see $ gnome-help)
if [ -z "$( cat /etc/xdg/menus/applications.menu | grep Infond.directory )" ]; then
  sed -i '/<!-- Accessories submenu -->/i\
  \
  <!-- Infond submenu -->\
  <Menu>\
    <Name>Infond</Name>\
    <Directory>Infond.directory</Directory>\
    <Menu>\
      <Name>Ddos</Name>\
      <Directory>Ddos.directory</Directory>\
      <Include>\
        <And>\
          <Category>Ddos</Category>\
        </And>\
      </Include>\
    </Menu>\
    <Menu>\
      <Name>Pentest</Name>\
      <Directory>Pentest.directory</Directory>\
      <Include>\
        <And>\
          <Category>Pentest</Category>\
        </And>\
      </Include>\
      <Menu>\
        <Name>Transport</Name>\
        <Directory>Transport.directory</Directory>\
        <Include>\
          <And>\
            <Category>Transport</Category>\
          </And>\
        </Include>\
      </Menu>\
    </Menu>\
    <Menu>\
      <Name>Forensics</Name>\
      <Directory>Forensics.directory</Directory>\
       <Menu>\
          <Name>pdf</Name>\
          <Directory>pdf.directory</Directory>\
          <Include>\
            <And>\
              <Category>pdf</Category>\
            </And>\
          </Include>\
       </Menu>\
       <Include>\
        <And>\
          <Category>Forensics</Category>\
        </And>\
      </Include>\
    </Menu>\
    <Menu>\
      <Name>Accessories</Name>\
      <Directory>Utility.directory</Directory>\
      <Include>\
        <And><Category>Accessories</Category></And>\
      </Include>\
    </Menu>\
  </Menu>\
  ' /etc/xdg/menus/applications.menu
  log "+" "applications.menu modified"
else
  log "I" "applications.menu already correct. Not modified."
fi

##################################
# google-chrome
##################################

# download and install
aptinstall google-chrome-stable


#################################
# sqlmap
#################################

aptinstall sqlmap


addmenu sqlmap "sqlmap is an open source penetration testing tool that automates the process of detecting and exploiting SQL injection flaws and taking over of back-end database servers." "bash -c 'cd /tmp;sqlmap -h;bash'" "true" "Pentest"

##################################
# spikeproxy
##################################

aptinstall spikeproxy


addmenu spikeproxy "web application auditing tool." "bash -c 'gnome-terminal -e \"sudo spikeproxy\";google-chrome --proxy-server=localhost:8080 http://spike'" "false" "Pentest"

##################################
# torsocks
##################################

aptinstall torsocks


addmenu usewithtor "Torsocks allows you to use most socks-friendly applications in a safe way with Tor." "bash -c 'cd /tmp;echo usewithtor [application [application arguments]];usewithtor -h;bash'" "true" Transport

##################################
# ettercap
##################################

aptinstall ettercap-gtk
addcategory ettercap Transport


##################################
# nmap
##################################

# apt install
aptinstall nmap

# download icon

# add entry in Gnome menu
addmenu nmap "Nmap (\"Network Mapper\") is a free and open source utility for network exploration or security auditing." "bash -c 'cd /tmp;nmap -h;nmap -V;bash'" "true" Transport


##################################
# zenmap
##################################

aptinstall zenmap
downloadicon zenmap http://www.ansi.tn/gfx/nmap.png
rm /usr/share/applications/zenmap-root.desktop
rm /usr/share/applications/zenmap.desktop
addmenu zenmap "Nmap (\"Network Mapper\") is a free and open source utility for network exploration or security auditing." "bash -c 'cd /tmp;gnome-terminal -e \"sudo zenmap\"'" "false" Transport

##################################
# dsniff
##################################

#    * arpspoof - Send out unrequested (and possibly forged) arp replies.
#    * dnsspoof - forge replies to arbitrary DNS address / pointer queries on the Local Area Network.
#    * dsniff - password sniffer for several protocols.
#    * filesnarf - saves selected files sniffed from NFS traffic.
#    * macof - flood the local network with random MAC addresses.
#    * mailsnarf - sniffs mail on the LAN and stores it in mbox format.
#    * msgsnarf - record selected messages from different Instant Messengers.
#    * sshmitm - SSH monkey-in-the-middle. proxies and sniffs SSH traffic.
#    * sshow - SSH traffic analyser.
#    * tcpkill - kills specified in-progress TCP connections.
#    * tcpnice - slow down specified TCP connections via “active” traffic shaping.
#    * urlsnarf - output selected URLs sniffed from HTTP traffic in CLF.
#    * webmitm - HTTP / HTTPS monkey-in-the-middle. transparently proxies.
#    * webspy - sends URLs sniffed from a client to your local browser

aptinstall dsniff

addmenu arpspoof "intercept packets on a switched LAN." "bash -c 'cd /tmp;arpspoof;bash'" "true" Transport
addmenu dnsspoof "forge replies to DNS address / pointer queries." "bash -c 'cd /tmp;dnsspoof -h;bash'" "true" Transport
addmenu dsniff "password sniffer." "bash -c 'cd /tmp;dsniff -h;bash'" "true" Transport
addmenu filesnarf "sniff files from NFS traffic." "bash -c 'cd /tmp;filesnarf -h;bash'" "true" Transport
addmenu macof "flood a switched LAN with random MAC addresses." "bash -c 'cd /tmp;macof -h;bash'" "true" "Ddos"
addmenu mailsnarf "sniff mail messages in Berkeley mbox format." "bash -c 'cd /tmp;mailsnarf -h;bash'" "true" Transport
addmenu msgsnarf "sniff chat messages." "bash -c 'cd /tmp;msgsnarf -h;bash'" "true" Transport
addmenu sshmitm "SSH monkey-in-the-middle." "bash -c 'cd /tmp;sshmitm -h;bash'" "true" Transport
addmenu sshmitm "SSH traffic analysis tool." "bash -c 'cd /tmp;sshow -h;bash'" "true" Transport
addmenu tcpkill "kill TCP connections on a LAN." "bash -c 'cd /tmp;tcpkill -h;bash'" "true" "Ddos"
addmenu tcpnice "slow down TCP connections on a LAN." "bash -c 'cd /tmp;tcpnice -h;bash'" "true" "Ddos"
addmenu urlsnarf "sniff HTTP requests in Common Log Format." "bash -c 'cd /tmp;urlsnarf -h;bash'" "true" Transport
addmenu webmitm "HTTP / HTTPS monkey-in-the-middle." "bash -c 'cd /tmp;webmitm -h;bash'" "true" Transport
addmenu webspy "display sniffed URLs in Netscape in real-time." "bash -c 'cd /tmp;webspy -h;bash'" "true" Transport


##################################
# skipfish
##################################

aptinstall skipfish


addmenu skipfish "A fully automated, active web application security reconnaissance tool." "bash -c 'cd /tmp; skipfish -h;bash'" "true" "Pentest"

##################################
# maltego
##################################

aptinstall gdebi
gdebi -n /tmp/Maltego*
log "+" "maltego installed"


##################################
# set
##################################

if [ -z "$(ls /usr/share/Infond/bin | grep set)" ]; then
  svn co http://svn.secmaniac.com/social_engineering_toolkit /usr/share/Infond/bin/set
  python /usr/share/Infond/bin/set/setup.py install
  log "+" "set installed"
else
  log "I" "set already in /usr/share/Infond/bin. Not downloaded."
fi


addBinEntry 'set' "sudo bash /usr/share/Infond/bin/set/set"

addmenu 'set' "The social engineer toolkit." 'set' "true" "Pentest"


##################################
# volatility
##################################

if [ -z "$(ls /usr/local/bin | grep Volatility)" ]; then
  tar xzf /tmp/Volatility-1.3_Beta.tar.gz -C /usr/share/Infond/bin
  log "+" "volatility downloaded"
else
  log "I" "volatility already in /usr/share/Infond/bin. Not downloaded."
fi


addBinEntry volatility "python /usr/share/Infond/bin/Volatility*/volatility \$*"

addmenu volatility "The Volatility Framework is a completely open collection of tools for the extraction of digital artifacts from volatile memory (RAM) samples." "bash -c 'cd /tmp; volatility ;bash'" "true" "Forensics"


##################################
# hydra
##################################

aptinstall libssh-dev
aptinstall libpq-dev
aptinstall libncp-dev

if [ -z "$(ls /usr/local/bin | grep hydra)" ]; then
  tar xzf /tmp/hydra* -C /tmp
  bash -c 'cd /tmp/hydra-6.2-src; ./configure; make; make install'
  rm /tmp/hydra*
  log "+" "hydra compiled and installed"
else
  log "I" "hydra already in /usr/share/Infond/bin. Not downloaded."
fi


addmenu hydra "A very fast network logon cracker which support many different services." "bash -c 'cd /tmp; hydra ;bash'" "true" "Pentest"


##################################
# pyLoris 3.2
##################################

if [ -z "$(ls /usr/share/Infond/bin | grep pyloris)" ]; then
  tar xzf /tmp/pyloris-3.2.tgz -C /usr/share/Infond/bin
  rm /tmp/pyloris*
  log "+" "pyloris downloaded"
else
  log "I" "pyloris already in /usr/share/Infond/bin. Not downloaded."
fi


addBinEntry pyloris "python /usr/share/Infond/bin/pyloris-3.2/pyloris.py"

addmenu pyloris "PyLoris is a scriptable tool for testing a web server's vulnerability to Denial of Service (DoS) attacks which supports SOCKS, SSL, and all HTTP request methods." pyloris "true" "Ddos"


##################################
# extract
##################################

aptinstall extract
addmenu extract "determine meta-information about a file/" "bash -c 'cd /tmp;extract -h;echo ex: $ extract test/test.jpg;bash'" "true" "Forensics"


##################################
# w3af
##################################

# apt install
aptinstall w3af

# add entry in Gnome menu
addcategory w3af Pentest

##################################
# wireshark
##################################

# apt install
aptinstall wireshark

# add entry in Gnome menu
addcategory wireshark Pentest


##################################
# md5crack.py - written by Corbiero
##################################

echo '
import urllib, re , sys

# tool written by Corbiero
# 2010

# md5crack.com
params = urllib.urlencode({"term": sys.argv[1]})
print "Try to crack "+ sys.argv[1] +" on md5crack.com"
f = urllib.urlopen("http://md5crack.com/crackmd5.php", params)
y = f.read()
if re.match("(.*)Found: (.*)</div>\\n(.*)",y,re.DOTALL):
    print re.match("(.*)Found: (.*)</div>\\n(.*)",y,re.DOTALL).group(2)

# passcracking.com
params = urllib.urlencode({"datafromuser": sys.argv[1]})
print "Try to crack "+ sys.argv[1] +" on passcracking.com"
f = urllib.urlopen("http://passcracking.ru/index.php", params)
y = f.read()
if re.match("(.*)<td>md5 Database</td><td>(.*)</td><td bgcolor=#FF0000>(.*)</td><td>",y,re.DOTALL):
    print "Password: " + re.match("(.*)<td>md5 Database</td><td>(.*)</td><td bgcolor=#FF0000>(.*)</td><td>",y,re.DOTALL).group(3)

# md5.my-addr.com
params = urllib.urlencode({"md5": sys.argv[1]})
print "Try to crack "+ sys.argv[1] +" on md5.my-addr.com"
y = f.read()
if re.match("(.*)Hashed string</span>: (.*)</div>\\n<br>(.*)",y,re.DOTALL):
    print "Password: " + re.match("(.*)Hashed string</span>: (.*)</div>\\n<br>(.*)",y,re.DOTALL).group(2)
' > /usr/share/Infond/bin/md5crack.py

addBinEntry md5crack "python /usr/share/Infond/bin/md5crack.py \$1"


addmenu md5crack "md5crack is a tool written in Python by Corbiero. It sends a request to different websites which provide plain text given a md5 hash." "bash -c 'cd /tmp;echo example: $ md5crack 286755fad04869ca523320acce0dc6a4;bash;'" "true" "Accessories"

##################################
# chartoascii.py - written by Corbiero
##################################

echo "
import sys
# script to encode a string in ascii
output = '0x'
for c in sys.argv[1]:
    output += str(hex(ord(c))[2:])
print output
" > /usr/share/Infond/bin/chartoascii.py

addBinEntry chartoascii "python /usr/share/Infond/bin/chartoascii.py \$1"


addmenu chartoascii "script to encode a string in ascii." "bash -c 'cd /tmp;echo example: $ chartoascii mystring;bash;'" "true" "Accessories"

##################################
# asciitochar.py
##################################

echo "
import sys
# usage:
# asciitochar.py 0x6262626262
h = sys.argv[1][2:]
result = ''
for i in range(0,len(h),2):
    c = ''+h[i]+h[i+1]
    result += chr(int(''+h[i]+h[i+1],16))
print result
" > /usr/share/Infond/bin/asciitochar.py

addBinEntry asciitochar "python /usr/share/Infond/bin/asciitochar.py \$1"


addmenu asciitochar "script to encode a string in ascii." "bash -c 'cd /tmp;echo example: $ asciitochar 0x64636263;bash;'" "true" "Accessories"


##################################
# hextoasm
##################################
# script to print asm instructions from a hex string
echo 'usage() (
  echo "********************************************************"
  echo "* script adapted from a tip by ivanlef0u               *"
  echo "* written by t0ka7a for Infondlinux                    *"
  echo "* http://Infond.blogspot.com                           *"
  echo "*                                                      *"
  echo "* prints asm instructions from an hex strings          *"
  echo "*                                                      *"
  echo "* ex:                                                  *"
  echo "* $ hextoasm "\x90\x31\x90\x90\xea\x42\x42\x42"        *"
  echo "* 00000000  90                nop                      *"
  echo "* 00000001  319090EA4242      xor \eax+0x4242ea90],edx *"
  echo "* 00000007  42                inc edx                  *"
  echo "********************************************************"
  echo
)

# help
[ $1 = "-h" ] && usage && exit 0

# test nb of arguments
[ $# != 1 ] && echo one argument needed && exit -1

# test nasm installed
[ -z "$(dpkg --list nasm | grep ii)" ] && echo "please install nasm:  apt-get install nasm" && exit -1

python -c "print \"$1\"" | tr -d "\r\n" | ndisasm -u -
' > /usr/share/Infond/bin/hextoasm
chmod +x /usr/share/Infond/bin/hextoasm
ln -s /usr/share/Infond/bin/hextoasm /usr/bin/hextoasm

# download icon

# add entry in Gnome menu for hextoasm
addmenu hextoasm "prints asm instructions from an hex strings ." "bash -c 'cd /tmp;hextoasm -h;bash'" "true" "Accessories"

##################################
# rsa.py
##################################


echo "#!/usr/local/bin/python
from sys import*;from string import*;a=argv;[s,p,q]=filter(lambda x:x[:1]!=
'-',a);d='-d'in a;e,n=atol(p,16),atol(q,16);l=(len(q)+1)/2;o,inb=l-d,l-1+d
while s:s=stdin.read(inb);s and map(stdout.write,map(lambda i,b=pow(reduce(
lambda x,y:(x<<8L)+y,map(ord,s)),e,n):chr(b>>8*i&255),range(o-1,-1,-1)))
" > /usr/share/Infond/bin/rsa.py

# add bin entry
addBinEntry rsa.py "python /usr/share/Infond/bin/rsa.py \$1 \$2 \$3"

# download icon

# add entry in Gnome menu
addmenu rsa.py "encrypt:   echo  Top secret message. | rsa.py 10001 1967cb529 >ciphertext     decrypt:   cat ciphertext | rsa.py -d ac363601 1967cb529" "bash -c 'cd /tmp;echo \"encrypt:   echo  Top secret message. | rsa.py 10001 1967cb529 >ciphertext     decrypt:   cat ciphertext | rsa.py -d ac363601 1967cb529\";bash;'" "true" "Accessories"


##################################
# origami-pdf
##################################
aptinstall mercurial
aptinstall libopenssl-ruby
aptinstall ruby-gnome2
if [ -z "$(ls /usr/share/Infond/bin | grep origami-pdf)" ]; then
  hg clone https://origami-pdf.googlecode.com/hg/ /usr/share/Infond/bin/origami-pdf
  cp -r /usr/share/Infond/bin/origami-pdf/origami* /usr/lib/ruby/1.8
  chown -R root: /usr/lib/ruby/1.8/origami
  log "+" "origami-pdf installed"
else
  log "I" "origami-pdf already in /usr/share/Infond/bin. Not downloaded."
fi


addmenu origami "ruby framework for pdf generation" "bash -c 'cd /tmp;cat /usr/share/Infond/bin/origami-pdf/README;echo samples available in /usr/share/Infond/bin/origami-pdf/samples;bash'" "true" pdf


##################################
# dirBuster                      #
##################################

# install
if [ -z "$(ls /usr/share/Infond/bin | grep DirBuster)" ]; then
  tar xjvf /tmp/DirBuster* -C /usr/share/Infond/bin
  rm -r /tmp/DirBuster*
  log "+" "dirbuster downloaded"
else
  log "I" "dirbuster already in /usr/share/Infond/bin. Not downloaded."
fi

# download icon

# create dirbuster.sh and add dirbuster.sh shortcut in /usr/bin
addBinEntry dirbuster "java -jar /usr/share/Infond/bin/DirBuster-0.12/DirBuster-0.12.jar"

# add entry in Gnome menu for DirBuster
addmenu dirbuster "DirBuster is a multi threaded java application designed to brute force directories and files names on web/application servers. Often is the case now of what looks like a web server #in a state of default installation is actually not, and has pages and applications hidden within. DirBuster attempts to find these." dirbuster "false" "Pentest"


##################################
# bboxkeys
##################################

if [ -z "$(ls /usr/share/Infond/bin | grep bboxkeys)" ]; then
  chmod +x /usr/share/Infond/bin/bboxkeys
fi

addBinEntry bboxkeys /usr/share/Infond/bin/bboxkeys
addmenu bboxkeys "Bouygues Telecom Bbox default WPA key Generator" "bash -c 'cd /tmp;bboxkeys;bash;'" "true" "Accessories"

##################################
# burp suite 1.3.03
##################################

# install
if [ -z "$(ls /usr/share/Infond/bin | grep burp)" ]; then
  rm -r /tmp/burp*
  unzip /tmp/burp* -d /tmp
  rm /tmp/burp*.zip
  mkdir /usr/share/Infond/bin/burp
  mv /tmp/burp*/* /usr/share/Infond/bin/burp/
  log "+" "burp downloaded"
else
  log "I" "burp already in /usr/share/Infond/bin. Not downloaded."
fi

# download icon

# create burp.sh and add burp.sh shortcut in /usr/bin
addBinEntry burp "java -jar /usr/share/Infond/bin/burp/burp*.jar"

# add entry in Gnome menu
addmenu burp "Burp Suite is free to use for personal and commercial purposes." burp "false" "Pentest"

##################################
# fierce
##################################

if [ -z "$(ls /usr/share/Infond/bin | grep fierce2)" ]; then
  perl -MCPAN -e 'install Net::DNS'
  perl -MCPAN -e 'install Net::hostent'
  svn co https://svn.assembla.com/svn/fierce/fierce2/trunk/ /usr/share/Infond/bin/fierce2/
  chmod +x /usr/share/Infond/bin/fierce2/install.sh
  /usr/share/Infond/bin/fierce2/install.sh
  log "+" "fierce2 installed"
else
  log "I" "fierce2 already in /usr/share/Infond/bin. Not downloaded."
fi

addBinEntry fierce2 "bash -c 'cd /tmp;fierce;echo ex: $ fierce -dns monsite.com;bash'"

addmenu fierce2 "Fierce is a reconnaissance tool written in Perl that quickly scans domains (usually in just a few minutes, assuming no network lag) using a variety of techniques to locate undocumented, internal or just hard-to-find resources via the DNS system." fierce2 "true" "Pentest"


##################################
# wifite
##################################

if [ -z "$(ls /usr/share/Infond/bin | grep wifite)" ]; then
  aptinstall python-tk
  wget http://wifite.googlecode.com/svn/trunk/wifite.py -nc -P /usr/share/Infond/bin
  chmod +x /usr/share/Infond/bin/wifite.py
  log "+" "wifite downloaded"
else
  log "I" "wifite already in /usr/share/Infond/bin. Not downloaded."
fi


addBinEntry wifite "sudo python /usr/share/Infond/bin/wifite.py"

addmenu wifite "to attack multiple WEP and WPA encrypted networks at the same time. this tool is customizable to be automated with only a few arguments. can be trusted to run without supervision." wifite "true" "Transport"



##################################
# webscarab
##################################

# install
if [ -z "$(ls /usr/share/Infond/bin | grep webscarab)" ]; then
  rm -r /tmp/webscarab*
  unzip /tmp/webscarab-current.zip -d /tmp
  rm /tmp/webscarab-current.zip
  mv /tmp/webscarab* /usr/share/Infond/bin/webscarab/
  rm -r /tmp/webscarab*
  log "+" "webscarab downloaded"
else
  log "I" "webscarab already in /usr/share/Infond/bin. Not downloaded."
fi

# download icon

# create webscarab.sh and add webscarab.sh shortcut in /usr/bin
addBinEntry webscarab "java -jar /usr/share/Infond/bin/webscarab/webscarab.jar"

# add entry in Gnome menu
addmenu webscarab "WebScarab is a framework for analysing applications that communicate using the HTTP and HTTPS protocols." webscarab "false" "Pentest"

##################################
# pdfid.py
##################################

#install
if [ -z "$(ls /usr/share/Infond/bin | grep pdfid)" ]; then
  rm -r /tmp/pdfid*
  unzip /tmp/pdfid_v0_0_11.zip -d /tmp
  rm /tmp/pdfid_v0_0_11.zip
  mv /tmp/pdfid.py /usr/share/Infond/bin/
  ln -s /usr/share/Infond/bin/pdfid.py /usr/bin/pdfid
  log "+" "pdfid downloaded"
else
  log "I" "pdfid already in /usr/share/Infond/bin. Not downloaded."
fi

# download icon

# add to menu
addmenu pdfid "tool for pdf analysis" "bash -c 'cd /tmp;echo example: $ pdfid mypdf.pdf;bash'" "true" pdf

##################################
# pdf-parser.py
##################################

#install
if [ -z "$(ls /usr/share/Infond/bin | grep pdf-parser)" ]; then
  rm -r /tmp/pdf-parser*
  unzip /tmp/pdf-parser_V0_3_7.zip -d /tmp
  rm /tmp/pdf-parser_V0_3_7.zip
  mv /tmp/pdf-parser.py /usr/share/Infond/bin/
  echo "please open a terminal and edit /usr/share/Infond/bin/pdf-parser.py ."
  echo "Then, correct the __maximum_python_version__  to current"
  echo "please press ENTER when done"
  read pause
  ln -s /usr/share/Infond/bin/pdf-parser.py /usr/bin/pdf-parser
  log "+" "pdf-parser downloaded"
else
  log "I" "pdf-parser already in /usr/share/Infond/bin. Not downloaded."
fi

# download icon

# add to menu
addmenu pdf-parser "tool for pdf analysis" "bash -c 'cd /tmp;pdf-parser;bash;'" "true" pdf


##################################
# jmeter 2.4
##################################

# install
if [ -z "$(ls /usr/share/Infond/bin | grep jmeter)" ]; then
  rm -r /tmp/jmeter*
  tar xzf /tmp/jakarta-jmeter-2.4.tgz -C /tmp
  rm /tmp/*jmeter*.tgz
  mkdir /usr/share/Infond/bin/jmeter
  mv /tmp/*jmeter* /usr/share/Infond/bin/jmeter/
  log "+" "jmeter downloaded"
else
  log "I" "jmeter already in /usr/share/Infond/bin. Not downloaded."
fi

# download icon

# create jmeter.sh and add jmeter.sh shortcut in /usr/bin
addBinEntry jmeter "java -jar /usr/share/Infond/bin/jmeter/jakarta-jmeter-2.4/bin/ApacheJMeter.jar"

# add entry in Gnome menu
addmenu jmeter "Apache JMeter may be used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. You can use it to make a graphical analysis of performance or to test your server/script/object behavior under heavy concurrent load." jmeter "false" "Pentest"

##################################
# apache2, php, mysql, phpmyadmin
##################################

# install apache and configure for local use only
aptinstall apache2
echo Listen 127.0.0.1:80 > /etc/apache2/ports.conf
echo Listen 127.0.0.1:443 >> /etc/apache2/ports.conf

# php, mysql and phpmyadmin
aptinstall php5
aptinstall libapache2-mod-php5
aptinstall mysql-server
aptinstall php5-mysql
aptinstall phpmyadmin

# ssl
a2enmod ssl
make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/ssl/private/localhost.pem
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
sed -i '1,2s/\*:80/*:443/' /etc/apache2/sites-available/ssl
sed -i "3a\\\tSSLEngine On\n\tSSLCertificateFile /etc/ssl/private/localhost.pem" /etc/apache2/sites-available/ssl
a2ensite ssl

# restart apache
/etc/init.d/apache2 restart


##################################
# rips-scanner 0.35
##################################

# needs apache and php

# install
if [ -z "$(ls /var/www | grep rips)" ]; then
  rm -r /tmp/rips*
  mkdir /var/www/rips
  unzip /tmp/rips-0.35.zip -d /var/www/rips
  chown -R www-data: /var/www/rips
  chmod 440 -R /var/www/rips
  chmod -R ug+X /var/www/rips
  /etc/init.d/apache2 restart
  rm /tmp/rips*
  log "+" "rips downloaded"
else
  log "I" "rips already in /var/www. Not downloaded."
fi

# download icon

# create rips.sh and add rips.sh shortcut in /usr/bin
addBinEntry rips "google-chrome http://127.0.0.1/rips"

# add entry in Gnome menu
addmenu rips "RIPS is a static source code analyser for vulnerabilities in PHP webapplications." rips "false" "Pentest"


##################################
# rubygems
##################################

aptinstall rubygems
export PATH=/var/lib/gems/1.8/bin:$PATH


##################################
# truecrypt-7.0a-linux-x86
##################################

#install
if [ -z "$(ls /usr/share/Infond/bin | grep truecrypt)"  ];then
  log "+" "truecrypt-7.0 downloaded"
  tar xzf /tmp/truecrypt-7.0a-linux-x86.tar.gz -C /usr/share/Infond/bin/
  rm /tmp/truecrypt-7.0a-linux-x86.tar.gz
  /usr/share/Infond/bin/truecrypt-7.0a-setup-x86
  log "+" "truecrypt-7.0a installed"
else
  log "I" "truecrypt-7.0a already downloaded. Not updated."
fi

# add category to gnome menu
addcategory truecrypt Accessories


##################################
# virtualbox
##################################

# apt install
aptinstall virtualbox-4.0

# add virtualbox to gnome Infond menu
addcategory virtualbox Accessories


##################################
# - paros 3.2.13
##################################

# install
if [ -z "$(ls /usr/share/Infond/bin | grep paros)" ]; then
  rm -r /tmp/paros*
  unzip /tmp/paros*.zip -d /tmp
  rm /tmp/paros*.zip
  mv /tmp/paros* /usr/share/Infond/bin/paros/
  log "+" "paros downloaded"
else
  log "I" "paros already in /usr/share/Infond/bin. Not downloaded."
fi

# download icon

# create paros.sh and paros.sh shortcut in /usr/bin
addBinEntry paros "cd /usr/share/Infond/bin/paros;java -jar paros.jar"

# add entry in Gnome menu
addmenu paros "A Java based HTTP/HTTPS proxy for assessing web application vulnerability. It supports editing/viewing HTTP messages on-the-fly. Other featuers include spiders, client certificate, proxy-chaining, intelligent scanning for XSS and SQL injections etc. " paros "false" "Pentest"


##################################
# - metasploit framework
##################################

# install
if [ -z "$(ls /usr/share/Infond/bin | grep framework)"  ];then
  log "+" "metasploit framework downloaded"
  chmod +x /tmp/framework*
  /tmp/framework*
  log "+" "metasploit framework installed"
else
  log "I" "metasploit framework already downloaded. Not updated."
fi

# download icon

# add msfconsole entry in Gnome menu
addmenu msfconsole "The Metasploit Framework is both a penetration testing system and a development platform for creating security tools and exploits." "bash -c 'echo msfconsole;msfconsole -v;msfconsole'" "true" "Pentest"

###########################
# wipe
###########################

# apt install
aptinstall wipe

# download icon

# add entry in Gnome menu
addmenu wipe "securely erase files from magnetic media." "bash -c 'cd /tmp;wipe -h;bash'" "true" "Accessories"

###########################
# p0f (passive footprinting tool)
###########################

# apt install
aptinstall p0f

# download icon

# add entry in Gnome menu
addmenu p0f "identify remote systems passively." "bash -c 'cd /tmp;p0f -h;bash'" "true" "Pentest"


###########################
# socat
###########################

# apt install
aptinstall socat

# download icon

# add entry in Gnome menu
addmenu socat "Multipurpose relay (SOcket CAT)." "bash -c 'cd /tmp;socat -h;echo ex: socat tcp4-listen:2121,reuseaddr,fork tcp-connect:www.google.com:80;bash'" "true" "Accessories"

###########################
# ascii
###########################

# apt install
aptinstall ascii

# download icon

# add entry in Gnome menu
addmenu ascii "table ascii." "bash -c 'ascii -h;bash'" "true" "Accessories"


###########################
# john the ripper
###########################

aptinstall john
addmenu john "John the Ripper password cracker." "bash -c 'cd /tmp;john;bash'" "true" "Accessories"


###########################
# aircrack-ng
###########################

# apt install
aptinstall aircrack-ng

# download icon

# add entry in Gnome menu
addmenu aircrack "Aircrack-ng is an 802.11 WEP and WPA-PSK keys cracking program that can recover keys once enough data packets have been captured. It implements the standard FMS attack along with some optimizations like KoreK attacks, as well as the all-new PTW attack, thus making the attack much faster compared to other WEP cracking tools. In fact, Aircrack-ng is a set of tools for auditing wireless networks." "bash -c 'cd /tmp;aircrack-ng --help;bash'" "true" Transport

###########################
# webhttrack
###########################

# apt install
aptinstall webhttrack

# download icon

# add entry in Gnome menu
addmenu webhttrack "webhttrack - offline browser : copy websites to a local directory." "bash -c 'cd /tmp;webhttrack -h;bash'" "true" "Accessories"


###########################
# firefox extensions
###########################

# download and install firefox extensions
firefoxadd firebug 1843
firefoxadd livehttpheaders 3829
firefoxadd noscript 722
firefoxadd flashblock 433
firefoxadd flashgot 220
firefoxadd foxyproxy 2464
firefoxadd certificatepatrol 6415
# installation of useragentswitcher does not work. why????
# must be manually installed
#firefoxadd useragentswitcher 59

# tamper_data-11.0.1-fx
# does not use "latest" address in mozilla repo.
# We must download specific version.
if [ -z "$(ls -R $extensionDir | grep tamperdata)" ]; then
  # download
  # log
  log "+" "tamper_data firefox extension installed."
else
 log "I" "tamper_data already installed. .xpi not downloaded."
fi

# chickenfoot 1.0.7
if [ -z "$(ls -R $extensionDir | grep chickenfoot)" ]; then  
  log "+" "chickenfoot firefox extension installed."
else
 log "I" "chickenfoot already installed. .xpi not downloaded."
fi

###########################
# conclusion
###########################

# install extensions
firefox -silent -offline

# chmod every other files in Infond
id=$(ls /home)
chown $id:$id /usr/share/Infond -R
chmod -R 744 /usr/share/Infond

# EOF

Post a Comment

0 Comments