Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 168.07 KB | None | 0 0
  1. #!/bin/bash
  2. #-Metadata----------------------------------------------------#
  3. #  Filename: kali-rolling.sh             (Update: 2016-04-11) #
  4. #-Info--------------------------------------------------------#
  5. #  Personal post-install script for Kali Linux Rolling        #
  6. #-Author(s)---------------------------------------------------#
  7. #  g0tmilk ~ https://blog.g0tmi1k.com/                        #
  8. #-Operating System--------------------------------------------#
  9. #  Designed for: Kali Linux Rolling [x64] (VM - VMware)       #
  10. #     Tested on: Kali Linux 2016.1 x64/x84/full/light/mini/vm #
  11. #     Kali v1.x: https://g0tmi1k/os-scripts/master/kali1.sh   #
  12. #     Kali v2.x: https://g0tmi1k/os-scripts/master/kali2.sh   #
  13. #-Licence-----------------------------------------------------#
  14. #  MIT License ~ http://opensource.org/licenses/MIT           #
  15. #-Notes-------------------------------------------------------#
  16. #  Run as root straight after a clean install of Kali Rolling #
  17. #                             ---                             #
  18. #  You will need 25GB+ free HDD space before running.         #
  19. #                             ---                             #
  20. #  Command line arguments:                                    #
  21. #    -burp     = Automates configuring Burp Suite (Community) #
  22. #    -dns      = Use OpenDNS and locks permissions            #
  23. #    -openvas  = Installs & configures OpenVAS vuln scanner   #
  24. #    -osx      = Changes to Apple keyboard layout             #
  25. #                                                             #
  26. #    -keyboard <value> = Change the keyboard layout language  #
  27. #    -timezone <value> = Change the timezone location         #
  28. #                                                             #
  29. #  e.g. # bash kali-rolling.sh  -burp -openvas -keyboard gb   #
  30. #                             ---                             #
  31. #  Will cut it up (so modular based), when its in its repo    #
  32. #                             ---                             #
  33. #             ** This script is meant for _ME_. **            #
  34. #         ** EDIT this to meet _YOUR_ requirements! **        #
  35. #-------------------------------------------------------------#
  36.  
  37.  
  38. if [ 1 -eq 0 ]; then    # This is never true, thus it acts as block comments ;)
  39. ################################################################################
  40. ### One liner - Grab the latest version and execute! ###########################
  41. ################################################################################
  42. wget -qO kali-rolling.sh https://raw.github.com/g0tmi1k/os-scripts/master/kali-rolling.sh \
  43.   && bash kali-rolling.sh -burp -keyboard gb -timezone "Europe/London"
  44. ################################################################################
  45. fi
  46.  
  47.  
  48. #-Defaults-------------------------------------------------------------#
  49.  
  50.  
  51. ##### Location information
  52. keyboardApple=false         # Using a Apple/Macintosh keyboard (non VM)?                [ --osx ]
  53. keyboardLayout=""           # Set keyboard layout                                       [ --keyboard gb]
  54. timezone=""                 # Set timezone location                                     [ --timezone Europe/London ]
  55.  
  56. ##### Optional steps
  57. burpFree=false              # Disable configuring Burp Suite (for Burp Pro users...)    [ --burp ]
  58. hardenDNS=false             # Set static & lock DNS name server                         [ --dns ]
  59. openVAS=false               # Install & configure OpenVAS (not everyone wants it...)    [ --openvas ]
  60.  
  61. ##### (Optional) Enable debug mode?
  62. #set -x
  63.  
  64. ##### (Cosmetic) Colour output
  65. RED="\033[01;31m"      # Issues/Errors
  66. GREEN="\033[01;32m"    # Success
  67. YELLOW="\033[01;33m"   # Warnings/Information
  68. BLUE="\033[01;34m"     # Heading
  69. BOLD="\033[01;01m"     # Highlight
  70. RESET="\033[00m"       # Normal
  71.  
  72. STAGE=0                                                       # Where are we up to
  73. TOTAL=$(grep '(${STAGE}/${TOTAL})' $0 | wc -l);(( TOTAL-- ))  # How many things have we got todo
  74.  
  75.  
  76. #-Arguments------------------------------------------------------------#
  77.  
  78.  
  79. ##### Read command line arguments
  80. while [[ "${#}" -gt 0 && ."${1}" == .-* ]]; do
  81.   opt="${1}";
  82.   shift;
  83.   case "$(echo ${opt} | tr '[:upper:]' '[:lower:]')" in
  84.     -|-- ) break 2;;
  85.  
  86.     -osx|--osx )
  87.       keyboardApple=true;;
  88.     -apple|--apple )
  89.       keyboardApple=true;;
  90.  
  91.     -dns|--dns )
  92.       hardenDNS=true;;
  93.  
  94.     -openvas|--openvas )
  95.       openVAS=true;;
  96.  
  97.     -burp|--burp )
  98.       burpFree=true;;
  99.  
  100.     -keyboard|--keyboard )
  101.       keyboardLayout="${1}"; shift;;
  102.     -keyboard=*|--keyboard=* )
  103.       keyboardLayout="${opt#*=}";;
  104.  
  105.     -timezone|--timezone )
  106.       timezone="${1}"; shift;;
  107.     -timezone=*|--timezone=* )
  108.       timezone="${opt#*=}";;
  109.  
  110.     *) echo -e ' '${RED}'[!]'${RESET}" Unknown option: ${RED}${x}${RESET}" 1>&2 \
  111.       && exit 1;;
  112.    esac
  113. done
  114.  
  115.  
  116. ##### Check user inputs
  117. if [[ -n "${timezone}" && ! -f "/usr/share/zoneinfo/${timezone}" ]]; then
  118.   echo -e ' '${RED}'[!]'${RESET}" Looks like the ${RED}timezone '${timezone}'${RESET} is incorrect/not supported (Example: ${BOLD}Europe/London${RESET})" 1>&2
  119.   echo -e ' '${RED}'[!]'${RESET}" Quitting..." 1>&2
  120.   exit 1
  121. elif [[ -n "${keyboardLayout}" && -e /usr/share/X11/xkb/rules/xorg.lst ]]; then
  122.   if ! $(grep -q " ${keyboardLayout} " /usr/share/X11/xkb/rules/xorg.lst); then
  123.     echo -e ' '${RED}'[!]'${RESET}" Looks like the ${RED}keyboard layout '${keyboardLayout}'${RESET} is incorrect/not supported (Example: ${BOLD}gb${RESET})" 1>&2
  124.     echo -e ' '${RED}'[!]'${RESET}" Quitting..." 1>&2
  125.     exit 1
  126.   fi
  127. fi
  128.  
  129.  
  130. #-Start----------------------------------------------------------------#
  131.  
  132.  
  133. ##### Check if we are running as root - else this script will fail (hard!)
  134. if [[ "${EUID}" -ne 0 ]]; then
  135.   echo -e ' '${RED}'[!]'${RESET}" This script must be ${RED}run as root${RESET}" 1>&2
  136.   echo -e ' '${RED}'[!]'${RESET}" Quitting..." 1>&2
  137.   exit 1
  138. else
  139.   echo -e " ${BLUE}[*]${RESET} ${BOLD}Kali Linux rolling post-install script${RESET}"
  140.   sleep 3s
  141. fi
  142.  
  143. if [ "${burpFree}" != "true" ]; then
  144.   echo -e "\n\n ${YELLOW}[i]${RESET} ${YELLOW}Skipping Burp Suite${RESET} (missing: '$0 ${BOLD}--burp${RESET}')..." 1>&2
  145.   sleep 2s
  146. fi
  147.  
  148.  
  149. ##### Fix display output for GUI programs (when connecting via SSH)
  150. export DISPLAY=:0.0
  151. export TERM=xterm
  152.  
  153.  
  154. ##### Are we using GNOME?
  155. if [[ $(which gnome-shell) ]]; then
  156.   ##### RAM check
  157.   if [[ "$(free -m | grep -i Mem | awk '{print $2}')" < 2048 ]]; then
  158.     echo -e '\n '${RED}'[!]'${RESET}" ${RED}You have 2GB or less of RAM and using GNOME${RESET}" 1>&2
  159.     echo -e " ${YELLOW}[i]${RESET} ${YELLOW}Might want to use XFCE instead${RESET}..."
  160.     sleep 15s
  161.   fi
  162.  
  163.  
  164.   ##### Disable its auto notification package updater
  165.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Disabling GNOME's ${GREEN}notification package updater${RESET} service ~ in case it runs during this script"
  166.   export DISPLAY=:0.0
  167.   timeout 5 killall -w /usr/lib/apt/methods/http >/dev/null 2>&1
  168.  
  169.  
  170.   ##### Disable screensaver
  171.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Disabling ${GREEN}screensaver${RESET}"
  172.   xset s 0 0
  173.   xset s off
  174.   gsettings set org.gnome.desktop.session idle-delay 0
  175. else
  176.   echo -e "\n\n ${YELLOW}[i]${RESET} ${YELLOW}Skipping disabling package updater${RESET}..."
  177. fi
  178.  
  179.  
  180. ##### Check Internet access
  181. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Checking ${GREEN}Internet access${RESET}"
  182. #--- Can we ping google?
  183. for i in {1..10}; do ping -c 1 -W ${i} www.google.com &>/dev/null && break; done
  184. #--- Run this, if we can't
  185. if [[ "$?" -ne 0 ]]; then
  186.   echo -e ' '${RED}'[!]'${RESET}" ${RED}Possible DNS issues${RESET}(?)" 1>&2
  187.   echo -e ' '${RED}'[!]'${RESET}" Will try and use ${YELLOW}DHCP${RESET} to 'fix' the issue" 1>&2
  188.   chattr -i /etc/resolv.conf 2>/dev/null
  189.   dhclient -r
  190.   #--- Second interface causing issues?
  191.   ip addr show eth1 &>/dev/null
  192.   [[ "$?" == 0 ]] \
  193.     && route delete default gw 192.168.155.1 2>/dev/null
  194.   #--- Request a new IP
  195.   dhclient
  196.   dhclient eth0 2>/dev/null
  197.   dhclient wlan0 2>/dev/null
  198.   #--- Wait and see what happens
  199.   sleep 15s
  200.   _TMP="true"
  201.   _CMD="$(ping -c 1 8.8.8.8 &>/dev/null)"
  202.   if [[ "$?" -ne 0 && "$_TMP" == "true" ]]; then
  203.     _TMP="false"
  204.     echo -e ' '${RED}'[!]'${RESET}" ${RED}No Internet access${RESET}" 1>&2
  205.     echo -e ' '${RED}'[!]'${RESET}" You will need to manually fix the issue, before re-running this script" 1>&2
  206.   fi
  207.   _CMD="$(ping -c 1 www.google.com &>/dev/null)"
  208.   if [[ "$?" -ne 0 && "$_TMP" == "true" ]]; then
  209.     _TMP="false"
  210.     echo -e ' '${RED}'[!]'${RESET}" ${RED}Possible DNS issues${RESET}(?)" 1>&2
  211.     echo -e ' '${RED}'[!]'${RESET}" You will need to manually fix the issue, before re-running this script" 1>&2
  212.   fi
  213.   if [[ "$_TMP" == "false" ]]; then
  214.     (dmidecode | grep -iq virtual) && echo -e " ${YELLOW}[i]${RESET} VM Detected"
  215.     (dmidecode | grep -iq virtual) && echo -e " ${YELLOW}[i]${RESET} ${YELLOW}Try switching network adapter mode${RESET} (e.g. NAT/Bridged)"
  216.     echo -e ' '${RED}'[!]'${RESET}" Quitting..." 1>&2
  217.     exit 1
  218.   fi
  219. else
  220.   echo -e " ${YELLOW}[i]${RESET} ${YELLOW}Detected Internet access${RESET}" 1>&2
  221. fi
  222. #--- GitHub under DDoS?
  223. (( STAGE++ )); echo -e " ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Checking ${GREEN}GitHub status${RESET}"
  224. timeout 300 curl --progress -k -L -f "https://status.github.com/api/status.json" | grep -q "good" \
  225.   || (echo -e ' '${RED}'[!]'${RESET}" ${RED}GitHub is currently having issues${RESET}. ${BOLD}Lots may fail${RESET}. See: https://status.github.com/" 1>&2 \
  226.     && exit 1)
  227.  
  228.  
  229. ##### Enable default network repositories ~ http://docs.kali.org/general-use/kali-linux-sources-list-repositories
  230. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Enabling default Kali ${GREEN}network repositories${RESET}"
  231. #--- Add network repositories
  232. file=/etc/apt/sources.list; [ -e "${file}" ] && cp -n $file{,.bkup}
  233. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  234. #--- Main
  235. grep -q '^deb .* kali-rolling' "${file}" 2>/dev/null \
  236.   || echo -e "\n\n# Kali Rolling\ndeb http://http.kali.org/kali kali-rolling main contrib non-free" >> "${file}"
  237. #--- Source
  238. grep -q '^deb-src .* kali-rolling' "${file}" 2>/dev/null \
  239.   || echo -e "deb-src http://http.kali.org/kali kali-rolling main contrib non-free" >> "${file}"
  240. #--- Disable CD repositories
  241. sed -i '/kali/ s/^\( \|\t\|\)deb cdrom/#deb cdrom/g' "${file}"
  242. #--- incase we were interrupted
  243. dpkg --configure -a
  244. #--- Update
  245. apt -qq update
  246. if [[ "$?" -ne 0 ]]; then
  247.   echo -e ' '${RED}'[!]'${RESET}" There was an ${RED}issue accessing network repositories${RESET}" 1>&2
  248.   echo -e " ${YELLOW}[i]${RESET} Are the remote network repositories ${YELLOW}currently being sync'd${RESET}?"
  249.   echo -e " ${YELLOW}[i]${RESET} Here is ${BOLD}YOUR${RESET} local network ${BOLD}repository${RESET} information (Geo-IP based):\n"
  250.   curl -sI http://http.kali.org/README
  251.   exit 1
  252. fi
  253.  
  254.  
  255. ##### Check to see if Kali is in a VM. If so, install "Virtual Machine Addons/Tools" for a "better" virtual experiment
  256. if (dmidecode | grep -iq vmware); then
  257.   ##### Install virtual machines tools ~ http://docs.kali.org/general-use/install-vmware-tools-kali-guest
  258.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}VMware's virtual machine tools${RESET}"
  259.   apt -y -qq install open-vm-tools-desktop fuse \
  260.     || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  261.   apt -y -qq install make \
  262.     || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2    # nags afterwards
  263. elif (dmidecode | grep -iq virtualbox); then
  264.   ##### Installing Virtualbox Guest Additions.   Note: Need VirtualBox 4.2.xx+ for the host (http://docs.kali.org/general-use/kali-linux-virtual-box-guest)
  265.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}VirtualBox's guest additions${RESET}"
  266.   apt -y -qq install virtualbox-guest-x11 \
  267.     || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  268. fi
  269.  
  270.  
  271. ##### Check to see if there is a second Ethernet card (if so, set an static IP address)
  272. ip addr show eth1 &>/dev/null
  273. if [[ "$?" == 0 ]]; then
  274.   ##### Set a static IP address (192.168.155.175/24) on eth1
  275.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Setting a ${GREEN}static IP address${RESET} (${BOLD}192.168.155.175/24${RESET}) on ${BOLD}eth1${RESET}"
  276.   ip addr add 192.168.155.175/24 dev eth1 2>/dev/null
  277.   route delete default gw 192.168.155.1 2>/dev/null
  278.   file=/etc/network/interfaces.d/eth1.cfg; [ -e "${file}" ] && cp -n $file{,.bkup}
  279.   grep -q '^iface eth1 inet static' "${file}" 2>/dev/null \
  280.     || cat <<EOF > "${file}"
  281. auto eth1
  282. iface eth1 inet static
  283.     address 192.168.155.175
  284.     netmask 255.255.255.0
  285.     gateway 192.168.155.1
  286.     post-up route delete default gw 192.168.155.1
  287. EOF
  288. else
  289.   echo -e "\n\n ${YELLOW}[i]${RESET} ${YELLOW}Skipping eth1${RESET} (missing nic)..." 1>&2
  290. fi
  291.  
  292.  
  293. ##### Set static & protecting DNS name servers.   Note: May cause issues with forced values (e.g. captive portals etc)
  294. if [[ "${hardenDNS}" != "false" ]]; then
  295.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Setting static & protecting ${GREEN}DNS name servers${RESET}"
  296.   file=/etc/resolv.conf; [ -e "${file}" ] && cp -n $file{,.bkup}
  297.   chattr -i "${file}" 2>/dev/null
  298.   #--- Use OpenDNS DNS
  299.   #echo -e 'nameserver 208.67.222.222\nnameserver 208.67.220.220' > "${file}"
  300.   #--- Use Google DNS
  301.   echo -e 'nameserver 8.8.8.8\nnameserver 8.8.4.4' > "${file}"
  302.   #--- Protect it
  303.   chattr +i "${file}" 2>/dev/null
  304. else
  305.   echo -e "\n\n ${YELLOW}[i]${RESET} ${YELLOW}Skipping DNS${RESET} (missing: '$0 ${BOLD}--dns${RESET}')..." 1>&2
  306. fi
  307.  
  308.  
  309. ##### Update location information - set either value to "" to skip.
  310. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Updating ${GREEN}location information${RESET}"
  311. #--- Configure keyboard layout (Apple)
  312. if [ "${keyboardApple}" != "false" ]; then
  313.   ( (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Applying ${GREEN}Apple hardware${RESET} profile" )
  314.   file=/etc/default/keyboard; #[ -e "${file}" ] && cp -n $file{,.bkup}
  315.   sed -i 's/XKBVARIANT=".*"/XKBVARIANT="mac"/' "${file}"
  316. fi
  317. #--- Configure keyboard layout (location)
  318. if [[ -n "${keyboardLayout}" ]]; then
  319.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Updating ${GREEN}location information${RESET} ~ keyboard layout (${BOLD}${keyboardLayout}${RESET})"
  320.   geoip_keyboard=$(curl -s http://ifconfig.io/country_code | tr '[:upper:]' '[:lower:]')
  321.   [ "${geoip_keyboard}" != "${keyboardLayout}" ] \
  322.     && echo -e " ${YELLOW}[i]${RESET} Keyboard layout (${BOLD}${keyboardLayout}${RESET}) doesn't match what's been detected via GeoIP (${BOLD}${geoip_keyboard}${RESET})"
  323.   file=/etc/default/keyboard; #[ -e "${file}" ] && cp -n $file{,.bkup}
  324.   sed -i 's/XKBLAYOUT=".*"/XKBLAYOUT="'${keyboardLayout}'"/' "${file}"
  325. else
  326.   echo -e "\n\n ${YELLOW}[i]${RESET} ${YELLOW}Skipping keyboard layout${RESET} (missing: '$0 ${BOLD}--keyboard <value>${RESET}')..." 1>&2
  327. fi
  328. #--- Changing time zone
  329. if [[ -n "${timezone}" ]]; then
  330.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Updating ${GREEN}location information${RESET} ~ time zone (${BOLD}${timezone}${RESET})"
  331.   echo "${timezone}" > /etc/timezone
  332.   ln -sf "/usr/share/zoneinfo/$(cat /etc/timezone)" /etc/localtime
  333.   dpkg-reconfigure -f noninteractive tzdata
  334. else
  335.   echo -e "\n\n ${YELLOW}[i]${RESET} ${YELLOW}Skipping time zone${RESET} (missing: '$0 ${BOLD}--timezone <value>${RESET}')..." 1>&2
  336. fi
  337. #--- Installing ntp tools
  338. apt -y -qq install ntp ntpdate \
  339.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  340. #--- Update time
  341. ntpdate -b -s -u pool.ntp.org
  342. #--- Start service
  343. systemctl restart ntp
  344. #--- Remove from start up
  345. systemctl disable ntp 2>/dev/null
  346. #--- Only used for stats at the end
  347. start_time=$(date +%s)
  348.  
  349.  
  350. ##### Update OS from network repositories
  351. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) ${GREEN}Updating OS${RESET} from network repositories"
  352. echo -e " ${YELLOW}[i]${RESET}  ...this ${BOLD}may take a while${RESET} depending on your Internet connection & Kali version/age"
  353. for FILE in clean autoremove; do apt -y -qq "${FILE}"; done         # Clean up      clean remove autoremove autoclean
  354. export DEBIAN_FRONTEND=noninteractive
  355. apt -qq update && APT_LISTCHANGES_FRONTEND=none apt -o Dpkg::Options::="--force-confnew" -y dist-upgrade --fix-missing 2>&1 \
  356.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  357. #--- Cleaning up temp stuff
  358. for FILE in clean autoremove; do apt -y -qq "${FILE}"; done         # Clean up - clean remove autoremove autoclean
  359. #--- Check kernel stuff
  360. _TMP=$(dpkg -l | grep linux-image- | grep -vc meta)
  361. if [[ "${_TMP}" -gt 1 ]]; then
  362.   echo -e "\n ${YELLOW}[i]${RESET} Detected ${YELLOW}multiple kernels${RESET}"
  363.   TMP=$(dpkg -l | grep linux-image | grep -v meta | sort -t '.' -k 2 -g | tail -n 1 | grep "$(uname -r)")
  364.   if [[ -z "${TMP}" ]]; then
  365.     echo -e '\n '${RED}'[!]'${RESET}' You are '${RED}'not using the latest kernel'${RESET} 1>&2
  366.     echo -e " ${YELLOW}[i]${RESET} You have it ${YELLOW}downloaded${RESET} & installed, just ${YELLOW}not USING IT${RESET}"
  367.     #echo -e "\n ${YELLOW}[i]${RESET} You ${YELLOW}NEED to REBOOT${RESET}, before re-running this script"
  368.     #exit 1
  369.     sleep 30s
  370.   else
  371.     echo -e " ${YELLOW}[i]${RESET} ${YELLOW}You're using the latest kernel${RESET} (Good to continue)"
  372.   fi
  373. fi
  374.  
  375.  
  376. ##### Install kernel headers
  377. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}kernel headers${RESET}"
  378. apt -y -qq install make gcc "linux-headers-$(uname -r)" \
  379.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  380. if [[ $? -ne 0 ]]; then
  381.   echo -e ' '${RED}'[!]'${RESET}" There was an ${RED}issue installing kernel headers${RESET}" 1>&2
  382.   echo -e " ${YELLOW}[i]${RESET} Are you ${YELLOW}USING${RESET} the ${YELLOW}latest kernel${RESET}?"
  383.   echo -e " ${YELLOW}[i]${RESET} ${YELLOW}Reboot${RESET} your machine"
  384.   #exit 1
  385.   sleep 30s
  386. fi
  387.  
  388.  
  389. ##### Install "kali full" meta packages (default tool selection)
  390. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}kali-linux-full${RESET} meta-package"
  391. echo -e " ${YELLOW}[i]${RESET}  ...this ${BOLD}may take a while${RESET} depending on your Kali version (e.g. ARM, light, mini or docker...)"
  392. #--- Kali's default tools ~ https://www.kali.org/news/kali-linux-metapackages/
  393. apt -y -qq install kali-linux-full \
  394.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  395.  
  396.  
  397. ##### Set audio level
  398. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Setting ${GREEN}audio${RESET} levels"
  399. pactl set-sink-mute 0 0
  400. pactl set-sink-volume 0 25%
  401.  
  402.  
  403. ##### Configure GRUB
  404. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring ${GREEN}GRUB${RESET} ~ boot manager"
  405. grubTimeout=5
  406. (dmidecode | grep -iq virtual) && grubTimeout=1   # Much less if we are in a VM
  407. file=/etc/default/grub; [ -e "${file}" ] && cp -n $file{,.bkup}
  408. sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT='${grubTimeout}'/' "${file}"                           # Time out (lower if in a virtual machine, else possible dual booting)
  409. sed -i 's/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="vga=0x0318"/' "${file}"   # TTY resolution
  410. update-grub
  411.  
  412.  
  413. if [[ $(dmidecode | grep -i virtual) ]]; then
  414.   ###### Configure login screen
  415.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring ${GREEN}login screen${RESET}"
  416.   #--- Enable auto (gui) login
  417.   file=/etc/gdm3/daemon.conf; [ -e "${file}" ] && cp -n $file{,.bkup}
  418.   sed -i 's/^.*AutomaticLoginEnable = .*/AutomaticLoginEnable = true/' "${file}"
  419.   sed -i 's/^.*AutomaticLogin = .*/AutomaticLogin = root/' "${file}"
  420. fi
  421.  
  422.  
  423. if [[ $(which gnome-shell) ]]; then
  424.   ##### Configure GNOME 3
  425.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring ${GREEN}GNOME 3${RESET} ~ desktop environment"
  426.   export DISPLAY=:0.0
  427.   #-- Gnome Extension - Dash Dock (the toolbar with all the icons)
  428.   gsettings set org.gnome.shell.extensions.dash-to-dock extend-height true      # Set dock to use the full height
  429.   gsettings set org.gnome.shell.extensions.dash-to-dock dock-position 'RIGHT'   # Set dock to the right
  430.   gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed true         # Set dock to be always visible
  431.   gsettings set org.gnome.shell favorite-apps \
  432.     "['gnome-terminal.desktop', 'org.gnome.Nautilus.desktop', 'kali-wireshark.desktop', 'firefox-esr.desktop', 'kali-burpsuite.desktop', 'kali-msfconsole.desktop', 'gedit.desktop']"
  433.   #-- Gnome Extension - Alternate-tab (So it doesn't group the same windows up)
  434.   GNOME_EXTENSIONS=$(gsettings get org.gnome.shell enabled-extensions | sed 's_^.\(.*\).$_\1_')
  435.   echo "${GNOME_EXTENSIONS}" | grep -q "alternate-tab@gnome-shell-extensions.gcampax.github.com" \
  436.     || gsettings set org.gnome.shell enabled-extensions "[${GNOME_EXTENSIONS}, 'alternate-tab@gnome-shell-extensions.gcampax.github.com']"
  437.   #-- Gnome Extension - Drive Menu (Show USB devices in tray)
  438.   GNOME_EXTENSIONS=$(gsettings get org.gnome.shell enabled-extensions | sed 's_^.\(.*\).$_\1_')
  439.   echo "${GNOME_EXTENSIONS}" | grep -q "drive-menu@gnome-shell-extensions.gcampax.github.com" \
  440.     || gsettings set org.gnome.shell enabled-extensions "[${GNOME_EXTENSIONS}, 'drive-menu@gnome-shell-extensions.gcampax.github.com']"
  441.   #--- Workspaces
  442.   gsettings set org.gnome.shell.overrides dynamic-workspaces false                         # Static
  443.   gsettings set org.gnome.desktop.wm.preferences num-workspaces 3                          # Increase workspaces count to 3
  444.   #--- Top bar
  445.   gsettings set org.gnome.desktop.interface clock-show-date true                           # Show date next to time in the top tool bar
  446.   #--- Keyboard short-cuts
  447.   (dmidecode | grep -iq virtual) && gsettings set org.gnome.mutter overlay-key "Super_R"   # Change 'super' key to right side (rather than left key), if in a VM
  448.   #--- Hide desktop icon
  449.   dconf write /org/gnome/nautilus/desktop/computer-icon-visible false
  450. else
  451.   echo -e "\n\n ${YELLOW}[i]${RESET} ${YELLOW}Skipping GNOME${RESET}..." 1>&2
  452. fi
  453.  
  454. ##### Cosmetics (themes & wallpapers)
  455. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) ${GREEN}Cosmetics${RESET}${RESET} ~ Giving it a personal touch"
  456. export DISPLAY=:0.0
  457. #--- Get new desktop wallpaper      (All are #***!!! hardcoded paths!)
  458. mkdir -p /usr/share/wallpapers/
  459. echo -n '[1/10]'; timeout 300 curl --progress -k -L -f "https://www.kali.org/images/wallpapers-01/kali-wp-june-2014_1920x1080_A.png" > /usr/share/wallpapers/kali_blue_3d_a.png \
  460.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kali_blue_3d_a.png" 1>&2
  461. echo -n '[2/10]'; timeout 300 curl --progress -k -L -f "https://www.kali.org/images/wallpapers-01/kali-wp-june-2014_1920x1080_B.png" > /usr/share/wallpapers/kali_blue_3d_b.png \
  462.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kali_blue_3d_b.png" 1>&2
  463. echo -n '[3/10]'; timeout 300 curl --progress -k -L -f "https://www.kali.org/images/wallpapers-01/kali-wp-june-2014_1920x1080_G.png" > /usr/share/wallpapers/kali_black_honeycomb.png \
  464.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kali_black_honeycomb.png" 1>&2
  465. echo -n '[4/10]'; timeout 300 curl --progress -k -L -f "https://lh5.googleusercontent.com/-CW1-qRVBiqc/U7ARd2T9LCI/AAAAAAAAAGw/oantfR6owSg/w1920-h1080/vzex.png" > /usr/share/wallpapers/kali_blue_splat.png \
  466.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kali_blue_splat.png" 1>&2
  467. echo -n '[5/10]'; timeout 300 curl --progress -k -L -f "http://wallpaperstock.net/kali-linux_wallpapers_39530_1920x1080.jpg" > /usr/share/wallpapers/kali-linux_wallpapers_39530.png \
  468.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kali-linux_wallpapers_39530.png" 1>&2
  469. echo -n '[6/10]'; timeout 300 curl --progress -k -L -f "http://em3rgency.com/wp-content/uploads/2012/12/Kali-Linux-faded-no-Dragon-small-text.png" > /usr/share/wallpapers/kali_black_clean.png \
  470.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kali_black_clean.png" 1>&2
  471. echo -n '[7/10]'; timeout 300 curl --progress -k -L -f "http://www.hdwallpapers.im/download/kali_linux-wallpaper.jpg" > /usr/share/wallpapers/kali_black_stripes.jpg \
  472.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kali_black_stripes.jpg" 1>&2
  473. echo -n '[8/10]'; timeout 300 curl --progress -k -L -f "http://fc01.deviantart.net/fs71/f/2011/118/e/3/bt___edb_wallpaper_by_xxdigipxx-d3f4nxv.png" > /usr/share/wallpapers/kali_bt_edb.jpg \
  474.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kali_bt_edb.jpg" 1>&2
  475. echo -n '[9/10]'; timeout 300 curl --progress -k -L -f "http://pre07.deviantart.net/58d1/th/pre/i/2015/223/4/8/kali_2_0_alternate_wallpaper_by_xxdigipxx-d95800s.png" > /usr/share/wallpapers/kali_2_0_alternate_wallpaper.png \
  476.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kali_2_0_alternate_wallpaper.png" 1>&2
  477. echo -n '[10/10]'; timeout 300 curl --progress -k -L -f "http://pre01.deviantart.net/4210/th/pre/i/2015/195/3/d/kali_2_0__personal__wp_by_xxdigipxx-d91c8dq.png" > /usr/share/wallpapers/kali_2_0_personal.png \
  478.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kali_2_0_personal.png" 1>&2
  479. _TMP="$(find /usr/share/wallpapers/ -maxdepth 1 -type f -name 'kali_*' | xargs -n1 file | grep -i 'HTML\|empty' | cut -d ':' -f1)"
  480. for FILE in $(echo ${_TMP}); do rm -f "${FILE}"; done
  481. #--- Kali 1 (Wallpaper)
  482. [ -e "/usr/share/wallpapers/kali_default-1440x900.jpg" ] \
  483.   && ln -sf /usr/share/wallpapers/kali/contents/images/1440x900.png /usr/share/wallpapers/kali_default-1440x900.jpg
  484. #--- Kali 2 (Login)
  485. [ -e "/usr/share/gnome-shell/theme/KaliLogin.png" ] \
  486.   && cp -f /usr/share/gnome-shell/theme/KaliLogin.png /usr/share/wallpapers/KaliLogin2.0-login.jpg
  487. #--- Kali 2 & Rolling (Wallpaper)
  488. [ -e "/usr/share/images/desktop-base/kali-wallpaper_1920x1080.png" ] \
  489.   && ln -sf /usr/share/images/desktop-base/kali-wallpaper_1920x1080.png /usr/share/wallpapers/kali_default2.0-1920x1080.jpg
  490. #--- New wallpaper & add to startup (so its random each login)
  491. file=/usr/local/bin/rand-wallpaper; [ -e "${file}" ] && cp -n $file{,.bkup}
  492. touch $file
  493. cat <<EOF > "${file}" \
  494.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  495. #!/bin/bash
  496.  
  497. wallpaper="\$(shuf -n1 -e \$(find /usr/share/wallpapers/ -maxdepth 1 -name 'kali_*'))"
  498.  
  499. /usr/bin/xfconf-query -n -c xfce4-desktop -p /backdrop/screen0/monitor0/image-show -t bool -s true
  500. /usr/bin/xfconf-query -n -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -t string -s "\${wallpaper}"   # XFCE - Desktop wallpaper
  501.  
  502. #[[ $(which gnome-shell) ]] \
  503. #  && dconf write /org/gnome/desktop/background/picture-uri "'file://\${wallpaper}'"                              # GNOME - Desktop wallpaper
  504.  
  505. /usr/bin/dconf write /org/gnome/desktop/screensaver/picture-uri "'file://\${wallpaper}'"                          # Change lock wallpaper (before swipe) - kali 2 & rolling
  506. #cp -f "\${wallpaper}" /usr/share/gnome-shell/theme/KaliLogin.png                                                 # Change login wallpaper (after swipe) - kali 2
  507.  
  508. /usr/bin/xfdesktop --reload 2>/dev/null &
  509. EOF
  510. chmod -f 0500 "${file}"
  511. #--- Run now
  512. bash "${file}"
  513. #--- Add to startup
  514. mkdir -p ~/.config/autostart/
  515. file=~/.config/autostart/wallpaper.desktop; [ -e "${file}" ] && cp -n $file{,.bkup}
  516. touch $file
  517. cat <<EOF > "${file}" \
  518.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  519. [Desktop Entry]
  520. Type=Application
  521. Exec=/usr/local/bin/rand-wallpaper
  522. Hidden=false
  523. NoDisplay=false
  524. X-GNOME-Autostart-enabled=true
  525. Name=wallpaper
  526. EOF
  527.  
  528.  
  529. ##### Configure file   Note: need to restart xserver for effect
  530. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring ${GREEN}file${RESET} (Nautilus/Thunar) ~ GUI file system navigation"
  531. #--- Settings
  532. mkdir -p ~/.config/gtk-2.0/
  533. file=~/.config/gtk-2.0/gtkfilechooser.ini; [ -e "${file}" ] && cp -n $file{,.bkup}
  534. touch $file
  535. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  536. sed -i 's/^.*ShowHidden.*/ShowHidden=true/' "${file}" 2>/dev/null \
  537.   || cat <<EOF > "${file}"
  538. [Filechooser Settings]
  539. LocationMode=path-bar
  540. ShowHidden=true
  541. ExpandFolders=false
  542. ShowSizeColumn=true
  543. GeometryX=66
  544. GeometryY=39
  545. GeometryWidth=780
  546. GeometryHeight=618
  547. SortColumn=name
  548. SortOrder=ascending
  549. EOF
  550. dconf write /org/gnome/nautilus/preferences/show-hidden-files true
  551. #--- Bookmarks
  552. file=/root/.gtk-bookmarks; [ -e "${file}" ] && cp -n $file{,.bkup}
  553. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  554. touch $file
  555. grep -q '^file:///root/Downloads ' "${file}" 2>/dev/null \
  556.   || echo 'file:///root/Downloads Downloads' >> "${file}"
  557. (dmidecode | grep -iq vmware) \
  558.   && (mkdir -p /mnt/hgfs/ 2>/dev/null; grep -q '^file:///mnt/hgfs ' "${file}" 2>/dev/null \
  559.     || echo 'file:///mnt/hgfs VMShare' >> "${file}")
  560. grep -q '^file:///tmp ' "${file}" 2>/dev/null \
  561.   || echo 'file:///tmp /TMP' >> "${file}"
  562. grep -q '^file:///usr/share ' "${file}" 2>/dev/null \
  563.   || echo 'file:///usr/share Kali Tools' >> "${file}"
  564. grep -q '^file:///opt ' "${file}" 2>/dev/null \
  565.   || echo 'file:///opt /opt' >> "${file}"
  566. grep -q '^file:///usr/local/src ' "${file}" 2>/dev/null \
  567.   || echo 'file:///usr/local/src SRC' >> "${file}"
  568. grep -q '^file:///var/ftp ' "${file}" 2>/dev/null \
  569.   || echo 'file:///var/ftp FTP' >> "${file}"
  570. grep -q '^file:///var/samba ' "${file}" 2>/dev/null \
  571.   || echo 'file:///var/samba Samba' >> "${file}"
  572. grep -q '^file:///var/tftp ' "${file}" 2>/dev/null \
  573.   || echo 'file:///var/tftp TFTP' >> "${file}"
  574. grep -q '^file:///var/www/html ' "${file}" 2>/dev/null \
  575.   || echo 'file:///var/www/html WWW' >> "${file}"
  576. #--- Configure file browser - Thunar (need to re-login for effect)
  577. mkdir -p ~/.config/Thunar/
  578. file=~/.config/Thunar/thunarrc; [ -e "${file}" ] && cp -n $file{,.bkup}
  579. touch $file
  580. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  581. sed -i 's/LastShowHidden=.*/LastShowHidden=TRUE/' "${file}" 2>/dev/null \
  582.   || echo -e "[Configuration]\nLastShowHidden=TRUE" > "${file}"
  583.  
  584.  
  585. ##### Configure GNOME terminal   Note: need to restart xserver for effect
  586. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring GNOME ${GREEN}terminal${RESET} ~ CLI interface"
  587. gconftool-2 -t bool -s /apps/gnome-terminal/profiles/Default/scrollback_unlimited true
  588. gconftool-2 -t string -s /apps/gnome-terminal/profiles/Default/background_type transparent
  589. gconftool-2 -t string -s /apps/gnome-terminal/profiles/Default/background_darkness 0.85611499999999996
  590.  
  591.  
  592. ##### Configure bash - all users
  593. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring ${GREEN}bash${RESET} ~ CLI shell"
  594. file=/etc/bash.bashrc; [ -e "${file}" ] && cp -n $file{,.bkup}   #~/.bashrc
  595. touch $file
  596. grep -q "cdspell" "${file}" \
  597.   || echo "shopt -sq cdspell" >> "${file}"             # Spell check 'cd' commands
  598. grep -q "autocd" "${file}" \
  599.  || echo "shopt -s autocd" >> "${file}"                # So you don't have to 'cd' before a folder
  600. #grep -q "CDPATH" "${file}" \
  601. # || echo "CDPATH=/etc:/usr/share/:/opt" >> "${file}"  # Always CD into these folders
  602. grep -q "checkwinsize" "${file}" \
  603.  || echo "shopt -sq checkwinsize" >> "${file}"         # Wrap lines correctly after resizing
  604. grep -q "nocaseglob" "${file}" \
  605.  || echo "shopt -sq nocaseglob" >> "${file}"           # Case insensitive pathname expansion
  606. grep -q "HISTSIZE" "${file}" \
  607.  || echo "HISTSIZE=10000" >> "${file}"                 # Bash history (memory scroll back)
  608. grep -q "HISTFILESIZE" "${file}" \
  609.  || echo "HISTFILESIZE=10000" >> "${file}"             # Bash history (file .bash_history)
  610. #--- Apply new configs
  611. source "${file}" || source ~/.zshrc
  612.  
  613.  
  614. ##### Install bash colour - all users
  615. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}bash colour${RESET} ~ colours shell output"
  616. file=/etc/bash.bashrc; [ -e "${file}" ] && cp -n $file{,.bkup}   #~/.bashrc
  617. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  618. sed -i 's/.*force_color_prompt=.*/force_color_prompt=yes/' "${file}"
  619. grep -q '^force_color_prompt' "${file}" 2>/dev/null \
  620.   || echo 'force_color_prompt=yes' >> "${file}"
  621. sed -i 's#PS1='"'"'.*'"'"'#PS1='"'"'${debian_chroot:+($debian_chroot)}\\[\\033\[01;31m\\]\\u@\\h\\\[\\033\[00m\\]:\\[\\033\[01;34m\\]\\w\\[\\033\[00m\\]\\$ '"'"'#' "${file}"
  622. grep -q "^export LS_OPTIONS='--color=auto'" "${file}" 2>/dev/null \
  623.   || echo "export LS_OPTIONS='--color=auto'" >> "${file}"
  624. grep -q '^eval "$(dircolors)"' "${file}" 2>/dev/null \
  625.   || echo 'eval "$(dircolors)"' >> "${file}"
  626. grep -q "^alias ls='ls $LS_OPTIONS'" "${file}" 2>/dev/null \
  627.   || echo "alias ls='ls $LS_OPTIONS'" >> "${file}"
  628. grep -q "^alias ll='ls $LS_OPTIONS -l'" "${file}" 2>/dev/null \
  629.   || echo "alias ll='ls $LS_OPTIONS -l'" >> "${file}"
  630. grep -q "^alias l='ls $LS_OPTIONS -lA'" "${file}" 2>/dev/null \
  631.   || echo "alias l='ls $LS_OPTIONS -lA'" >> "${file}"
  632. #--- All other users that are made afterwards
  633. file=/etc/skel/.bashrc   #; [ -e "${file}" ] && cp -n $file{,.bkup}
  634. sed -i 's/.*force_color_prompt=.*/force_color_prompt=yes/' "${file}"
  635. #--- Apply new configs
  636. source "${file}" || source ~/.zshrc
  637.  
  638.  
  639. ##### Install grc
  640. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}grc${RESET} ~ colours shell output"
  641. apt -y -qq install grc \
  642.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  643. #--- Setup aliases
  644. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  645. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  646. touch $file
  647. grep -q '^## grc diff alias' "${file}" 2>/dev/null \
  648.   || echo -e "## grc diff alias\nalias diff='$(which grc) $(which diff)'\n" >> "${file}"
  649. grep -q '^## grc dig alias' "${file}" 2>/dev/null \
  650.   || echo -e "## grc dig alias\nalias dig='$(which grc) $(which dig)'\n" >> "${file}"
  651. grep -q '^## grc gcc alias' "${file}" 2>/dev/null \
  652.   || echo -e "## grc gcc alias\nalias gcc='$(which grc) $(which gcc)'\n" >> "${file}"
  653. grep -q '^## grc ifconfig alias' "${file}" 2>/dev/null \
  654.   || echo -e "## grc ifconfig alias\nalias ifconfig='$(which grc) $(which ifconfig)'\n" >> "${file}"
  655. grep -q '^## grc mount alias' "${file}" 2>/dev/null \
  656.   || echo -e "## grc mount alias\nalias mount='$(which grc) $(which mount)'\n" >> "${file}"
  657. grep -q '^## grc netstat alias' "${file}" 2>/dev/null \
  658.   || echo -e "## grc netstat alias\nalias netstat='$(which grc) $(which netstat)'\n" >> "${file}"
  659. grep -q '^## grc ping alias' "${file}" 2>/dev/null \
  660.   || echo -e "## grc ping alias\nalias ping='$(which grc) $(which ping)'\n" >> "${file}"
  661. grep -q '^## grc ps alias' "${file}" 2>/dev/null \
  662.   || echo -e "## grc ps alias\nalias ps='$(which grc) $(which ps)'\n" >> "${file}"
  663. grep -q '^## grc tail alias' "${file}" 2>/dev/null \
  664.   || echo -e "## grc tail alias\nalias tail='$(which grc) $(which tail)'\n" >> "${file}"
  665. grep -q '^## grc traceroute alias' "${file}" 2>/dev/null \
  666.   || echo -e "## grc traceroute alias\nalias traceroute='$(which grc) $(which traceroute)'\n" >> "${file}"
  667. grep -q '^## grc wdiff alias' "${file}" 2>/dev/null \
  668.   || echo -e "## grc wdiff alias\nalias wdiff='$(which grc) $(which wdiff)'\n" >> "${file}"
  669. #configure  #esperanto  #ldap  #e  #cvs  #log  #mtr  #ls  #irclog  #mount2  #mount
  670. #--- Apply new aliases
  671. source "${file}" || source ~/.zshrc
  672.  
  673.  
  674. ##### Install bash completion - all users
  675. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}bash completion${RESET} ~ tab complete CLI commands"
  676. apt -y -qq install bash-completion \
  677.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  678. file=/etc/bash.bashrc; [ -e "${file}" ] && cp -n $file{,.bkup}   #~/.bashrc
  679. sed -i '/# enable bash completion in/,+7{/enable bash completion/!s/^#//}' "${file}"
  680. #--- Apply new configs
  681. source "${file}" || source ~/.zshrc
  682.  
  683.  
  684. ##### Configure aliases - root user
  685. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring ${GREEN}aliases${RESET} ~ CLI shortcuts"
  686. #--- Enable defaults - root user
  687. for FILE in /etc/bash.bashrc ~/.bashrc ~/.bash_aliases; do    #/etc/profile /etc/bashrc /etc/bash_aliases /etc/bash.bash_aliases
  688.   [[ ! -f "${FILE}" ]] \
  689.     && continue
  690.   cp -n $FILE{,.bkup}
  691.   sed -i 's/#alias/alias/g' "${FILE}"
  692. done
  693. #--- General system ones
  694. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  695. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  696. grep -q '^## grep aliases' "${file}" 2>/dev/null \
  697.   || echo -e '## grep aliases\nalias grep="grep --color=always"\nalias ngrep="grep -n"\n' >> "${file}"
  698. grep -q '^alias egrep=' "${file}" 2>/dev/null \
  699.   || echo -e 'alias egrep="egrep --color=auto"\n' >> "${file}"
  700. grep -q '^alias fgrep=' "${file}" 2>/dev/null \
  701.   || echo -e 'alias fgrep="fgrep --color=auto"\n' >> "${file}"
  702. #--- Add in ours (OS programs)
  703. grep -q '^alias tmux' "${file}" 2>/dev/null \
  704.   || echo -e '## tmux\nalias tmux="tmux attach || tmux new"\n' >> "${file}"    #alias tmux="tmux attach -t $HOST || tmux new -s $HOST"
  705. grep -q '^alias axel' "${file}" 2>/dev/null \
  706.   || echo -e '## axel\nalias axel="axel -a"\n' >> "${file}"
  707. grep -q '^alias screen' "${file}" 2>/dev/null \
  708.   || echo -e '## screen\nalias screen="screen -xRR"\n' >> "${file}"
  709. #--- Add in ours (shortcuts)
  710. grep -q '^## Checksums' "${file}" 2>/dev/null \
  711.   || echo -e '## Checksums\nalias sha1="openssl sha1"\nalias md5="openssl md5"\n' >> "${file}"
  712. grep -q '^## Force create folders' "${file}" 2>/dev/null \
  713.   || echo -e '## Force create folders\nalias mkdir="/bin/mkdir -pv"\n' >> "${file}"
  714. #grep -q '^## Mount' "${file}" 2>/dev/null \
  715. #  || echo -e '## Mount\nalias mount="mount | column -t"\n' >> "${file}"
  716. grep -q '^## List open ports' "${file}" 2>/dev/null \
  717.   || echo -e '## List open ports\nalias ports="netstat -tulanp"\n' >> "${file}"
  718. grep -q '^## Get header' "${file}" 2>/dev/null \
  719.   || echo -e '## Get header\nalias header="curl -I"\n' >> "${file}"
  720. grep -q '^## Get external IP address' "${file}" 2>/dev/null \
  721.   || echo -e '## Get external IP address\nalias ipx="curl -s http://ipinfo.io/ip"\n' >> "${file}"
  722. grep -q '^## DNS - External IP #1' "${file}" 2>/dev/null \
  723.   || echo -e '## DNS - External IP #1\nalias dns1="dig +short @resolver1.opendns.com myip.opendns.com"\n' >> "${file}"
  724. grep -q '^## DNS - External IP #2' "${file}" 2>/dev/null \
  725.   || echo -e '## DNS - External IP #2\nalias dns2="dig +short @208.67.222.222 myip.opendns.com"\n' >> "${file}"
  726. grep -q '^## DNS - Check' "${file}" 2>/dev/null \
  727.   || echo -e '### DNS - Check ("#.abc" is Okay)\nalias dns3="dig +short @208.67.220.220 which.opendns.com txt"\n' >> "${file}"
  728. grep -q '^## Directory navigation aliases' "${file}" 2>/dev/null \
  729.   || echo -e '## Directory navigation aliases\nalias ..="cd .."\nalias ...="cd ../.."\nalias ....="cd ../../.."\nalias .....="cd ../../../.."\n' >> "${file}"
  730. grep -q '^## Extract file' "${file}" 2>/dev/null \
  731.   || cat <<EOF >> "${file}" \
  732.     || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  733.  
  734. ## Extract file, example. "ex package.tar.bz2"
  735. ex() {
  736.   if [[ -f \$1 ]]; then
  737.     case \$1 in
  738.       *.tar.bz2) tar xjf \$1 ;;
  739.       *.tar.gz)  tar xzf \$1 ;;
  740.       *.bz2)     bunzip2 \$1 ;;
  741.       *.rar)     rar x \$1 ;;
  742.       *.gz)      gunzip \$1  ;;
  743.       *.tar)     tar xf \$1  ;;
  744.       *.tbz2)    tar xjf \$1 ;;
  745.       *.tgz)     tar xzf \$1 ;;
  746.       *.zip)     unzip \$1 ;;
  747.       *.Z)       uncompress \$1 ;;
  748.       *.7z)      7z x \$1 ;;
  749.       *)         echo \$1 cannot be extracted ;;
  750.     esac
  751.   else
  752.     echo \$1 is not a valid file
  753.   fi
  754. }
  755. EOF
  756. grep -q '^## strings' "${file}" 2>/dev/null \
  757.   || echo -e '## strings\nalias strings="strings -a"\n' >> "${file}"
  758. grep -q '^## history' "${file}" 2>/dev/null \
  759.   || echo -e '## history\nalias hg="history | grep"\n' >> "${file}"
  760. grep -q '^## Network Services' "${file}" 2>/dev/null \
  761.   || echo -e '### Network Services\nalias listen="netstat -antp | grep LISTEN"\n' >> "${file}"
  762. grep -q '^## HDD size' "${file}" 2>/dev/null \
  763.   || echo -e '### HDD size\nalias hogs="for i in G M K; do du -ah | grep [0-9]$i | sort -nr -k 1; done | head -n 11"\n' >> "${file}"
  764. grep -q '^## Listing' "${file}" 2>/dev/null \
  765.   || echo -e '### Listing\nalias ll="ls -l --block-size=1 --color=auto"\n' >> "${file}"
  766. #--- Add in tools
  767. grep -q '^## nmap' "${file}" 2>/dev/null \
  768.   || echo -e '## nmap\nalias nmap="nmap --reason --open --stats-every 3m --max-retries 1 --max-scan-delay 20 --defeat-rst-ratelimit"\n' >> "${file}"
  769. grep -q '^## aircrack-ng' "${file}" 2>/dev/null \
  770.   || echo -e '## aircrack-ng\nalias aircrack-ng="aircrack-ng -z"\n' >> "${file}"
  771. grep -q '^## airodump-ng' "${file}" 2>/dev/null \
  772.   || echo -e '## airodump-ng \nalias airodump-ng="airodump-ng --manufacturer --wps --uptime"\n' >> "${file}"
  773. grep -q '^## metasploit' "${file}" 2>/dev/null \
  774.   || (echo -e '## metasploit\nalias msfc="systemctl start postgresql; msfdb start; msfconsole -q \"\$@\""' >> "${file}" \
  775.     && echo -e 'alias msfconsole="systemctl start postgresql; msfdb start; msfconsole \"\$@\""\n' >> "${file}" )
  776. [ "${openVAS}" != "false" ] \
  777.   && (grep -q '^## openvas' "${file}" 2>/dev/null \
  778.     || echo -e '## openvas\nalias openvas="openvas-stop; openvas-start; sleep 3s; xdg-open https://127.0.0.1:9392/ >/dev/null 2>&1"\n' >> "${file}")
  779. grep -q '^## mana-toolkit' "${file}" 2>/dev/null \
  780.   || (echo -e '## mana-toolkit\nalias mana-toolkit-start="a2ensite 000-mana-toolkit;a2dissite 000-default; systemctl restart apache2"' >> "${file}" \
  781.     && echo -e 'alias mana-toolkit-stop="a2dissite 000-mana-toolkit; a2ensite 000-default; systemctl restart apache2"\n' >> "${file}" )
  782. grep -q '^## ssh' "${file}" 2>/dev/null \
  783.   || echo -e '## ssh\nalias ssh-start="systemctl restart ssh"\nalias ssh-stop="systemctl stop ssh"\n' >> "${file}"
  784. grep -q '^## samba' "${file}" 2>/dev/null \
  785.   || echo -e '## samba\nalias smb-start="systemctl restart smbd nmbd"\nalias smb-stop="systemctl stop smbd nmbd"\n' >> "${file}"
  786. grep -q '^## rdesktop' "${file}" 2>/dev/null \
  787.   || echo -e '## rdesktop\nalias rdesktop="rdesktop -z -P -g 90% -r disk:local=\"/tmp/\""\n' >> "${file}"
  788. #--- Add in folders
  789. grep -q '^## www' "${file}" 2>/dev/null \
  790.   || echo -e '## www\nalias wwwroot="cd /var/www/html/"\n#alias www="cd /var/www/html/"\n' >> "${file}"
  791. grep -q '^## ftp' "${file}" 2>/dev/null \
  792.   || echo -e '## ftp\nalias ftproot="cd /var/ftp/"\n' >> "${file}"
  793. grep -q '^## tftp' "${file}" 2>/dev/null \
  794.   || echo -e '## tftp\nalias tftproot="cd /var/tftp/"\n' >> "${file}"
  795. grep -q '^## smb' "${file}" 2>/dev/null \
  796.   || echo -e '## smb\nalias smb="cd /var/samba/"\n#alias smbroot="cd /var/samba/"\n' >> "${file}"
  797. (dmidecode | grep -iq vmware) \
  798.   && (grep -q '^## vmware' "${file}" 2>/dev/null \
  799.     || echo -e '## vmware\nalias vmroot="cd /mnt/hgfs/"\n' >> "${file}")
  800. grep -q '^## edb' "${file}" 2>/dev/null \
  801.   || echo -e '## edb\nalias edb="cd /usr/share/exploitdb/platforms/"\nalias edbroot="cd /usr/share/exploitdb/platforms/"\n' >> "${file}"
  802. grep -q '^## wordlist' "${file}" 2>/dev/null \
  803.   || echo -e '## wordlist\nalias wordlists="cd /usr/share/wordlists/"\n' >> "${file}"
  804. #--- Apply new aliases
  805. source "${file}" || source ~/.zshrc
  806. #--- Check
  807. #alias
  808.  
  809.  
  810. ##### Install (GNOME) Terminator
  811. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing (GNOME) ${GREEN}Terminator${RESET} ~ multiple terminals in a single window"
  812. apt -y -qq install terminator \
  813.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  814. #--- Configure terminator
  815. mkdir -p ~/.config/terminator/
  816. file=~/.config/terminator/config; [ -e "${file}" ] && cp -n $file{,.bkup}
  817. touch $file
  818. cat <<EOF > "${file}" \
  819.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  820. [global_config]
  821.   enabled_plugins = TerminalShot, LaunchpadCodeURLHandler, APTURLHandler, LaunchpadBugURLHandler
  822. [keybindings]
  823. [profiles]
  824.   [[default]]
  825.     background_darkness = 0.9
  826.     scroll_on_output = False
  827.     copy_on_selection = True
  828.     background_type = transparent
  829.     scrollback_infinite = True
  830.     show_titlebar = False
  831. [layouts]
  832.   [[default]]
  833.     [[[child1]]]
  834.       type = Terminal
  835.       parent = window0
  836.     [[[window0]]]
  837.       type = Window
  838.       parent = ""
  839. [plugins]
  840. EOF
  841.  
  842. ##### Install ZSH & Oh-My-ZSH - root user.   Note:  'Open terminal here', will not work with ZSH.   Make sure to have tmux already installed
  843. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}ZSH${RESET} & ${GREEN}Oh-My-ZSH${RESET} ~ unix shell"
  844. apt -y -qq install zsh git curl \
  845.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  846. #--- Setup oh-my-zsh
  847. timeout 300 curl --progress -k -L -f "https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh" | zsh
  848. #--- Configure zsh
  849. file=~/.zshrc; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/zsh/zshrc
  850. touch $file
  851. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  852. grep -q 'interactivecomments' "${file}" 2>/dev/null \
  853.   || echo 'setopt interactivecomments' >> "${file}"
  854. grep -q 'ignoreeof' "${file}" 2>/dev/null \
  855.   || echo 'setopt ignoreeof' >> "${file}"
  856. grep -q 'correctall' "${file}" 2>/dev/null \
  857.   || echo 'setopt correctall' >> "${file}"
  858. grep -q 'globdots' "${file}" 2>/dev/null \
  859.   || echo 'setopt globdots' >> "${file}"
  860. grep -q '.bash_aliases' "${file}" 2>/dev/null \
  861.   || echo 'source $HOME/.bash_aliases' >> "${file}"
  862. grep -q '/usr/bin/tmux' "${file}" 2>/dev/null \
  863.   || echo '#if ([[ -z "$TMUX" && -n "$SSH_CONNECTION" ]]); then /usr/bin/tmux attach || /usr/bin/tmux new; fi' >> "${file}"   # If not already in tmux and via SSH
  864. #--- Configure zsh (themes) ~ https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
  865. sed -i 's/ZSH_THEME=.*/ZSH_THEME="mh"/' "${file}"   # Other themes: mh, jreese,   alanpeabody,   candy,   terminalparty, kardan,   nicoulaj, sunaku
  866. #--- Configure oh-my-zsh
  867. sed -i 's/plugins=(.*)/plugins=(git git-extras tmux last-working-dir dirhistory python pip)/' "${file}"
  868. #--- Set zsh as default shell (current user)
  869. chsh -s "$(which zsh)"
  870.  
  871.  
  872. ##### Install tmux - all users
  873. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}tmux${RESET} ~ multiplex virtual consoles"
  874. apt -y -qq install tmux \
  875.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  876. file=~/.tmux.conf; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/tmux.conf
  877. touch $file
  878. #--- Configure tmux
  879. cat <<EOF > "${file}" \
  880.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  881. #-Settings---------------------------------------------------------------------
  882. ## Make it like screen (use CTRL+a)
  883. unbind C-b
  884. set -g prefix C-a
  885.  
  886. ## Pane switching (SHIFT+ARROWS)
  887. bind-key -n S-Left select-pane -L
  888. bind-key -n S-Right select-pane -R
  889. bind-key -n S-Up select-pane -U
  890. bind-key -n S-Down select-pane -D
  891.  
  892. ## Windows switching (ALT+ARROWS)
  893. bind-key -n M-Left  previous-window
  894. bind-key -n M-Right next-window
  895.  
  896. ## Windows re-ording (SHIFT+ALT+ARROWS)
  897. bind-key -n M-S-Left swap-window -t -1
  898. bind-key -n M-S-Right swap-window -t +1
  899.  
  900. ## Activity Monitoring
  901. setw -g monitor-activity on
  902. set -g visual-activity on
  903.  
  904. ## Set defaults
  905. set -g default-terminal screen-256color
  906. set -g history-limit 5000
  907.  
  908. ## Default windows titles
  909. set -g set-titles on
  910. set -g set-titles-string '#(whoami)@#H - #I:#W'
  911.  
  912. ## Last window switch
  913. bind-key C-a last-window
  914.  
  915. ## Reload settings (CTRL+a -> r)
  916. unbind r
  917. bind r source-file /etc/tmux.conf
  918.  
  919. ## Load custom sources
  920. #source ~/.bashrc   #(issues if you use /bin/bash & Debian)
  921.  
  922. EOF
  923. [ -e /bin/zsh ] \
  924.   && echo -e '## Use ZSH as default shell\nset-option -g default-shell /bin/zsh\n' >> "${file}"
  925. cat <<EOF >> "${file}"
  926. ## Show tmux messages for longer
  927. set -g display-time 3000
  928.  
  929. ## Status bar is redrawn every minute
  930. set -g status-interval 60
  931.  
  932.  
  933. #-Theme------------------------------------------------------------------------
  934. ## Default colours
  935. set -g status-bg black
  936. set -g status-fg white
  937.  
  938. ## Left hand side
  939. set -g status-left-length '34'
  940. set -g status-left '#[fg=green,bold]#(whoami)#[default]@#[fg=yellow,dim]#H #[fg=green,dim][#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[fg=green,dim]]'
  941.  
  942. ## Inactive windows in status bar
  943. set-window-option -g window-status-format '#[fg=red,dim]#I#[fg=grey,dim]:#[default,dim]#W#[fg=grey,dim]'
  944.  
  945. ## Current or active window in status bar
  946. #set-window-option -g window-status-current-format '#[bg=white,fg=red]#I#[bg=white,fg=grey]:#[bg=white,fg=black]#W#[fg=dim]#F'
  947. set-window-option -g window-status-current-format '#[fg=red,bold](#[fg=white,bold]#I#[fg=red,dim]:#[fg=white,bold]#W#[fg=red,bold])'
  948.  
  949. ## Right hand side
  950. set -g status-right '#[fg=green][#[fg=yellow]%Y-%m-%d #[fg=white]%H:%M#[fg=green]]'
  951. EOF
  952. #--- Setup alias
  953. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  954. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  955. grep -q '^alias tmux' "${file}" 2>/dev/null \
  956.   || echo -e '## tmux\nalias tmux="tmux attach || tmux new"\n' >> "${file}"    #alias tmux="tmux attach -t $HOST || tmux new -s $HOST"
  957. #--- Apply new alias
  958. source "${file}" || source ~/.zshrc
  959.  
  960.  
  961. ##### Configure screen ~ if possible, use tmux instead!
  962. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring ${GREEN}screen${RESET} ~ multiplex virtual consoles"
  963. #apt -y -qq install screen \
  964. #  || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  965. #--- Configure screen
  966. file=~/.screenrc; [ -e "${file}" ] && cp -n $file{,.bkup}
  967. if [[ -f "${file}" ]]; then
  968.   echo -e ' '${RED}'[!]'${RESET}" ${file} detected. Skipping..." 1>&2
  969. else
  970.   touch $file
  971.   cat <<EOF > "${file}"
  972. ## Don't display the copyright page
  973. startup_message off
  974.  
  975. ## tab-completion flash in heading bar
  976. vbell off
  977.  
  978. ## Keep scrollback n lines
  979. defscrollback 1000
  980.  
  981. ## Hardstatus is a bar of text that is visible in all screens
  982. hardstatus on
  983. hardstatus alwayslastline
  984. hardstatus string '%{gk}%{G}%H %{g}[%{Y}%l%{g}] %= %{wk}%?%-w%?%{=b kR}(%{W}%n %t%?(%u)%?%{=b kR})%{= kw}%?%+w%?%?%= %{g} %{Y} %Y-%m-%d %C%a %{W}'
  985.  
  986. ## Title bar
  987. termcapinfo xterm ti@:te@
  988.  
  989. ## Default windows (syntax: screen -t label order command)
  990. screen -t bash1 0
  991. screen -t bash2 1
  992.  
  993. ## Select the default window
  994. select 0
  995. EOF
  996. fi
  997.  
  998.  
  999. ##### Install vim - all users
  1000. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}vim${RESET} ~ CLI text editor"
  1001. apt -y -qq install vim \
  1002.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1003. #--- Configure vim
  1004. file=/etc/vim/vimrc; [ -e "${file}" ] && cp -n $file{,.bkup}   #~/.vimrc
  1005. touch $file
  1006. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  1007. sed -i 's/.*syntax on/syntax on/' "${file}"
  1008. sed -i 's/.*set background=dark/set background=dark/' "${file}"
  1009. sed -i 's/.*set showcmd/set showcmd/' "${file}"
  1010. sed -i 's/.*set showmatch/set showmatch/' "${file}"
  1011. sed -i 's/.*set ignorecase/set ignorecase/' "${file}"
  1012. sed -i 's/.*set smartcase/set smartcase/' "${file}"
  1013. sed -i 's/.*set incsearch/set incsearch/' "${file}"
  1014. sed -i 's/.*set autowrite/set autowrite/' "${file}"
  1015. sed -i 's/.*set hidden/set hidden/' "${file}"
  1016. sed -i 's/.*set mouse=.*/"set mouse=a/' "${file}"
  1017. grep -q '^set number' "${file}" 2>/dev/null \
  1018.   || echo 'set number' >> "${file}"                                                                      # Add line numbers
  1019. grep -q '^set expandtab' "${file}" 2>/dev/null \
  1020.   || echo -e 'set expandtab\nset smarttab' >> "${file}"                                                  # Set use spaces instead of tabs
  1021. grep -q '^set softtabstop' "${file}" 2>/dev/null \
  1022.   || echo -e 'set softtabstop=4\nset shiftwidth=4' >> "${file}"                                          # Set 4 spaces as a 'tab'
  1023. grep -q '^set foldmethod=marker' "${file}" 2>/dev/null \
  1024.   || echo 'set foldmethod=marker' >> "${file}"                                                           # Folding
  1025. grep -q '^nnoremap <space> za' "${file}" 2>/dev/null \
  1026.   || echo 'nnoremap <space> za' >> "${file}"                                                             # Space toggle folds
  1027. grep -q '^set hlsearch' "${file}" 2>/dev/null \
  1028.   || echo 'set hlsearch' >> "${file}"                                                                    # Highlight search results
  1029. grep -q '^set laststatus' "${file}" 2>/dev/null \
  1030.   || echo -e 'set laststatus=2\nset statusline=%F%m%r%h%w\ (%{&ff}){%Y}\ [%l,%v][%p%%]' >> "${file}"     # Status bar
  1031. grep -q '^filetype on' "${file}" 2>/dev/null \
  1032.   || echo -e 'filetype on\nfiletype plugin on\nsyntax enable\nset grepprg=grep\ -nH\ $*' >> "${file}"    # Syntax highlighting
  1033. grep -q '^set wildmenu' "${file}" 2>/dev/null \
  1034.   || echo -e 'set wildmenu\nset wildmode=list:longest,full' >> "${file}"                                 # Tab completion
  1035. grep -q '^set invnumber' "${file}" 2>/dev/null \
  1036.   || echo -e ':nmap <F8> :set invnumber<CR>' >> "${file}"                                                # Toggle line numbers
  1037. grep -q '^set pastetoggle=<F9>' "${file}" 2>/dev/null \
  1038.   || echo -e 'set pastetoggle=<F9>' >> "${file}"                                                         # Hotkey - turning off auto indent when pasting
  1039. grep -q '^:command Q q' "${file}" 2>/dev/null \
  1040.   || echo -e ':command Q q' >> "${file}"                                                                 # Fix stupid typo I always make
  1041. #--- Set as default editor
  1042. export EDITOR="vim"   #update-alternatives --config editor
  1043. file=/etc/bash.bashrc; [ -e "${file}" ] && cp -n $file{,.bkup}
  1044. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  1045. grep -q '^EDITOR' "${file}" 2>/dev/null \
  1046.   || echo 'EDITOR="vim"' >> "${file}"
  1047. git config --global core.editor "vim"
  1048. #--- Set as default mergetool
  1049. git config --global merge.tool vimdiff
  1050. git config --global merge.conflictstyle diff3
  1051. git config --global mergetool.prompt false
  1052.  
  1053.  
  1054. ##### Install git - all users
  1055. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}git${RESET} ~ revision control"
  1056. apt -y -qq install git \
  1057.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1058. #--- Set as default editor
  1059. git config --global core.editor "vim"
  1060. #--- Set as default mergetool
  1061. git config --global merge.tool vimdiff
  1062. git config --global merge.conflictstyle diff3
  1063. git config --global mergetool.prompt false
  1064. #--- Set as default push
  1065. git config --global push.default simple
  1066.  
  1067.  
  1068. ##### Setup firefox
  1069. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}firefox${RESET} ~ GUI web browser"
  1070. apt -y -qq install unzip curl firefox-esr \
  1071.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1072. #--- Configure firefox
  1073. export DISPLAY=:0.0
  1074. timeout 15 firefox >/dev/null 2>&1                # Start and kill. Files needed for first time run
  1075. timeout 5 killall -9 -q -w firefox-esr >/dev/null
  1076. file=$(find ~/.mozilla/firefox/*.default*/ -maxdepth 1 -type f -name 'prefs.js' -print -quit)
  1077. [ -e "${file}" ] \
  1078.   && cp -n $file{,.bkup}   #/etc/firefox-esr/pref/*.js
  1079. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  1080. sed -i 's/^.network.proxy.socks_remote_dns.*/user_pref("network.proxy.socks_remote_dns", true);' "${file}" 2>/dev/null \
  1081.   || echo 'user_pref("network.proxy.socks_remote_dns", true);' >> "${file}"
  1082. sed -i 's/^.browser.safebrowsing.enabled.*/user_pref("browser.safebrowsing.enabled", false);' "${file}" 2>/dev/null \
  1083.   || echo 'user_pref("browser.safebrowsing.enabled", false);' >> "${file}"
  1084. sed -i 's/^.browser.safebrowsing.malware.enabled.*/user_pref("browser.safebrowsing.malware.enabled", false);' "${file}" 2>/dev/null \
  1085.   || echo 'user_pref("browser.safebrowsing.malware.enabled", false);' >> "${file}"
  1086. sed -i 's/^.browser.safebrowsing.remoteLookups.enabled.*/user_pref("browser.safebrowsing.remoteLookups.enabled", false);' "${file}" 2>/dev/null \
  1087.   || echo 'user_pref("browser.safebrowsing.remoteLookups.enabled", false);' >> "${file}"
  1088. sed -i 's/^.*browser.startup.page.*/user_pref("browser.startup.page", 0);' "${file}" 2>/dev/null \
  1089.   || echo 'user_pref("browser.startup.page", 0);' >> "${file}"
  1090. sed -i 's/^.*privacy.donottrackheader.enabled.*/user_pref("privacy.donottrackheader.enabled", true);' "${file}" 2>/dev/null \
  1091.   || echo 'user_pref("privacy.donottrackheader.enabled", true);' >> "${file}"
  1092. sed -i 's/^.*browser.showQuitWarning.*/user_pref("browser.showQuitWarning", true);' "${file}" 2>/dev/null \
  1093.   || echo 'user_pref("browser.showQuitWarning", true);' >> "${file}"
  1094. sed -i 's/^.*extensions.https_everywhere._observatory.popup_shown.*/user_pref("extensions.https_everywhere._observatory.popup_shown", true);' "${file}" 2>/dev/null \
  1095.   || echo 'user_pref("extensions.https_everywhere._observatory.popup_shown", true);' >> "${file}"
  1096. sed -i 's/^.network.security.ports.banned.override/user_pref("network.security.ports.banned.override", "1-65455");' "${file}" 2>/dev/null \
  1097.   || echo 'user_pref("network.security.ports.banned.override", "1-65455");' >> "${file}"
  1098. #--- Replace bookmarks (base: http://pentest-bookmarks.googlecode.com)
  1099. file=$(find ~/.mozilla/firefox/*.default*/ -maxdepth 1 -type f -name 'bookmarks.html' -print -quit)
  1100. [ -e "${file}" ] \
  1101.   && cp -n $file{,.bkup}   #/etc/firefox-esr/profile/bookmarks.html
  1102. timeout 300 curl --progress -k -L -f "http://pentest-bookmarks.googlecode.com/files/bookmarksv1.5.html" > /tmp/bookmarks_new.html \
  1103.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading bookmarks_new.html" 1>&2      #***!!! hardcoded version! Need to manually check for updates
  1104. #--- Configure bookmarks
  1105. awk '!a[$0]++' /tmp/bookmarks_new.html \
  1106.   | \egrep -v ">(Latest Headlines|Getting Started|Recently Bookmarked|Recent Tags|Mozilla Firefox|Help and Tutorials|Customize Firefox|Get Involved|About Us|Hacker Media|Bookmarks Toolbar|Most Visited)</" \
  1107.   | \egrep -v "^    </DL><p>" \
  1108.   | \egrep -v "^<DD>Add" > "${file}"
  1109. sed -i 's#^</DL><p>#        </DL><p>\n    </DL><p>\n</DL><p>#' "${file}"                                          # Fix import issues from pentest-bookmarks...
  1110. sed -i 's#^    <DL><p>#    <DL><p>\n    <DT><A HREF="http://127.0.0.1/">localhost</A>#' "${file}"                 # Add localhost to bookmark toolbar (before hackery folder)
  1111. sed -i 's#^</DL><p>#    <DT><A HREF="https://127.0.0.1:8834/">Nessus</A>\n</DL><p>#' "${file}"                    # Add Nessus UI bookmark toolbar
  1112. [ "${openVAS}" != "false" ] \
  1113.   && sed -i 's#^</DL><p>#    <DT><A HREF="https://127.0.0.1:9392/">OpenVAS</A>\n</DL><p>#' "${file}"              # Add OpenVAS UI to bookmark toolbar
  1114. sed -i 's#^</DL><p>#    <DT><A HREF="http://127.0.0.1:3000/ui/panel">BeEF</A>\n</DL><p>#' "${file}"               # Add BeEF UI to bookmark toolbar
  1115. sed -i 's#^</DL><p>#    <DT><A HREF="http://127.0.0.1/rips/">RIPS</A>\n</DL><p>#' "${file}"                       # Add RIPs to bookmark toolbar
  1116. sed -i 's#^</DL><p>#    <DT><A HREF="https://paulschou.com/tools/xlate/">XLATE</A>\n</DL><p>#' "${file}"          # Add XLATE to bookmark toolbar
  1117. sed -i 's#^</DL><p>#    <DT><A HREF="https://hackvertor.co.uk/public">HackVertor</A>\n</DL><p>#' "${file}"        # Add HackVertor to bookmark toolbar
  1118. sed -i 's#^</DL><p>#    <DT><A HREF="http://www.irongeek.com/skiddypad.php">SkiddyPad</A>\n</DL><p>#' "${file}"   # Add Skiddypad to bookmark toolbar
  1119. sed -i 's#^</DL><p>#    <DT><A HREF="https://www.exploit-db.com/search/">Exploit-DB</A>\n</DL><p>#' "${file}"     # Add Exploit-DB to bookmark toolbar
  1120. sed -i 's#^</DL><p>#    <DT><A HREF="http://offset-db.com/">Offset-DB</A>\n</DL><p>#' "${file}"                   # Add Offset-DB to bookmark toolbar
  1121. sed -i 's#^</DL><p>#    <DT><A HREF="http://shell-storm.org/shellcode/">Shelcodes</A>\n</DL><p>#' "${file}"       # Add Shelcodes to bookmark toolbar
  1122. sed -i 's#^</DL><p>#    <DT><A HREF="http://ropshell.com/">ROP Shell</A>\n</DL><p>#' "${file}"                    # Add ROP Shell to bookmark toolbar
  1123. sed -i 's#^</DL><p>#    <DT><A HREF="https://ifconfig.io/">ifconfig</A>\n</DL><p>#' "${file}"                     # Add ifconfig.io to bookmark toolbar
  1124. sed -i 's#<HR>#<DT><H3 ADD_DATE="1303667175" LAST_MODIFIED="1303667175" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3>\n<DD>Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar#' "${file}"
  1125. #--- Clear bookmark cache
  1126. find ~/.mozilla/firefox/*.default*/ -maxdepth 1 -mindepth 1 -type f -name "places.sqlite" -delete
  1127. find ~/.mozilla/firefox/*.default*/bookmarkbackups/ -type f -delete
  1128. #--- Set firefox for XFCE's default
  1129. mkdir -p ~/.config/xfce4/
  1130. file=~/.config/xfce4/helpers.rc; [ -e "${file}" ] && cp -n $file{,.bkup}    #exo-preferred-applications   #xdg-mime default
  1131. touch $file
  1132. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  1133. sed -i 's#^WebBrowser=.*#WebBrowser=firefox#' "${file}" 2>/dev/null \
  1134.   || echo -e 'WebBrowser=firefox' >> "${file}"
  1135.  
  1136.  
  1137. ##### Setup firefox's plugins
  1138. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}firefox's plugins${RESET} ~ useful addons"
  1139. #--- Configure firefox
  1140. export DISPLAY=:0.0
  1141. #--- Download extensions
  1142. ffpath="$(find ~/.mozilla/firefox/*.default*/ -maxdepth 0 -mindepth 0 -type d -name '*.default*' -print -quit)/extensions"
  1143. [ "${ffpath}" == "/extensions" ] \
  1144.   && echo -e ' '${RED}'[!]'${RESET}" Couldn't find Firefox folder" 1>&2
  1145. mkdir -p "${ffpath}/"
  1146. #--- plug-n-hack
  1147. #curl --progress -k -L -f "https://github.com/mozmark/ringleader/blob/master/fx_pnh.xpi?raw=true????????????????"  \
  1148. #  || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'plug-n-hack' 1>&2
  1149. #--- HttpFox
  1150. #curl --progress -k -L -f "https://addons.mozilla.org/en-GB/firefox/addon/httpfox/??????????????"  \
  1151. #  || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'HttpFox' 1>&2
  1152. #--- SQLite Manager
  1153. echo -n '[1/11]'; timeout 300 curl --progress -k -L -f "https://addons.mozilla.org/firefox/downloads/latest/5817/addon-5817-latest.xpi?src=dp-btn-primary" \
  1154.   -o "${ffpath}/SQLiteManager@mrinalkant.blogspot.com.xpi" \
  1155.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'SQLite Manager'" 1>&2
  1156. #--- Cookies Manager+
  1157. echo -n '[2/11]'; timeout 300 curl --progress -k -L -f "https://addons.mozilla.org/firefox/downloads/latest/92079/addon-92079-latest.xpi?src=dp-btn-primary" \
  1158.   -o "${ffpath}/{bb6bc1bb-f824-4702-90cd-35e2fb24f25d}.xpi" \
  1159.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'Cookies Manager+'" 1>&2
  1160. #--- Firebug
  1161. echo -n '[3/11]'; timeout 300 curl --progress -k -L -f "https://addons.mozilla.org/firefox/downloads/latest/1843/addon-1843-latest.xpi?src=dp-btn-primary" \
  1162.   -o "${ffpath}/firebug@software.joehewitt.com.xpi" \
  1163.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'Firebug'" 1>&2
  1164. #--- FoxyProxy Basic
  1165. echo -n '[4/11]'; timeout 300 curl --progress -k -L -f "https://addons.mozilla.org/firefox/downloads/latest/15023/addon-15023-latest.xpi?src=dp-btn-primary" \
  1166.   -o "${ffpath}/foxyproxy-basic@eric.h.jung.xpi" \
  1167.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'FoxyProxy Basic'" 1>&2
  1168. #--- User Agent Overrider
  1169. echo -n '[5/11]'; timeout 300 curl --progress -k -L -f "https://addons.mozilla.org/firefox/downloads/latest/429678/addon-429678-latest.xpi?src=dp-btn-primary" \
  1170.   -o "${ffpath}/useragentoverrider@qixinglu.com.xpi" \
  1171.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'User Agent Overrider'" 1>&2
  1172. #--- HTTPS Everywhere
  1173. echo -n '[6/11]'; timeout 300 curl --progress -k -L -f "https://www.eff.org/files/https-everywhere-latest.xpi" \
  1174.   -o "${ffpath}/https-everywhere@eff.org.xpi" \
  1175.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'HTTPS Everywhere'" 1>&2
  1176. #--- Live HTTP Headers
  1177. echo -n '[7/11]'; timeout 300 curl --progress -k -L -f "https://addons.mozilla.org/firefox/downloads/latest/3829/addon-3829-latest.xpi?src=dp-btn-primary" \
  1178.   -o "${ffpath}/{8f8fe09b-0bd3-4470-bc1b-8cad42b8203a}.xpi" \
  1179.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'Live HTTP Headers'" 1>&2
  1180. #---Tamper Data
  1181. echo -n '[8/11]'; timeout 300 curl --progress -k -L -f "https://addons.mozilla.org/firefox/downloads/latest/966/addon-966-latest.xpi?src=dp-btn-primary" \
  1182.   -o "${ffpath}/{9c51bd27-6ed8-4000-a2bf-36cb95c0c947}.xpi" \
  1183.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'Tamper Data'" 1>&2
  1184. #--- Disable Add-on Compatibility Checks
  1185. echo -n '[9/11]'; timeout 300 curl --progress -k -L -f "https://addons.mozilla.org/firefox/downloads/latest/300254/addon-300254-latest.xpi?src=dp-btn-primary" \
  1186.   -o "${ffpath}/check-compatibility@dactyl.googlecode.com.xpi" \
  1187.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'Disable Add-on Compatibility Checks'" 1>&2
  1188. #--- Disable HackBar
  1189. echo -n '[10/11]'; timeout 300 curl --progress -k -L -f "https://addons.mozilla.org/firefox/downloads/latest/3899/addon-3899-latest.xpi?src=dp-btn-primary" \
  1190.   -o "${ffpath}/{F5DDF39C-9293-4d5e-9AA8-E04E6DD5E9B4}.xpi" \
  1191.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'HackBar'" 1>&2
  1192. #--- uBlock
  1193. echo -n '[11/11]'; timeout 300 curl --progress -k -L -f "https://addons.mozilla.org/firefox/downloads/latest/607454/addon-607454-latest.xpi?src=dp-btn-primary" \
  1194.   -o "${ffpath}/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}.xpi" \
  1195.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 'uBlock'" 1>&2
  1196. #--- Installing extensions
  1197. for FILE in $(find "${ffpath}" -maxdepth 1 -type f -name '*.xpi'); do
  1198.   d="$(basename "${FILE}" .xpi)"
  1199.   mkdir -p "${ffpath}/${d}/"
  1200.   unzip -q -o -d "${ffpath}/${d}/" "${FILE}"
  1201.   rm -f "${FILE}"
  1202. done
  1203. #--- Enable Firefox's addons/plugins/extensions
  1204. timeout 15 firefox >/dev/null 2>&1
  1205. timeout 5 killall -9 -q -w firefox-esr >/dev/null
  1206. sleep 3s
  1207. #--- Method #1 (Works on older versions)
  1208. file=$(find ~/.mozilla/firefox/*.default*/ -maxdepth 1 -type f -name 'extensions.sqlite' -print -quit)   #&& [ -e "${file}" ] && cp -n $file{,.bkup}
  1209. if [[ -e "${file}" ]] || [[ -n "${file}" ]]; then
  1210.   echo -e " ${YELLOW}[i]${RESET} Enabled ${YELLOW}Firefox's extensions${RESET} (via method #1 - extensions.sqlite)"
  1211.   apt -y -qq install sqlite3 \
  1212.     || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1213.   rm -f /tmp/firefox.sql
  1214.   touch /tmp/firefox.sql
  1215.   echo "UPDATE 'main'.'addon' SET 'active' = 1, 'userDisabled' = 0;" > /tmp/firefox.sql    # Force them all!
  1216.   sqlite3 "${file}" < /tmp/firefox.sql      #fuser extensions.sqlite
  1217. fi
  1218. #--- Method #2 (Newer versions)
  1219. file=$(find ~/.mozilla/firefox/*.default*/ -maxdepth 1 -type f -name 'extensions.json' -print -quit)   #&& [ -e "${file}" ] && cp -n $file{,.bkup}
  1220. if [[ -e "${file}" ]] || [[ -n "${file}" ]]; then
  1221.   echo -e " ${YELLOW}[i]${RESET} Enabled ${YELLOW}Firefox's extensions${RESET} (via method #2 - extensions.json)"
  1222.   sed -i 's/"active":false,/"active":true,/g' "${file}"                # Force them all!
  1223.   sed -i 's/"userDisabled":true,/"userDisabled":false,/g' "${file}"    # Force them all!
  1224. fi
  1225. #--- Remove cache
  1226. file=$(find ~/.mozilla/firefox/*.default*/ -maxdepth 1 -type f -name 'prefs.js' -print -quit)   #&& [ -e "${file}" ] && cp -n $file{,.bkup}
  1227. [ -n "${file}" ] \
  1228.   && sed -i '/extensions.installCache/d' "${file}"
  1229. #--- For extensions that just work without restarting
  1230. timeout 15 firefox >/dev/null 2>&1
  1231. timeout 5 killall -9 -q -w firefox-esr >/dev/null
  1232. sleep 3s
  1233. #--- For (most) extensions, as they need firefox to restart
  1234. timeout 15 firefox >/dev/null 2>&1
  1235. timeout 5 killall -9 -q -w firefox-esr >/dev/null
  1236. sleep 5s
  1237. #--- Wipe session (due to force close)
  1238. find ~/.mozilla/firefox/*.default*/ -maxdepth 1 -type f -name 'sessionstore.*' -delete
  1239. #--- Configure foxyproxy
  1240. file=$(find ~/.mozilla/firefox/*.default*/ -maxdepth 1 -type f -name 'foxyproxy.xml' -print -quit)   #&& [ -e "${file}" ] && cp -n $file{,.bkup}
  1241. if [[ -z "${file}" ]]; then
  1242.   echo -e ' '${RED}'[!]'${RESET}' Something went wrong with the FoxyProxy firefox extension (did any extensions install?). Skipping...' 1>&2
  1243. else     # Create new
  1244.   echo -ne '<?xml version="1.0" encoding="UTF-8"?>\n<foxyproxy mode="disabled" selectedTabIndex="0" toolbaricon="true" toolsMenu="true" contextMenu="false" advancedMenus="false" previousMode="disabled" resetIconColors="true" useStatusBarPrefix="true" excludePatternsFromCycling="false" excludeDisabledFromCycling="false" ignoreProxyScheme="false" apiDisabled="false" proxyForVersionCheck=""><random includeDirect="false" includeDisabled="false"/><statusbar icon="true" text="false" left="options" middle="cycle" right="contextmenu" width="0"/><toolbar left="options" middle="cycle" right="contextmenu"/><logg enabled="false" maxSize="500" noURLs="false" header="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;\n&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;&lt;link rel=&quot;icon&quot; href=&quot;http://getfoxyproxy.org/favicon.ico&quot;/&gt;&lt;link rel=&quot;shortcut icon&quot; href=&quot;http://getfoxyproxy.org/favicon.ico&quot;/&gt;&lt;link rel=&quot;stylesheet&quot; href=&quot;http://getfoxyproxy.org/styles/log.css&quot; type=&quot;text/css&quot;/&gt;&lt;/head&gt;&lt;body&gt;&lt;table class=&quot;log-table&quot;&gt;&lt;thead&gt;&lt;tr&gt;&lt;td class=&quot;heading&quot;&gt;${timestamp-heading}&lt;/td&gt;&lt;td class=&quot;heading&quot;&gt;${url-heading}&lt;/td&gt;&lt;td class=&quot;heading&quot;&gt;${proxy-name-heading}&lt;/td&gt;&lt;td class=&quot;heading&quot;&gt;${proxy-notes-heading}&lt;/td&gt;&lt;td class=&quot;heading&quot;&gt;${pattern-name-heading}&lt;/td&gt;&lt;td class=&quot;heading&quot;&gt;${pattern-heading}&lt;/td&gt;&lt;td class=&quot;heading&quot;&gt;${pattern-case-heading}&lt;/td&gt;&lt;td class=&quot;heading&quot;&gt;${pattern-type-heading}&lt;/td&gt;&lt;td class=&quot;heading&quot;&gt;${pattern-color-heading}&lt;/td&gt;&lt;td class=&quot;heading&quot;&gt;${pac-result-heading}&lt;/td&gt;&lt;td class=&quot;heading&quot;&gt;${error-msg-heading}&lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tfoot&gt;&lt;tr&gt;&lt;td/&gt;&lt;/tr&gt;&lt;/tfoot&gt;&lt;tbody&gt;" row="&lt;tr&gt;&lt;td class=&quot;timestamp&quot;&gt;${timestamp}&lt;/td&gt;&lt;td class=&quot;url&quot;&gt;&lt;a href=&quot;${url}&quot;&gt;${url}&lt;/a&gt;&lt;/td&gt;&lt;td class=&quot;proxy-name&quot;&gt;${proxy-name}&lt;/td&gt;&lt;td class=&quot;proxy-notes&quot;&gt;${proxy-notes}&lt;/td&gt;&lt;td class=&quot;pattern-name&quot;&gt;${pattern-name}&lt;/td&gt;&lt;td class=&quot;pattern&quot;&gt;${pattern}&lt;/td&gt;&lt;td class=&quot;pattern-case&quot;&gt;${pattern-case}&lt;/td&gt;&lt;td class=&quot;pattern-type&quot;&gt;${pattern-type}&lt;/td&gt;&lt;td class=&quot;pattern-color&quot;&gt;${pattern-color}&lt;/td&gt;&lt;td class=&quot;pac-result&quot;&gt;${pac-result}&lt;/td&gt;&lt;td class=&quot;error-msg&quot;&gt;${error-msg}&lt;/td&gt;&lt;/tr&gt;" footer="&lt;/tbody&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;"/><warnings/><autoadd enabled="false" temp="false" reload="true" notify="true" notifyWhenCanceled="true" prompt="true"><match enabled="true" name="Dynamic AutoAdd Pattern" pattern="*://${3}${6}/*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false"/><match enabled="true" name="" pattern="*You are not authorized to view this page*" isRegEx="false" isBlackList="false" isMultiLine="true" caseSensitive="false" fromSubscription="false"/></autoadd><quickadd enabled="false" temp="false" reload="true" notify="true" notifyWhenCanceled="true" prompt="true"><match enabled="true" name="Dynamic QuickAdd Pattern" pattern="*://${3}${6}/*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false"/></quickadd><defaultPrefs origPrefetch="null"/><proxies>' > "${file}"
  1245.   echo -ne '<proxy name="localhost:8080" id="1145138293" notes="e.g. Burp, w3af" fromSubscription="false" enabled="true" mode="manual" selectedTabIndex="0" lastresort="false" animatedIcons="true" includeInCycle="false" color="#07753E" proxyDNS="true" noInternalIPs="false" autoconfMode="pac" clearCacheBeforeUse="true" disableCache="true" clearCookiesBeforeUse="false" rejectCookies="false"><matches/><autoconf url="" loadNotification="true" errorNotification="true" autoReload="false" reloadFreqMins="60" disableOnBadPAC="true"/><autoconf url="http://wpad/wpad.dat" loadNotification="true" errorNotification="true" autoReload="false" reloadFreqMins="60" disableOnBadPAC="true"/><manualconf host="127.0.0.1" port="8080" socksversion="5" isSocks="false" username="" password="" domain=""/></proxy>' >> "${file}"
  1246.   echo -ne '<proxy name="localhost:8081 (socket5)" id="212586674" notes="e.g. SSH" fromSubscription="false" enabled="true" mode="manual" selectedTabIndex="0" lastresort="false" animatedIcons="true" includeInCycle="false" color="#917504" proxyDNS="true" noInternalIPs="false" autoconfMode="pac" clearCacheBeforeUse="true" disableCache="true" clearCookiesBeforeUse="false" rejectCookies="false"><matches/><autoconf url="" loadNotification="true" errorNotification="true" autoReload="false" reloadFreqMins="60" disableOnBadPAC="true"/><autoconf url="http://wpad/wpad.dat" loadNotification="true" errorNotification="true" autoReload="false" reloadFreqMins="60" disableOnBadPAC="true"/><manualconf host="127.0.0.1" port="8081" socksversion="5" isSocks="true" username="" password="" domain=""/></proxy>' >> "${file}"
  1247.   echo -ne '<proxy name="No Caching" id="3884644610" notes="" fromSubscription="false" enabled="true" mode="system" selectedTabIndex="0" lastresort="false" animatedIcons="true" includeInCycle="false" color="#990DA6" proxyDNS="true" noInternalIPs="false" autoconfMode="pac" clearCacheBeforeUse="true" disableCache="true" clearCookiesBeforeUse="false" rejectCookies="false"><matches/><autoconf url="" loadNotification="true" errorNotification="true" autoReload="false" reloadFreqMins="60" disableOnBadPAC="true"/><autoconf url="http://wpad/wpad.dat" loadNotification="true" errorNotification="true" autoReload="false" reloadFreqMins="60" disableOnBadPAC="true"/><manualconf host="" port="" socksversion="5" isSocks="false" username="" password="" domain=""/></proxy>' >> "${file}"
  1248.   echo -ne '<proxy name="Default" id="3377581719" notes="" fromSubscription="false" enabled="true" mode="direct" selectedTabIndex="0" lastresort="true" animatedIcons="false" includeInCycle="true" color="#0055E5" proxyDNS="true" noInternalIPs="false" autoconfMode="pac" clearCacheBeforeUse="false" disableCache="false" clearCookiesBeforeUse="false" rejectCookies="false"><matches><match enabled="true" name="All" pattern="*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false"/></matches><autoconf url="" loadNotification="true" errorNotification="true" autoReload="false" reloadFreqMins="60" disableOnBadPAC="true"/><autoconf url="http://wpad/wpad.dat" loadNotification="true" errorNotification="true" autoReload="false" reloadFreqMins="60" disableOnBadPAC="true"/><manualconf host="" port="" socksversion="5" isSocks="false" username="" password=""/></proxy>' >> "${file}"
  1249.   echo -e '</proxies></foxyproxy>' >> "${file}"
  1250. fi
  1251.  
  1252.  
  1253. ##### Install conky
  1254. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}conky${RESET} ~ GUI desktop monitor"
  1255. export DISPLAY=:0.0
  1256. apt -y -qq install conky \
  1257.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1258. #--- Configure conky
  1259. file=~/.conkyrc; [ -e "${file}" ] && cp -n $file{,.bkup}
  1260. if [[ -f "${file}" ]]; then
  1261.   echo -e ' '${RED}'[!]'${RESET}" ${file} detected. Skipping..." 1>&2
  1262. else
  1263.   touch $file
  1264.   cat <<EOF > "${file}"
  1265. --# Useful: http://forums.opensuse.org/english/get-technical-help-here/how-faq-forums/unreviewed-how-faq/464737-easy-configuring-conky-conkyconf.html
  1266. conky.config = {
  1267.     background = false,
  1268.  
  1269.     font = 'monospace:size=8:weight=bold',
  1270.     use_xft = true,
  1271.  
  1272.     update_interval = 2.0,
  1273.  
  1274.     own_window = true,
  1275.     own_window_type = 'normal',
  1276.     own_window_transparent = true,
  1277.     own_window_class = 'conky-semi',
  1278.     own_window_argb_visual = false,
  1279.     own_window_colour = 'brown',
  1280.     own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
  1281.  
  1282.     double_buffer = true,
  1283.     maximum_width = 260,
  1284.  
  1285.     draw_shades = true,
  1286.     draw_outline = false,
  1287.     draw_borders = false,
  1288.  
  1289.     stippled_borders = 3,
  1290.     border_inner_margin = 9,
  1291.     border_width = 10,
  1292.  
  1293.     default_color = 'grey',
  1294.  
  1295.     alignment = 'bottom_right',
  1296.     gap_x = 5,
  1297.     gap_y = 0,
  1298.  
  1299.     uppercase = false,
  1300.     use_spacer = 'right',
  1301. };
  1302.  
  1303. conky.text = [[
  1304. \${color dodgerblue3}SYSTEM \${hr 2}\$color
  1305. #\${color white}\${time %A},\${time %e} \${time %B} \${time %G}\${alignr}\${time %H:%M:%S}
  1306. \${color white}Host\$color: \$nodename  \${alignr}\${color white}Uptime\$color: \$uptime
  1307.  
  1308. \${color dodgerblue3}CPU \${hr 2}\$color
  1309. #\${font Arial:bold:size=8}\${execi 99999 grep "model name" -m1 /proc/cpuinfo | cut -d":" -f2 | cut -d" " -f2- | sed "s#Processor ##"}\$font\$color
  1310. \${color white}MHz\$color: \${freq} \${alignr}\${color white}Load\$color: \${exec uptime | awk -F "load average: "  '{print \$2}'}
  1311. \${color white}Tasks\$color: \$running_processes/\$processes \${alignr}\${color white}CPU0\$color: \${cpu cpu0}% \${color white}CPU1\$color: \${cpu cpu1}%
  1312. #\${color #c0ff3e}\${acpitemp}C
  1313. #\${execi 20 sensors |grep "Core0 Temp" | cut -d" " -f4}\$font\$color\${alignr}\${freq_g 2} \${execi 20 sensors |grep "Core1 Temp" | cut -d" " -f4}
  1314. \${cpugraph cpu0 25,120 000000 white} \${alignr}\${cpugraph cpu1 25,120 000000 white}
  1315. \${color white}\${cpubar cpu1 3,120} \${alignr}\${color white}\${cpubar cpu2 3,120}\$color
  1316.  
  1317. \${color dodgerblue3}PROCESSES \${hr 2}\$color
  1318. \${color white}NAME             PID     CPU     MEM
  1319. \${color white}\${top name 1}\${top pid 1}  \${top cpu 1}  \${top mem 1}\$color
  1320. \${top name 2}\${top pid 2}  \${top cpu 2}  \${top mem 2}
  1321. \${top name 3}\${top pid 3}  \${top cpu 3}  \${top mem 3}
  1322. \${top name 4}\${top pid 4}  \${top cpu 4}  \${top mem 4}
  1323. \${top name 5}\${top pid 5}  \${top cpu 5}  \${top mem 5}
  1324.  
  1325. \${color dodgerblue3}MEMORY & SWAP \${hr 2}\$color
  1326. \${color white}RAM\$color  \$alignr\$memperc%  \${membar 6,170}\$color
  1327. \${color white}Swap\$color  \$alignr\$swapperc%  \${swapbar 6,170}\$color
  1328.  
  1329. \${color dodgerblue3}FILESYSTEM \${hr 2}\$color
  1330. \${color white}root\$color \${fs_free_perc /}% free\${alignr}\${fs_free /}/ \${fs_size /}
  1331. \${fs_bar 3 /}\$color
  1332. #\${color white}home\$color \${fs_free_perc /home}% free\${alignr}\${fs_free /home}/ \${fs_size /home}
  1333. #\${fs_bar 3 /home}\$color
  1334.  
  1335. \${color dodgerblue3}LAN eth0 (\${addr eth0}) \${hr 2}\$color
  1336. \${color white}Down\$color:  \${downspeed eth0} KB/s\${alignr}\${color white}Up\$color: \${upspeed eth0} KB/s
  1337. \${color white}Downloaded\$color: \${totaldown eth0} \${alignr}\${color white}Uploaded\$color: \${totalup eth0}
  1338. \${downspeedgraph eth0 25,120 000000 00ff00} \${alignr}\${upspeedgraph eth0 25,120 000000 ff0000}\$color
  1339.  
  1340. EOF
  1341. ip addr show eth1 &>/dev/null \
  1342.  && cat <<EOF >> "${file}"
  1343. \${color dodgerblue3}LAN eth1 (\${addr eth1}) \${hr 2}\$color
  1344. \${color white}Down\$color:  \${downspeed eth1} KB/s\${alignr}\${color white}Up\$color: \${upspeed eth1} KB/s
  1345. \${color white}Downloaded\$color: \${totaldown eth1} \${alignr}\${color white}Uploaded\$color: \${totalup eth1}
  1346. \${downspeedgraph eth1 25,120 000000 00ff00} \${alignr}\${upspeedgraph eth1 25,120 000000 ff0000}\$color
  1347.  
  1348. EOF
  1349. cat <<EOF >> "${file}"
  1350. \${color dodgerblue3}Wi-Fi (\${addr wlan0}) \${hr 2}\$color
  1351. \${color white}Down\$color:  \${downspeed wlan0} KB/s\${alignr}\${color white}Up\$color: \${upspeed wlan0} KB/s
  1352. \${color white}Downloaded\$color: \${totaldown wlan0} \${alignr}\${color white}Uploaded\$color: \${totalup wlan0}
  1353. \${downspeedgraph wlan0 25,120 000000 00ff00} \${alignr}\${upspeedgraph wlan0 25,120 000000 ff0000}\$color
  1354.  
  1355. \${color dodgerblue3}CONNECTIONS \${hr 2}\$color
  1356. \${color white}Inbound: \$color\${tcp_portmon 1 32767 count}  \${alignc}\${color white}Outbound: \$color\${tcp_portmon 32768 61000 count}\${alignr}\${color white}Total: \$color\${tcp_portmon 1 65535 count}
  1357. \${color white}Inbound \${alignr}Local Service/Port\$color
  1358. \$color \${tcp_portmon 1 32767 rhost 0} \${alignr}\${tcp_portmon 1 32767 lservice 0}
  1359. \$color \${tcp_portmon 1 32767 rhost 1} \${alignr}\${tcp_portmon 1 32767 lservice 1}
  1360. \$color \${tcp_portmon 1 32767 rhost 2} \${alignr}\${tcp_portmon 1 32767 lservice 2}
  1361. \${color white}Outbound \${alignr}Remote Service/Port\$color
  1362. \$color \${tcp_portmon 32768 61000 rhost 0} \${alignr}\${tcp_portmon 32768 61000 rservice 0}
  1363. \$color \${tcp_portmon 32768 61000 rhost 1} \${alignr}\${tcp_portmon 32768 61000 rservice 1}
  1364. \$color \${tcp_portmon 32768 61000 rhost 2} \${alignr}\${tcp_portmon 32768 61000 rservice 2}
  1365. ]]
  1366. EOF
  1367. fi
  1368. #--- Create start script
  1369. file=/usr/local/bin/start-conky; [ -e "${file}" ] && cp -n $file{,.bkup}
  1370. touch $file
  1371. cat <<EOF > "${file}" \
  1372.  || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  1373. #!/bin/bash
  1374.  
  1375. [[ -z \${DISPLAY} ]] && export DISPLAY=:0.0
  1376.  
  1377. $(which timeout) 10 $(which killall) -9 -q -w conky
  1378. $(which sleep) 20s
  1379. $(which conky) &
  1380. EOF
  1381. chmod -f 0500 "${file}"
  1382. #--- Run now
  1383. bash /usr/local/bin/start-conky >/dev/null 2>&1 &
  1384. #--- Add to startup (each login)
  1385. mkdir -p ~/.config/autostart/
  1386. file=~/.config/autostart/conkyscript.desktop; [ -e "${file}" ] && cp -n $file{,.bkup}
  1387. touch $file
  1388. cat <<EOF > "${file}" \
  1389.  || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  1390. [Desktop Entry]
  1391. Name=conky
  1392. Exec=/usr/local/bin/start-conky
  1393. Hidden=false
  1394. NoDisplay=false
  1395. X-GNOME-Autostart-enabled=true
  1396. Type=Application
  1397. Comment=
  1398. EOF
  1399. #--- Add keyboard shortcut (CTRL+r) to run the conky refresh script
  1400. file=~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml   #; [ -e "${file}" ] && cp -n $file{,.bkup}
  1401. if [ -e "${file}" ]; then
  1402.  grep -q '<property name="&lt;Primary&gt;r" type="string" value="/usr/local/bin/start-conky"/>' "${file}" \
  1403.    || sed -i 's#<property name="\&lt;Alt\&gt;F2" type="string" value="xfrun4"/>#<property name="\&lt;Alt\&gt;F2" type="string" value="xfrun4"/>\n      <property name="\&lt;Primary\&gt;r" type="string" value="/usr/local/bin/start-conky"/>#' "${file}"
  1404. fi
  1405.  
  1406.  
  1407. ##### Install metasploit ~ http://docs.kali.org/general-use/starting-metasploit-framework-in-kali
  1408. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}metasploit${RESET} ~ exploit framework"
  1409. apt -y -qq install metasploit-framework \
  1410.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1411. mkdir -p ~/.msf4/modules/{auxiliary,exploits,payloads,post}/
  1412. #--- ASCII art
  1413. #export GOCOW=1   # Always a cow logo ;)   Others: THISISHALLOWEEN (Halloween), APRILFOOLSPONIES (My Little Pony)
  1414. #file=~/.bashrc; [ -e "${file}" ] && cp -n $file{,.bkup}
  1415. #([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  1416. #grep -q '^GOCOW' "${file}" 2>/dev/null || echo 'GOCOW=1' >> "${file}"
  1417. #--- Fix any port issues
  1418. file=$(find /etc/postgresql/*/main/ -maxdepth 1 -type f -name postgresql.conf -print -quit);
  1419. [ -e "${file}" ] && cp -n $file{,.bkup}
  1420. sed -i 's/port = .* #/port = 5432 /' "${file}"
  1421. #--- Fix permissions - 'could not translate host name "localhost", service "5432" to address: Name or service not known'
  1422. chmod 0644 /etc/hosts
  1423. #--- Start services
  1424. systemctl stop postgresql
  1425. systemctl start postgresql
  1426. msfdb reinit
  1427. sleep 5s
  1428. #--- Autorun Metasploit commands each startup
  1429. file=~/.msf4/msf_autorunscript.rc; [ -e "${file}" ] && cp -n $file{,.bkup}
  1430. if [[ -f "${file}" ]]; then
  1431.   echo -e ' '${RED}'[!]'${RESET}" ${file} detected. Skipping..." 1>&2
  1432. else
  1433.   touch $file
  1434.   cat <<EOF > "${file}"
  1435. #run post/windows/escalate/getsystem
  1436.  
  1437. #run migrate -f -k
  1438. #run migrate -n "explorer.exe" -k    # Can trigger AV alerts by touching explorer.exe...
  1439.  
  1440. #run post/windows/manage/smart_migrate
  1441. #run post/windows/gather/smart_hashdump
  1442. EOF
  1443. fi
  1444. file=~/.msf4/msfconsole.rc; [ -e "${file}" ] && cp -n $file{,.bkup}
  1445. if [[ -f "${file}" ]]; then
  1446.   echo -e ' '${RED}'[!]'${RESET}" ${file} detected. Skipping..." 1>&2
  1447. else
  1448.   touch $file
  1449.   cat <<EOF > "${file}"
  1450. load auto_add_route
  1451.  
  1452. load alias
  1453. alias del rm
  1454. alias handler use exploit/multi/handler
  1455.  
  1456. load sounds
  1457.  
  1458. setg TimestampOutput true
  1459. setg VERBOSE true
  1460.  
  1461. setg ExitOnSession false
  1462. setg EnableStageEncoding true
  1463. setg LHOST 0.0.0.0
  1464. setg LPORT 443
  1465. EOF
  1466. #use exploit/multi/handler
  1467. #setg AutoRunScript 'multi_console_command -rc "~/.msf4/msf_autorunscript.rc"'
  1468. #set PAYLOAD windows/meterpreter/reverse_https
  1469. fi
  1470. #--- Aliases time
  1471. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  1472. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  1473. #--- Aliases for console
  1474. grep -q '^alias msfc=' "${file}" 2>/dev/null \
  1475.   || echo -e 'alias msfc="systemctl start postgresql; msfdb start; msfconsole -q \"\$@\""' >> "${file}"
  1476. grep -q '^alias msfconsole=' "${file}" 2>/dev/null \
  1477.   || echo -e 'alias msfconsole="systemctl start postgresql; msfdb start; msfconsole \"\$@\""\n' >> "${file}"
  1478. #--- Aliases to speed up msfvenom (create static output)
  1479. grep -q "^alias msfvenom-list-all" "${file}" 2>/dev/null \
  1480.   || echo "alias msfvenom-list-all='cat ~/.msf4/msfvenom/all'" >> "${file}"
  1481. grep -q "^alias msfvenom-list-nops" "${file}" 2>/dev/null \
  1482.   || echo "alias msfvenom-list-nops='cat ~/.msf4/msfvenom/nops'" >> "${file}"
  1483. grep -q "^alias msfvenom-list-payloads" "${file}" 2>/dev/null \
  1484.   || echo "alias msfvenom-list-payloads='cat ~/.msf4/msfvenom/payloads'" >> "${file}"
  1485. grep -q "^alias msfvenom-list-encoders" "${file}" 2>/dev/null \
  1486.   || echo "alias msfvenom-list-encoders='cat ~/.msf4/msfvenom/encoders'" >> "${file}"
  1487. grep -q "^alias msfvenom-list-formats" "${file}" 2>/dev/null \
  1488.   || echo "alias msfvenom-list-formats='cat ~/.msf4/msfvenom/formats'" >> "${file}"
  1489. grep -q "^alias msfvenom-list-generate" "${file}" 2>/dev/null \
  1490.   || echo "alias msfvenom-list-generate='_msfvenom-list-generate'" >> "${file}"
  1491. grep -q "^function _msfvenom-list-generate" "${file}" 2>/dev/null \
  1492.   || cat <<EOF >> "${file}" \
  1493.     || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  1494. function _msfvenom-list-generate {
  1495.   mkdir -p ~/.msf4/msfvenom/
  1496.   msfvenom --list > ~/.msf4/msfvenom/all
  1497.   msfvenom --list nops > ~/.msf4/msfvenom/nops
  1498.   msfvenom --list payloads > ~/.msf4/msfvenom/payloads
  1499.   msfvenom --list encoders > ~/.msf4/msfvenom/encoders
  1500.   msfvenom --help-formats 2> ~/.msf4/msfvenom/formats
  1501. }
  1502. EOF
  1503. #--- Apply new aliases
  1504. source "${file}" || source ~/.zshrc
  1505. #--- Generate (Can't call alias)
  1506. mkdir -p ~/.msf4/msfvenom/
  1507. msfvenom --list > ~/.msf4/msfvenom/all
  1508. msfvenom --list nops > ~/.msf4/msfvenom/nops
  1509. msfvenom --list payloads > ~/.msf4/msfvenom/payloads
  1510. msfvenom --list encoders > ~/.msf4/msfvenom/encoders
  1511. msfvenom --help-formats 2> ~/.msf4/msfvenom/formats
  1512. #--- First time run with Metasploit
  1513. (( STAGE++ )); echo -e " ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) ${GREEN}Starting Metasploit for the first time${RESET} ~ this ${BOLD}will take a ~350 seconds${RESET} (~6 mintues)"
  1514. echo "Started at: $(date)"
  1515. systemctl start postgresql
  1516. msfdb start
  1517. msfconsole -q -x 'version;db_status;sleep 310;exit'
  1518.  
  1519.  
  1520. ##### Configuring armitage
  1521. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring ${GREEN}armitage${RESET} ~ GUI Metasploit UI"
  1522. export MSF_DATABASE_CONFIG=/usr/share/metasploit-framework/config/database.yml
  1523. for file in /etc/bash.bashrc ~/.zshrc; do     #~/.bashrc
  1524.   [ ! -e "${file}" ] && continue
  1525.   [ -e "${file}" ] && cp -n $file{,.bkup}
  1526.   ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  1527.   grep -q 'MSF_DATABASE_CONFIG' "${file}" 2>/dev/null \
  1528.     || echo -e 'MSF_DATABASE_CONFIG=/usr/share/metasploit-framework/config/database.yml\n' >> "${file}"
  1529. done
  1530. #--- Test
  1531. #msfrpcd -U msf -P test -f -S -a 127.0.0.1
  1532.  
  1533.  
  1534. ##### Install exe2hex
  1535. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}exe2hex${RESET} ~ Inline file transfer"
  1536. apt -y -qq install exe2hexbat \
  1537.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1538.  
  1539.  
  1540. ##### Install MPC
  1541. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}MPC${RESET} ~ Msfvenom Payload Creator"
  1542. apt -y -qq install msfpc \
  1543.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1544.  
  1545.  
  1546. ###### Install atom
  1547. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}atom${RESET} ~ GUI text editor"
  1548. timeout 300 curl --progress -k -L -f "https://atom.io/download/deb" > /tmp/atom.deb \
  1549.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading atom.deb" 1>&2
  1550. if [ -e /tmp/atom.deb ]; then
  1551.   dpkg -i /tmp/atom.deb
  1552.   #--- Create config file
  1553.   mkdir -p ~/.atom/
  1554.   file=~/.atom/config.cson
  1555.   if [[ -f "${file}" ]]; then
  1556.     echo -e ' '${RED}'[!]'${RESET}" ${file} detected. Skipping..." 1>&2
  1557.   else
  1558.     cat <<EOF > "${file}"
  1559. "*":
  1560.   welcome:
  1561.     showOnStartup: false
  1562.   core:
  1563.     disabledPackages: [
  1564.       "metrics"
  1565.     ]
  1566. EOF
  1567.   fi
  1568.   #--- Add to panel (GNOME)
  1569.   export DISPLAY=:0.0
  1570.   [[ $(which gnome-shell) ]] \
  1571.     && gsettings set org.gnome.shell favorite-apps "$(gsettings get org.gnome.shell favorite-apps | sed "s/'org.gnome.gedit.desktop'/'atom.desktop'/")"
  1572. fi
  1573.  
  1574.  
  1575. ##### Install PyCharm (Community Edition)
  1576. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}PyCharm (Community Edition)${RESET} ~ Python IDE"
  1577. timeout 300 curl --progress -k -L -f "https://download.jetbrains.com/python/pycharm-community-2016.1.1.tar.gz" > /tmp/pycharms-community.tar.gz \
  1578.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading pycharms-community.tar.gz" 1>&2       #***!!! hardcoded version!
  1579. if [ -e /tmp/pycharms-community.tar.gz ]; then
  1580.   tar -xf /tmp/pycharms-community.tar.gz -C /tmp/
  1581.   rm -rf /opt/pycharms/
  1582.   mv -f /tmp/pycharm-community-*/ /opt/pycharms
  1583.   ln -sf /opt/pycharms/bin/pycharm.sh /usr/local/bin/pycharms
  1584. fi
  1585.  
  1586.  
  1587. ##### Install wdiff
  1588. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}wdiff${RESET} ~ Compares two files word by word"
  1589. apt -y -qq install wdiff wdiff-doc \
  1590.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1591.  
  1592.  
  1593. ##### Install meld
  1594. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}meld${RESET} ~ GUI text compare"
  1595. apt -y -qq install meld \
  1596.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1597. #--- Configure meld
  1598. gconftool-2 -t bool -s /apps/meld/show_line_numbers true
  1599. gconftool-2 -t bool -s /apps/meld/show_whitespace true
  1600. gconftool-2 -t bool -s /apps/meld/use_syntax_highlighting true
  1601. gconftool-2 -t int -s /apps/meld/edit_wrap_lines 2
  1602.  
  1603.  
  1604. ##### Install vbindiff
  1605. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}vbindiff${RESET} ~ visually compare binary files"
  1606. apt -y -qq install vbindiff \
  1607.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1608.  
  1609.  
  1610. ##### Install OpenVAS
  1611. if [[ "${openVAS}" != "false" ]]; then
  1612.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}OpenVAS${RESET} ~ vulnerability scanner"
  1613.   apt -y -qq install openvas \
  1614.     || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1615.   openvas-setup
  1616.   #--- Bug fix (target credentials creation)
  1617.   mkdir -p /var/lib/openvas/gnupg/
  1618.   #--- Bug fix (keys)
  1619.   curl --progress -k -L -f "http://www.openvas.org/OpenVAS_TI.asc" | gpg --import - \
  1620.     || echo -e ' '${RED}'[!]'${RESET}" Issue downloading OpenVAS_TI.asc" 1>&2
  1621.   #--- Make sure all services are correct
  1622.   openvas-start
  1623.   #--- User control
  1624.   username="root"
  1625.   password="toor"
  1626.   (openvasmd --get-users | grep -q ^admin$) \
  1627.     && echo -n 'admin user: ' \
  1628.     && openvasmd --delete-user=admin
  1629.   (openvasmd --get-users | grep -q "^${username}$") \
  1630.     || (echo -n "${username} user: "; openvasmd --create-user="${username}"; openvasmd --user="${username}" --new-password="${password}" >/dev/null)
  1631.   echo -e " ${YELLOW}[i]${RESET} OpenVAS username: ${username}"
  1632.   echo -e " ${YELLOW}[i]${RESET} OpenVAS password: ${password}   ***${BOLD}CHANGE THIS ASAP${RESET}***"
  1633.   echo -e " ${YELLOW}[i]${RESET} Run: # openvasmd --user=root --new-password='<NEW_PASSWORD>'"
  1634.   sleep 3s
  1635.   openvas-check-setup
  1636.   #--- Remove from start up
  1637.   systemctl disable openvas-manager
  1638.   systemctl disable openvas-scanner
  1639.   systemctl disable greenbone-security-assistant
  1640.   #--- Setup alias
  1641.   file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  1642.   grep -q '^## openvas' "${file}" 2>/dev/null \
  1643.     || echo -e '## openvas\nalias openvas="openvas-stop; openvas-start; sleep 3s; xdg-open https://127.0.0.1:9392/ >/dev/null 2>&1"\n' >> "${file}"
  1644.   source "${file}" || source ~/.zshrc
  1645. else
  1646.   echo -e "\n\n ${YELLOW}[i]${RESET} ${YELLOW}Skipping OpenVAS${RESET} (missing: '$0 ${BOLD}--openvas${RESET}')..." 1>&2
  1647. fi
  1648.  
  1649.  
  1650. ##### Install vFeed
  1651. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}vFeed${RESET} ~ vulnerability database"
  1652. apt -y -qq install vfeed \
  1653.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1654.  
  1655.  
  1656. ##### Install Burp Suite
  1657. if [[ "${burpFree}" != "false" ]]; then
  1658.   (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Burp Suite (Community Edition)${RESET} ~ web application proxy"
  1659.   apt -y -qq install burpsuite curl \
  1660.     || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1661.   mkdir -p ~/.java/.userPrefs/burp/
  1662.   file=~/.java/.userPrefs/burp/prefs.xml;   #[ -e "${file}" ] && cp -n $file{,.bkup}
  1663.   [ -e "${file}" ] \
  1664.     || cat <<EOF > "${file}"
  1665. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1666. <!DOCTYPE map SYSTEM "http://java.sun.com/dtd/preferences.dtd" >
  1667. <map MAP_XML_VERSION="1.0">
  1668.   <entry key="eulafree" value="2"/>
  1669.   <entry key="free.suite.feedbackReportingEnabled" value="false"/>
  1670. </map>
  1671. EOF
  1672.   #--- Extract CA
  1673.   find /tmp/ -maxdepth 1 -name 'burp*.tmp' -delete
  1674.   export DISPLAY=:0.0
  1675.   timeout 120 burpsuite >/dev/null 2>&1 &
  1676.   PID=$!
  1677.   sleep 15s
  1678.   #echo "-----BEGIN CERTIFICATE-----" > /tmp/PortSwiggerCA \
  1679.   #  && awk -F '"' '/caCert/ {print $4}' ~/.java/.userPrefs/burp/prefs.xml | fold -w 64 >> /tmp/PortSwiggerCA \
  1680.   #  && echo "-----END CERTIFICATE-----" >> /tmp/PortSwiggerCA
  1681.   export http_proxy="http://127.0.0.1:8080"
  1682.   rm -f /tmp/burp.crt
  1683.   while test -d /proc/${PID}; do
  1684.     sleep 1s
  1685.     curl --progress -k -L -f "http://burp/cert" -o /tmp/burp.crt 2>/dev/null      # || echo -e ' '${RED}'[!]'${RESET}" Issue downloading burp.crt" 1>&2
  1686.     [ -f /tmp/burp.crt ] && break
  1687.   done
  1688.   timeout 5 kill ${PID} 2>/dev/null \
  1689.     || echo -e ' '${RED}'[!]'${RESET}" Failed to kill ${RED}burpsuite${RESET}"
  1690.   unset http_proxy
  1691.   #--- Installing CA
  1692.   if [[ -f /tmp/burp.crt ]]; then
  1693.     apt -y -qq install libnss3-tools \
  1694.       || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1695.     folder=$(find ~/.mozilla/firefox/ -maxdepth 1 -type d -name '*.default' -print -quit)
  1696.     certutil -A -n Burp -t "CT,c,c" -d "${folder}" -i /tmp/burp.crt
  1697.     timeout 15 firefox >/dev/null 2>&1
  1698.     timeout 5 killall -9 -q -w firefox-esr >/dev/null
  1699.     #mkdir -p /usr/share/ca-certificates/burp/
  1700.     #cp -f /tmp/burp.crt /usr/share/ca-certificates/burp/
  1701.     #dpkg-reconfigure ca-certificates    # Not automated
  1702.     echo -e " ${YELLOW}[i]${RESET} Installed ${YELLOW}Burp Suite CA${RESET}"
  1703.   else
  1704.     echo -e ' '${RED}'[!]'${RESET}' Did not install Burp Suite Certificate Authority (CA)' 1>&2
  1705.     echo -e ' '${RED}'[!]'${RESET}' Skipping...' 1>&2
  1706.   fi
  1707.   #--- Remove old temp files
  1708.   sleep 2s
  1709.   find /tmp/ -maxdepth 1 -name 'burp*.tmp' -delete 2>/dev/null
  1710.   find ~/.mozilla/firefox/*.default*/ -maxdepth 1 -type f -name 'sessionstore.*' -delete
  1711.   unset http_proxy
  1712. else
  1713.   echo -e "\n\n ${YELLOW}[i]${RESET} ${YELLOW}Skipping Burp Suite${RESET} (missing: '$0 ${BOLD}--burp${RESET}')..." 1>&2
  1714. fi
  1715.  
  1716.  
  1717. ##### Configure python console - all users
  1718. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring ${GREEN}python console${RESET} ~ tab complete & history support"
  1719. export PYTHONSTARTUP=$HOME/.pythonstartup
  1720. file=/etc/bash.bashrc; [ -e "${file}" ] && cp -n $file{,.bkup}   #~/.bashrc
  1721. grep -q PYTHONSTARTUP "${file}" \
  1722.   || echo 'export PYTHONSTARTUP=$HOME/.pythonstartup' >> "${file}"
  1723. #--- Python start up file
  1724. cat <<EOF > ~/.pythonstartup \
  1725.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  1726. import readline
  1727. import rlcompleter
  1728. import atexit
  1729. import os
  1730.  
  1731. ## Tab completion
  1732. readline.parse_and_bind('tab: complete')
  1733.  
  1734. ## History file
  1735. histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
  1736. try:
  1737.     readline.read_history_file(histfile)
  1738. except IOError:
  1739.     pass
  1740.  
  1741. atexit.register(readline.write_history_file, histfile)
  1742.  
  1743. ## Quit
  1744. del os, histfile, readline, rlcompleter
  1745. EOF
  1746. #--- Apply new configs
  1747. source "${file}" || source ~/.zshrc
  1748.  
  1749.  
  1750. ##### Install virtualenvwrapper
  1751. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}virtualenvwrapper${RESET} ~ virtual environment wrapper"
  1752. apt -y -qq install virtualenvwrapper \
  1753.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1754.  
  1755.  
  1756. ##### Install go
  1757. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}go${RESET} ~ programming language"
  1758. apt -y -qq install golang \
  1759.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1760.  
  1761.  
  1762. ##### Install gitg
  1763. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}gitg${RESET} ~ GUI git client"
  1764. apt -y -qq install gitg \
  1765.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1766.  
  1767.  
  1768. ##### Install sparta
  1769. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}sparta${RESET} ~ GUI automatic wrapper"
  1770. apt -y -qq install sparta \
  1771.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1772.  
  1773.  
  1774. ##### Install wireshark
  1775. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Wireshark${RESET} ~ GUI network protocol analyzer"
  1776. #--- Hide running as root warning
  1777. mkdir -p ~/.wireshark/
  1778. file=~/.wireshark/recent_common;   #[ -e "${file}" ] && cp -n $file{,.bkup}
  1779. [ -e "${file}" ] \
  1780.   || echo "privs.warn_if_elevated: FALSE" > "${file}"
  1781. #--- Disable lua warning
  1782. [ -e "/usr/share/wireshark/init.lua" ] \
  1783.   && mv -f /usr/share/wireshark/init.lua{,.disabled}
  1784.  
  1785.  
  1786. ##### Install silver searcher
  1787. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}silver searcher${RESET} ~ code searching"
  1788. apt -y -qq install silversearcher-ag \
  1789.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1790.  
  1791.  
  1792. ##### Install rips
  1793. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}rips${RESET} ~ source code scanner"
  1794. apt -y -qq install apache2 php5 git \
  1795.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1796. git clone -q -b master https://github.com/ripsscanner/rips.git /opt/rips-git/ \
  1797.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  1798. pushd /opt/rips-git/ >/dev/null
  1799. git pull -q
  1800. popd >/dev/null
  1801. #--- Add to path
  1802. file=/etc/apache2/conf-available/rips.conf
  1803. [ -e "${file}" ] \
  1804.   || cat <<EOF > "${file}"
  1805. Alias /rips /opt/rips-git
  1806.  
  1807. <Directory /opt/rips-git/ >
  1808.   Options FollowSymLinks
  1809.   AllowOverride None
  1810.   Order deny,allow
  1811.   Deny from all
  1812.   Allow from 127.0.0.0/255.0.0.0 ::1/128
  1813. </Directory>
  1814. EOF
  1815. ln -sf /etc/apache2/conf-available/rips.conf /etc/apache2/conf-enabled/rips.conf
  1816. systemctl restart apache2
  1817.  
  1818.  
  1819. ##### Install graudit
  1820. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}graudit${RESET} ~ source code auditing"
  1821. apt -y -qq install git \
  1822.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1823. git clone -q -b master https://github.com/wireghoul/graudit.git /opt/graudit-git/ \
  1824.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  1825. pushd /opt/graudit-git/ >/dev/null
  1826. git pull -q
  1827. popd >/dev/null
  1828. #--- Add to path
  1829. file=/usr/local/bin/graudit-git
  1830. cat <<EOF > "${file}" \
  1831.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  1832. #!/bin/bash
  1833.  
  1834. cd /opt/graudit-git/ && bash graudit.sh "\$@"
  1835. EOF
  1836. chmod +x "${file}"
  1837.  
  1838.  
  1839. ##### Install libreoffice
  1840. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}LibreOffice${RESET} ~ GUI office suite"
  1841. apt -y -qq install libreoffice \
  1842.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1843.  
  1844.  
  1845. ##### Install ipcalc & sipcalc
  1846. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}ipcalc${RESET} & ${GREEN}sipcalc${RESET} ~ CLI subnet calculators"
  1847. apt -y -qq install ipcalc sipcalc \
  1848.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1849.  
  1850.  
  1851. ##### Install asciinema
  1852. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}asciinema${RESET} ~ CLI terminal recorder"
  1853. curl -s -L https://asciinema.org/install | sh
  1854.  
  1855.  
  1856. ##### Install shutter
  1857. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}shutter${RESET} ~ GUI static screen capture"
  1858. apt -y -qq install shutter \
  1859.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1860.  
  1861.  
  1862. ##### Install psmisc ~ allows for 'killall command' to be used
  1863. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}psmisc${RESET} ~ suite to help with running processes"
  1864. apt -y -qq install psmisc \
  1865.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1866.  
  1867.  
  1868. ###### Setup pipe viewer
  1869. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}pipe viewer${RESET} ~ CLI progress bar"
  1870. apt -y -qq install pv \
  1871.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1872.  
  1873.  
  1874. ###### Setup pwgen
  1875. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}pwgen${RESET} ~ password generator"
  1876. apt -y -qq install pwgen \
  1877.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1878.  
  1879.  
  1880. ##### Install htop
  1881. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}htop${RESET} ~ CLI process viewer"
  1882. apt -y -qq install htop \
  1883.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1884.  
  1885.  
  1886. ##### Install powertop
  1887. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}powertop${RESET} ~ CLI power consumption viewer"
  1888. apt -y -qq install powertop \
  1889.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1890.  
  1891.  
  1892. ##### Install iotop
  1893. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}iotop${RESET} ~ CLI I/O usage"
  1894. apt -y -qq install iotop \
  1895.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1896.  
  1897.  
  1898. ##### Install ca-certificates
  1899. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}ca-certificates${RESET} ~ HTTPS/SSL/TLS"
  1900. apt -y -qq install ca-certificates \
  1901.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1902.  
  1903.  
  1904. ##### Install testssl
  1905. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}testssl${RESET} ~ Testing TLS/SSL encryption"
  1906. apt -y -qq install testssl.sh \
  1907.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1908.  
  1909.  
  1910. ##### Install UACScript
  1911. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}UACScript${RESET} ~ UAC Bypass for Windows 7"
  1912. apt -y -qq install git windows-binaries \
  1913.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1914. git clone -q -b master https://github.com/Vozzie/uacscript.git /opt/uacscript-git/ \
  1915.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  1916. pushd /opt/uacscript-git/ >/dev/null
  1917. git pull -q
  1918. popd >/dev/null
  1919. ln -sf /usr/share/windows-binaries/uac-win7 /opt/uacscript-git/
  1920.  
  1921.  
  1922. ##### Install MiniReverse_Shell_With_Parameters
  1923. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}MiniReverse_Shell_With_Parameters${RESET} ~ Generate shellcode for a reverse shell"
  1924. apt -y -qq install git windows-binaries \
  1925.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1926. git clone -q -b master https://github.com/xillwillx/MiniReverse_Shell_With_Parameters.git /opt/minireverse-shell-with-parameters-git/ \
  1927.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  1928. pushd /opt/minireverse-shell-with-parameters-git/ >/dev/null
  1929. git pull -q
  1930. popd >/dev/null
  1931. ln -sf /usr/share/windows-binaries/MiniReverse /opt/minireverse-shell-with-parameters-git/
  1932.  
  1933.  
  1934. ##### Install axel
  1935. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}axel${RESET} ~ CLI download manager"
  1936. apt -y -qq install axel \
  1937.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1938. #--- Setup alias
  1939. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  1940. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  1941. grep -q '^alias axel' "${file}" 2>/dev/null \
  1942.   || echo -e '## axel\nalias axel="axel -a"\n' >> "${file}"
  1943. #--- Apply new alias
  1944. source "${file}" || source ~/.zshrc
  1945.  
  1946.  
  1947. ##### Install html2text
  1948. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}html2text${RESET} ~ CLI html rendering"
  1949. apt -y -qq install html2text \
  1950.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1951.  
  1952.  
  1953. ##### Install tmux2html
  1954. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}tmux2html${RESET} ~ Render tmux as HTML"
  1955. apt -y -qq install git python python-pip \
  1956.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1957. pip install tmux2html
  1958.  
  1959.  
  1960. ##### Install gparted
  1961. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}GParted${RESET} ~ GUI partition manager"
  1962. apt -y -qq install gparted \
  1963.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1964.  
  1965.  
  1966. ##### Install daemonfs
  1967. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}daemonfs${RESET} ~ GUI file monitor"
  1968. apt -y -qq install daemonfs \
  1969.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1970.  
  1971.  
  1972. ##### Install filezilla
  1973. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}FileZilla${RESET} ~ GUI file transfer"
  1974. apt -y -qq install filezilla \
  1975.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  1976. #--- Configure filezilla
  1977. export DISPLAY=:0.0
  1978. timeout 5 filezilla >/dev/null 2>&1     # Start and kill. Files needed for first time run
  1979. mkdir -p ~/.config/filezilla/
  1980. file=~/.config/filezilla/filezilla.xml; [ -e "${file}" ] && cp -n $file{,.bkup}
  1981. [ ! -e "${file}" ] && cat <<EOF> "${file}"
  1982. <?xml version="1.0" encoding="UTF-8"?>
  1983. <FileZilla3 version="3.15.0.2" platform="*nix">
  1984.   <Settings>
  1985.     <Setting name="Default editor">0</Setting>
  1986.     <Setting name="Always use default editor">0</Setting>
  1987.   </Settings>
  1988. </FileZilla3>
  1989. fi
  1990. EOF
  1991. sed -i 's#^.*"Default editor".*#\t<Setting name="Default editor">2/usr/bin/gedit</Setting>#' "${file}"
  1992. [ -e /usr/bin/atom ] && sed -i 's#^.*"Default editor".*#\t<Setting name="Default editor">2/usr/bin/atom</Setting>#' "${file}"
  1993. sed -i 's#^.*"Always use default editor".*#\t<Setting name="Always use default editor">1</Setting>#' "${file}"
  1994.  
  1995.  
  1996. ##### Install ncftp
  1997. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}ncftp${RESET} ~ CLI FTP client"
  1998. apt -y -qq install ncftp \
  1999.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2000.  
  2001.  
  2002. ##### Install p7zip
  2003. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}p7zip${RESET} ~ CLI file extractor"
  2004. apt -y -qq install p7zip-full \
  2005.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2006.  
  2007.  
  2008. ##### Install zip & unzip
  2009. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}zip${RESET} & ${GREEN}unzip${RESET} ~ CLI file extractors"
  2010. apt -y -qq install zip unzip \
  2011.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2012.  
  2013.  
  2014. ##### Install file roller
  2015. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}file roller${RESET} ~ GUI file extractor"
  2016. apt -y -qq install file-roller \
  2017.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2018. apt -y -qq install unace unrar rar unzip zip p7zip p7zip-full p7zip-rar \
  2019.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2020.  
  2021.  
  2022. ##### Install VPN support
  2023. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}VPN${RESET} support for Network-Manager"
  2024. for FILE in network-manager-openvpn network-manager-pptp network-manager-vpnc network-manager-openconnect network-manager-iodine; do
  2025.   apt -y -qq install "${FILE}" \
  2026.     || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2027. done
  2028.  
  2029.  
  2030. ##### Install hashid
  2031. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}hashid${RESET} ~ identify hash types"
  2032. apt -y -qq install hashid \
  2033.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2034.  
  2035.  
  2036. ##### Install httprint
  2037. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}httprint${RESET} ~ GUI web server fingerprint"
  2038. apt -y -qq install httprint \
  2039.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2040.  
  2041.  
  2042. ##### Install lbd
  2043. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}lbd${RESET} ~ load balancing detector"
  2044. apt -y -qq install lbd \
  2045.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2046.  
  2047.  
  2048. ##### Install wafw00f
  2049. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}wafw00f${RESET} ~ WAF detector"
  2050. apt -y -qq install wafw00f \
  2051.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2052.  
  2053.  
  2054. ##### Install aircrack-ng
  2055. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Aircrack-ng${RESET} ~ Wi-Fi cracking suite"
  2056. apt -y -qq install aircrack-ng curl \
  2057.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2058. #--- Setup hardware database
  2059. mkdir -p /etc/aircrack-ng/
  2060. (timeout 600 airodump-ng-oui-update 2>/dev/null) \
  2061.   || timeout 600 curl --progress -k -L -f "http://standards.ieee.org/develop/regauth/oui/oui.txt" > /etc/aircrack-ng/oui.txt
  2062. [ -e /etc/aircrack-ng/oui.txt ] \
  2063.   && (\grep "(hex)" /etc/aircrack-ng/oui.txt | sed 's/^[ \t]*//g;s/[ \t]*$//g' > /etc/aircrack-ng/airodump-ng-oui.txt)
  2064. [[ ! -f /etc/aircrack-ng/airodump-ng-oui.txt ]] \
  2065.   && echo -e ' '${RED}'[!]'${RESET}" Issue downloading oui.txt" 1>&2
  2066. #--- Setup alias
  2067. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  2068. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  2069. grep -q '^## aircrack-ng' "${file}" 2>/dev/null \
  2070.   || echo -e '## aircrack-ng\nalias aircrack-ng="aircrack-ng -z"\n' >> "${file}"
  2071. grep -q '^## airodump-ng' "${file}" 2>/dev/null \
  2072.   || echo -e '## airodump-ng \nalias airodump-ng="airodump-ng --manufacturer --wps --uptime"\n' >> "${file}"    # aircrack-ng 1.2 rc2
  2073. #--- Apply new alias
  2074. source "${file}" || source ~/.zshrc
  2075.  
  2076.  
  2077. ##### Install reaver (community fork)
  2078. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}reaver (community fork)${RESET} ~ WPS pin brute force + Pixie Attack"
  2079. apt -y -qq install reaver pixiewps \
  2080.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2081.  
  2082.  
  2083. ##### Install bully
  2084. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}bully${RESET} ~ WPS pin brute force"
  2085. apt -y -qq install bully \
  2086.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2087.  
  2088.  
  2089. ##### Install wifite
  2090. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}wifite${RESET} ~ automated Wi-Fi tool"
  2091. apt -y -qq install wifite \
  2092.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2093.  
  2094.  
  2095. ##### Install vulscan script for nmap
  2096. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}vulscan script for nmap${RESET} ~ vulnerability scanner add-on"
  2097. apt -y -qq install nmap curl \
  2098.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2099. mkdir -p /usr/share/nmap/scripts/vulscan/
  2100. timeout 300 curl --progress -k -L -f "http://www.computec.ch/projekte/vulscan/download/nmap_nse_vulscan-2.0.tar.gz" > /tmp/nmap_nse_vulscan.tar.gz \
  2101.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading file" 1>&2      #***!!! hardcoded version! Need to manually check for updates
  2102. gunzip /tmp/nmap_nse_vulscan.tar.gz
  2103. tar -xf /tmp/nmap_nse_vulscan.tar -C /usr/share/nmap/scripts/
  2104. #--- Fix permissions (by default its 0777)
  2105. chmod -R 0755 /usr/share/nmap/scripts/; find /usr/share/nmap/scripts/ -type f -exec chmod 0644 {} \;
  2106.  
  2107.  
  2108. ##### Install unicornscan
  2109. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}unicornscan${RESET} ~ fast port scanner"
  2110. apt -y -qq install unicornscan \
  2111.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2112.  
  2113.  
  2114. ##### Install onetwopunch
  2115. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}onetwopunch${RESET} ~ unicornscan & nmap wrapper"
  2116. apt -y -qq install git nmap unicornscan \
  2117.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2118. git clone -q -b master https://github.com/superkojiman/onetwopunch.git /opt/onetwopunch-git/ \
  2119.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2120. pushd /opt/onetwopunch-git/ >/dev/null
  2121. git pull -q
  2122. popd >/dev/null
  2123. #--- Add to path
  2124. file=/usr/local/bin/onetwopunch-git
  2125. cat <<EOF > "${file}" \
  2126.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  2127. #!/bin/bash
  2128.  
  2129. cd /opt/onetwopunch-git/ && bash onetwopunch.sh "\$@"
  2130. EOF
  2131. chmod +x "${file}"
  2132.  
  2133.  
  2134. ##### Install Gnmap-Parser (fork)
  2135. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Gnmap-Parser (fork)${RESET} ~ Parse Nmap exports into various plain-text formats"
  2136. apt -y -qq install git \
  2137.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2138. git clone -q -b master https://github.com/nullmode/gnmap-parser.git /opt/gnmap-parser-git/ \
  2139.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2140. pushd /opt/gnmap-parser-git/ >/dev/null
  2141. git pull -q
  2142. popd >/dev/null
  2143. #--- Add to path
  2144. chmod +x /opt/gnmap-parser-git/gnmap-parser.sh
  2145. ln -sf /opt/gnmap-parser-git/gnmap-parser.sh /usr/local/bin/gnmap-parser-git
  2146.  
  2147.  
  2148. ##### Install udp-proto-scanner
  2149. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}udp-proto-scanner${RESET} ~ common UDP port scanner"
  2150. apt -y -qq install curl \
  2151.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2152. timeout 300 curl --progress -k -L -f "https://labs.portcullis.co.uk/download/udp-proto-scanner-1.1.tar.gz" -o /tmp/udp-proto-scanner.tar.gz \
  2153.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading udp-proto-scanner.tar.gz" 1>&2
  2154. gunzip /tmp/udp-proto-scanner.tar.gz
  2155. tar -xf /tmp/udp-proto-scanner.tar -C /opt/
  2156. mv -f /opt/udp-proto-scanner{-1.1,}
  2157. #--- Add to path
  2158. file=/usr/local/bin/udp-proto-scanner
  2159. cat <<EOF > "${file}" \
  2160.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  2161. #!/bin/bash
  2162.  
  2163. cd /opt/udp-proto-scanner/ && perl udp-proto-scanner.pl "\$@"
  2164. EOF
  2165. chmod +x "${file}"
  2166.  
  2167.  
  2168. ##### Install clusterd
  2169. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}clusterd${RESET} ~ clustered attack toolkit (JBoss, ColdFusion, WebLogic, Tomcat etc)"
  2170. apt -y -qq install clusterd \
  2171.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2172.  
  2173.  
  2174. ##### Install webhandler
  2175. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}webhandler${RESET} ~ shell TTY handler"
  2176. apt -y -qq install webhandler \
  2177.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2178. #--- Add to path
  2179. ln -sf /usr/bin/webhandler /usr/local/bin/wh
  2180.  
  2181.  
  2182. ##### Install azazel
  2183. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}azazel${RESET} ~ Linux userland rootkit"
  2184. apt -y -qq install git \
  2185.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2186. git clone -q -b master https://github.com/chokepoint/azazel.git /opt/azazel-git/ \
  2187.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2188. pushd /opt/azazel-git/ >/dev/null
  2189. git pull -q
  2190. popd >/dev/null
  2191.  
  2192.  
  2193. ##### Install Babadook
  2194. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Babadook${RESET} ~ connection-less powershell backdoor"
  2195. apt -y -qq install git \
  2196.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2197. git clone -q -b master https://github.com/jseidl/Babadook.git /opt/babadook-git/ \
  2198.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2199. pushd /opt/babadook-git/ >/dev/null
  2200. git pull -q
  2201. popd >/dev/null
  2202.  
  2203.  
  2204. ##### Install pupy
  2205. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}pupy${RESET} ~ Remote Administration Tool"
  2206. apt -y -qq install git \
  2207.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2208. git clone -q -b master https://github.com/n1nj4sec/pupy.git /opt/pupy-git/ \
  2209.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2210. pushd /opt/pupy-git/ >/dev/null
  2211. git pull -q
  2212. popd >/dev/null
  2213.  
  2214.  
  2215. ##### Install gobuster (https://bugs.kali.org/view.php?id=2438)
  2216. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}gobuster${RESET} ~ Directory/File/DNS busting tool"
  2217. apt -y -qq install git golang \
  2218.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2219. git clone -q -b master https://github.com/OJ/gobuster.git /opt/gobuster-git/ \
  2220.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2221. pushd /opt/gobuster-git/ >/dev/null
  2222. git pull -q
  2223. go build
  2224. popd >/dev/null
  2225. #--- Add to path
  2226. file=/usr/local/bin/gobuster-git
  2227. cat <<EOF > "${file}" \
  2228.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  2229. #!/bin/bash
  2230.  
  2231. cd /opt/gobuster-git/ && ./gobuster-git "\$@"
  2232. EOF
  2233. chmod +x "${file}"
  2234.  
  2235.  
  2236. ##### Install reGeorg
  2237. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}reGeorg${RESET} ~ pivot via web shells"
  2238. git clone -q -b master https://github.com/sensepost/reGeorg.git /opt/regeorg-git \
  2239.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2240. pushd /opt/regeorg-git/ >/dev/null
  2241. git pull -q
  2242. popd >/dev/null
  2243. #--- Link to others
  2244. apt -y -qq install webshells \
  2245.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2246. ln -sf /opt/reGeorg-git /usr/share/webshells/reGeorg
  2247.  
  2248.  
  2249. ##### Install b374k (https://bugs.kali.org/view.php?id=1097)
  2250. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}b374k${RESET} ~ (PHP) web shell"
  2251. apt -y -qq install git php5-cli \
  2252.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2253. git clone -q -b master https://github.com/b374k/b374k.git /opt/b374k-git/ \
  2254.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2255. pushd /opt/b374k-git/ >/dev/null
  2256. git pull -q
  2257. php index.php -o b374k.php -s
  2258. popd >/dev/null
  2259. #--- Link to others
  2260. apt -y -qq install webshells \
  2261.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2262. ln -sf /opt/b374k-git /usr/share/webshells/php/b374k
  2263.  
  2264.  
  2265. ##### Install adminer
  2266. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}adminer${RESET} ~ Database management in a single PHP file"
  2267. apt -y -qq install git \
  2268.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2269. git clone -q -b master https://github.com/vrana/adminer.git /opt/adminer-git/ \
  2270.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2271. pushd /opt/adminer-git/ >/dev/null
  2272. git pull -q
  2273. php compile.php 2>/dev/null
  2274. popd >/dev/null
  2275. #--- Link to others
  2276. apt -y -qq install webshells \
  2277.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2278. file=$(find /opt/adminer-git/ -name adminer-*.php -type f -print -quit)
  2279. ln -sf "${file}" /usr/share/webshells/php/adminer.php
  2280.  
  2281.  
  2282. ##### Install WeBaCoo
  2283. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}WeBaCoo${RESET} ~ Web backdoor cookie"
  2284. apt -y -qq install webacoo \
  2285.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2286.  
  2287.  
  2288. ##### Install cmdsql
  2289. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}cmdsql${RESET} ~ (ASPX) web shell"
  2290. apt -y -qq install git \
  2291.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2292. git clone -q -b master https://github.com/NetSPI/cmdsql.git /opt/cmdsql-git/ \
  2293.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2294. pushd /opt/cmdsql-git/ >/dev/null
  2295. git pull -q
  2296. popd >/dev/null
  2297. #--- Link to others
  2298. apt -y -qq install webshells \
  2299.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2300. ln -sf /opt/cmdsql-git /usr/share/webshells/aspx/cmdsql
  2301.  
  2302.  
  2303. ##### Install JSP file browser
  2304. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}JSP file browser${RESET} ~ (JSP) web shell"
  2305. apt -y -qq install curl \
  2306.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2307. mkdir -p /opt/jsp-filebrowser/
  2308. timeout 300 curl --progress -k -L -f "http://www.vonloesch.de/files/browser.zip" > /tmp/jsp.zip \
  2309.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading jsp.zip" 1>&2
  2310. unzip -q -o -d /opt/jsp-filebrowser/ /tmp/jsp.zip
  2311. #--- Link to others
  2312. apt -y -qq install webshells \
  2313.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2314. ln -sf /opt/jsp-filebrowser /usr/share/webshells/jsp/jsp-filebrowser
  2315.  
  2316.  
  2317. ##### Install htshells
  2318. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}htShells${RESET} ~ (htdocs/apache) web shells"
  2319. apt -y -qq install htshells \
  2320.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2321.  
  2322.  
  2323. ##### Install python-pty-shells
  2324. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}python-pty-shells${RESET} ~ PTY shells"
  2325. apt -y -qq install git \
  2326.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2327. git clone -q -b master https://github.com/infodox/python-pty-shells.git /opt/python-pty-shells-git/ \
  2328.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2329. pushd /opt/python-pty-shells-git/ >/dev/null
  2330. git pull -q
  2331. popd >/dev/null
  2332.  
  2333.  
  2334. ##### Install bridge-utils
  2335. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}bridge-utils${RESET} ~ Bridge network interfaces"
  2336. apt -y -qq install bridge-utils \
  2337.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2338.  
  2339.  
  2340. ##### Install FruityWifi
  2341. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}FruityWifi${RESET} ~ Wireless network auditing tool"
  2342. apt -y -qq install fruitywifi \
  2343.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2344. # URL: https://localhost:8443
  2345. if [[ -e /var/www/html/index.nginx-debian.html ]]; then
  2346.   grep -q '<title>Welcome to nginx on Debian!</title>' /var/www/html/index.nginx-debian.html \
  2347.     && echo 'Permission denied.' > /var/www/html/index.nginx-debian.html
  2348. fi
  2349.  
  2350.  
  2351. ##### Install WPA2-HalfHandshake-Crack
  2352. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}WPA2-HalfHandshake-Crack${RESET} ~ Rogue AP for handshakes without a AP"
  2353. apt -y -qq install git \
  2354.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2355. git clone -q -b master https://github.com/dxa4481/WPA2-HalfHandshake-Crack.git /opt/wpa2-halfhandshake-crack-git/ \
  2356.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2357. pushd /opt/wpa2-halfhandshake-crack-git/ >/dev/null
  2358. git pull -q
  2359. popd >/dev/null
  2360.  
  2361.  
  2362. ##### Install HT-WPS-Breaker
  2363. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}HT-WPS-Breaker${RESET} ~ Auto WPS tool"
  2364. apt -y -qq install git \
  2365.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2366. git clone -q -b master https://github.com/SilentGhostX/HT-WPS-Breaker.git /opt/ht-wps-breaker-git/ \
  2367.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2368. pushd /opt/ht-wps-breaker-git/ >/dev/null
  2369. git pull -q
  2370. popd >/dev/null
  2371.  
  2372.  
  2373. ##### Install dot11decrypt
  2374. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}dot11decrypt${RESET} ~ On-the-fly WEP/WPA2 decrypter"
  2375. apt -y -qq install git \
  2376.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2377. git clone -q -b master https://github.com/mfontanini/dot11decrypt.git /opt/dot11decrypt-git/ \
  2378.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2379. pushd /opt/dot11decrypt-git/ >/dev/null
  2380. git pull -q
  2381. popd >/dev/null
  2382.  
  2383.  
  2384. ##### Install mana toolkit
  2385. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}MANA toolkit${RESET} ~ Rogue AP for MITM Wi-Fi"
  2386. apt -y -qq install mana-toolkit \
  2387.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2388. #--- Disable profile
  2389. a2dissite 000-mana-toolkit; a2ensite 000-default
  2390. #--- Setup alias
  2391. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  2392. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  2393. grep -q '^## mana-toolkit' "${file}" 2>/dev/null \
  2394.   || (echo -e '## mana-toolkit\nalias mana-toolkit-start="a2ensite 000-mana-toolkit;a2dissite 000-default; systemctl restart apache2"' >> "${file}" \
  2395.     && echo -e 'alias mana-toolkit-stop="a2dissite 000-mana-toolkit; a2ensite 000-default; systemctl restart apache2"\n' >> "${file}" )
  2396. #--- Apply new alias
  2397. source "${file}" || source ~/.zshrc
  2398.  
  2399.  
  2400. ##### Install wifiphisher
  2401. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}wifiphisher${RESET} ~ Automated Wi-Fi phishing"
  2402. apt -y -qq install git \
  2403.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2404. git clone -q -b master https://github.com/sophron/wifiphisher.git /opt/wifiphisher-git/ \
  2405.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2406. pushd /opt/wifiphisher-git/ >/dev/null
  2407. git pull -q
  2408. popd >/dev/null
  2409. #--- Add to path
  2410. file=/usr/local/bin/wifiphisher-git
  2411. cat <<EOF > "${file}" \
  2412.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  2413. #!/bin/bash
  2414.  
  2415. cd /opt/wifiphisher-git/ && python wifiphisher.py "\$@"
  2416. EOF
  2417. chmod +x "${file}"
  2418.  
  2419.  
  2420. ##### Install hostapd-wpe-extended
  2421. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}hostapd-wpe-extended${RESET} ~ Rogue AP for WPA-Enterprise"
  2422. apt -y -qq install git \
  2423.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2424. git clone -q -b master https://github.com/NerdyProjects/hostapd-wpe-extended.git /opt/hostapd-wpe-extended-git/ \
  2425.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2426. pushd /opt/hostapd-wpe-extended-git/ >/dev/null
  2427. git pull -q
  2428. popd >/dev/null
  2429.  
  2430.  
  2431. ##### Install proxychains-ng (https://bugs.kali.org/view.php?id=2037)
  2432. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}proxychains-ng${RESET} ~ Proxifier"
  2433. apt -y -qq install git gcc \
  2434.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2435. git clone -q -b master https://github.com/rofl0r/proxychains-ng.git /opt/proxychains-ng-git/ \
  2436.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2437. pushd /opt/proxychains-ng-git/ >/dev/null
  2438. git pull -q
  2439. make -s clean
  2440. ./configure --prefix=/usr --sysconfdir=/etc >/dev/null
  2441. make -s 2>/dev/null && make -s install   # bad, but it gives errors which might be confusing (still builds)
  2442. popd >/dev/null
  2443. #--- Add to path (with a 'better' name)
  2444. ln -sf /usr/bin/proxychains4 /usr/local/bin/proxychains-ng
  2445.  
  2446.  
  2447. ##### Install httptunnel
  2448. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}httptunnel${RESET} ~ Tunnels data streams in HTTP requests"
  2449. apt -y -qq install http-tunnel \
  2450.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2451.  
  2452.  
  2453. ##### Install sshuttle
  2454. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}sshuttle${RESET} ~ VPN over SSH"
  2455. apt -y -qq install sshuttle \
  2456.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2457. #--- Example
  2458. #sshuttle --dns --remote root@123.9.9.9 0/0 -vv
  2459.  
  2460.  
  2461. ##### Install pfi
  2462. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}pfi${RESET} ~ Port Forwarding Interceptor"
  2463. apt -y -qq install git \
  2464.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2465. git clone -q -b master https://github.com/s7ephen/pfi.git /opt/pfi-git/ \
  2466.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2467. pushd /opt/pfi-git/ >/dev/null
  2468. git pull -q
  2469. popd >/dev/null
  2470.  
  2471.  
  2472. ##### Install icmpsh
  2473. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}icmpsh${RESET} ~ Reverse ICMP shell"
  2474. apt -y -qq install git \
  2475.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2476. git clone -q -b master https://github.com/inquisb/icmpsh.git /opt/icmpsh-git/ \
  2477.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2478. pushd /opt/icmpsh-git/ >/dev/null
  2479. git pull -q
  2480. popd >/dev/null
  2481.  
  2482.  
  2483. ##### Install dnsftp
  2484. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}dnsftp${RESET} ~ Transfer files over DNS"
  2485. apt -y -qq install git \
  2486.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2487. git clone -q -b master https://github.com/breenmachine/dnsftp.git /opt/dnsftp-git/ \
  2488.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2489. pushd /opt/dnsftp-git/ >/dev/null
  2490. git pull -q
  2491. popd >/dev/null
  2492.  
  2493.  
  2494. ##### Install iodine
  2495. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}iodine${RESET} ~ DNS tunnelling (IP over DNS)"
  2496. apt -y -qq install iodine \
  2497.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2498. #iodined -f -P password1 10.0.0.1 dns.mydomain.com
  2499. #iodine -f -P password1 123.9.9.9 dns.mydomain.com; ssh -C -D 8081 root@10.0.0.1
  2500.  
  2501.  
  2502. ##### Install dns2tcp
  2503. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}dns2tcp${RESET} ~ DNS tunnelling (TCP over DNS)"
  2504. apt -y -qq install dns2tcp \
  2505.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2506. #--- Daemon
  2507. file=/etc/dns2tcpd.conf; [ -e "${file}" ] && cp -n $file{,.bkup};
  2508. cat <<EOF > "${file}" \
  2509.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  2510. listen = 0.0.0.0
  2511. port = 53
  2512. user = nobody
  2513. chroot = /tmp
  2514. domain = dnstunnel.mydomain.com
  2515. key = password1
  2516. ressources = ssh:127.0.0.1:22
  2517. EOF
  2518. #--- Client
  2519. file=/etc/dns2tcpc.conf; [ -e "${file}" ] && cp -n $file{,.bkup};
  2520. cat <<EOF > "${file}" \
  2521.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  2522. domain = dnstunnel.mydomain.com
  2523. key = password1
  2524. resources = ssh
  2525. local_port = 8000
  2526. debug_level=1
  2527. EOF
  2528. #--- Example
  2529. #dns2tcpd -F -d 1 -f /etc/dns2tcpd.conf
  2530. #dns2tcpc -f /etc/dns2tcpc.conf 178.62.206.227; ssh -C -D 8081 -p 8000 root@127.0.0.1
  2531.  
  2532.  
  2533. ##### Install ptunnel
  2534. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}ptunnel${RESET} ~ ICMP tunnelling"
  2535. apt -y -qq install ptunnel \
  2536.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2537. #--- Example
  2538. #ptunnel -x password1
  2539. #ptunnel -x password1 -p 123.9.9.9 -lp 8000 -da 127.0.0.1 -dp 22; ssh -C -D 8081 -p 8000 root@127.0.0.1
  2540.  
  2541.  
  2542. ##### Install stunnel
  2543. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}stunnel${RESET} ~ SSL wrapper"
  2544. apt -y -qq install stunnel \
  2545.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2546. #--- Remove from start up
  2547. systemctl disable stunnel4
  2548.  
  2549.  
  2550. ##### Install zerofree
  2551. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}zerofree${RESET} ~ CLI nulls free blocks on a HDD"
  2552. apt -y -qq install zerofree \
  2553.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2554. #--- Example
  2555. #fdisk -l
  2556. #zerofree -v /dev/sda1
  2557. #for i in $(mount | grep sda | grep ext | cut -b 9); do  mount -o remount,ro /dev/sda${i} && zerofree -v /dev/sda${i} && mount -o remount,rw /dev/sda${i}; done
  2558.  
  2559.  
  2560. ##### Install gcc & multilib
  2561. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}gcc${RESET} & ${GREEN}multilibc${RESET} ~ compiling libraries"
  2562. for FILE in cc gcc g++ gcc-multilib make automake libc6 libc6-dev libc6-amd64 libc6-dev-amd64 libc6-i386 libc6-dev-i386 libc6-i686 libc6-dev-i686 build-essential dpkg-dev; do
  2563.   apt -y -qq install "${FILE}" 2>/dev/null
  2564. done
  2565.  
  2566.  
  2567. ##### Install MinGW ~ cross compiling suite
  2568. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}MinGW${RESET} ~ cross compiling suite"
  2569. for FILE in mingw-w64 binutils-mingw-w64 gcc-mingw-w64 cmake   mingw-w64-dev mingw-w64-tools   gcc-mingw-w64-i686 gcc-mingw-w64-x86-64   mingw32; do
  2570.   apt -y -qq install "${FILE}" 2>/dev/null
  2571. done
  2572.  
  2573.  
  2574. ##### Install WINE
  2575. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}WINE${RESET} ~ run Windows programs on *nix"
  2576. apt -y -qq install wine winetricks \
  2577.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2578. #--- Using x64?
  2579. if [[ "$(uname -m)" == 'x86_64' ]]; then
  2580.   (( STAGE++ )); echo -e " ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Configuring ${GREEN}WINE (x64)${RESET}"
  2581.   dpkg --add-architecture i386
  2582.   apt -qq update
  2583.   apt -y -qq install wine32 \
  2584.     || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2585. fi
  2586. #--- Run WINE for the first time
  2587. [ -e /usr/share/windows-binaries/whoami.exe ] && wine /usr/share/windows-binaries/whoami.exe &>/dev/null
  2588. #--- Setup default file association for .exe
  2589. file=~/.local/share/applications/mimeapps.list; [ -e "${file}" ] && cp -n $file{,.bkup}
  2590. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  2591. echo -e 'application/x-ms-dos-executable=wine.desktop' >> "${file}"
  2592.  
  2593.  
  2594. ##### Install MinGW (Windows) ~ cross compiling suite
  2595. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}MinGW (Windows)${RESET} ~ cross compiling suite"
  2596. apt -y -qq install wine curl unzip \
  2597.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2598. timeout 300 curl --progress -k -L -f "http://sourceforge.net/projects/mingw/files/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip/download" > /tmp/mingw-get.zip \
  2599.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading mingw-get.zip" 1>&2       #***!!! hardcoded path!
  2600. mkdir -p ~/.wine/drive_c/MinGW/bin/
  2601. unzip -q -o -d ~/.wine/drive_c/MinGW/ /tmp/mingw-get.zip
  2602. pushd ~/.wine/drive_c/MinGW/ >/dev/null
  2603. for FILE in mingw32-base mingw32-gcc-g++ mingw32-gcc-objc; do   #msys-base
  2604.   wine ./bin/mingw-get.exe install "${FILE}" 2>&1 | grep -v 'If something goes wrong, please rerun with\|for more detailed debugging output'
  2605. done
  2606. popd >/dev/null
  2607. #--- Add to windows path
  2608. grep -q '^"PATH"=.*C:\\\\MinGW\\\\bin' ~/.wine/system.reg \
  2609.   || sed -i '/^"PATH"=/ s_"$_;C:\\\\MinGW\\\\bin"_' ~/.wine/system.reg
  2610.  
  2611.  
  2612. ##### Downloading AccessChk.exe
  2613. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Downloading ${GREEN}AccessChk.exe${RESET} ~ Windows environment tester"
  2614. apt -y -qq install curl windows-binaries unzip \
  2615.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2616. echo -n '[1/2]'; timeout 300 curl --progress -k -L -f "https://web.archive.org/web/20080530012252/http://live.sysinternals.com/accesschk.exe" > /usr/share/windows-binaries/accesschk_v5.02.exe \
  2617.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading accesschk_v5.02.exe" 1>&2   #***!!! hardcoded path!
  2618. echo -n '[2/2]'; timeout 300 curl --progress -k -L -f "https://download.sysinternals.com/files/AccessChk.zip" > /usr/share/windows-binaries/AccessChk.zip \
  2619.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading AccessChk.zip" 1>&2
  2620. unzip -q -o -d /usr/share/windows-binaries/ /usr/share/windows-binaries/AccessChk.zip
  2621. rm -f /usr/share/windows-binaries/{AccessChk.zip,Eula.txt}
  2622.  
  2623.  
  2624. ##### Downloading PsExec.exe
  2625. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Downloading ${GREEN}PsExec.exe${RESET} ~ Pass The Hash 'phun'"
  2626. apt -y -qq install curl windows-binaries unzip unrar \
  2627.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2628. echo -n '[1/2]'; timeout 300 curl --progress -k -L -f "https://download.sysinternals.com/files/PSTools.zip" > /tmp/pstools.zip \
  2629.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading pstools.zip" 1>&2
  2630. echo -n '[2/2]'; timeout 300 curl --progress -k -L -f "http://www.coresecurity.com/system/files/pshtoolkit_v1.4.rar" > /tmp/pshtoolkit.rar \
  2631.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading pshtoolkit.rar" 1>&2  #***!!! hardcoded path!
  2632. unzip -q -o -d /usr/share/windows-binaries/pstools/ /tmp/pstools.zip
  2633. unrar x -y /tmp/pshtoolkit.rar /usr/share/windows-binaries/ >/dev/null
  2634.  
  2635.  
  2636. ##### Install Python (Windows via WINE)
  2637. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Python (Windows)${RESET}"
  2638. echo -n '[1/2]'; timeout 300 curl --progress -k -L -f "https://www.python.org/ftp/python/2.7.9/python-2.7.9.msi" > /tmp/python.msi \
  2639.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading python.msi" 1>&2       #***!!! hardcoded path!
  2640. echo -n '[2/2]'; timeout 300 curl --progress -k -L -f "http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py2.7.exe/download" > /tmp/pywin32.exe \
  2641.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading pywin32.exe" 1>&2      #***!!! hardcoded path!
  2642. wine msiexec /i /tmp/python.msi /qb 2>&1 | grep -v 'If something goes wrong, please rerun with\|for more detailed debugging output'
  2643. pushd /tmp/ >/dev/null
  2644. rm -rf "PLATLIB/" "SCRIPTS/"
  2645. unzip -q -o /tmp/pywin32.exe
  2646. cp -rf PLATLIB/* ~/.wine/drive_c/Python27/Lib/site-packages/
  2647. cp -rf SCRIPTS/* ~/.wine/drive_c/Python27/Scripts/
  2648. rm -rf "PLATLIB/" "SCRIPTS/"
  2649. popd >/dev/null
  2650.  
  2651.  
  2652. ##### Install veil framework
  2653. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}veil-evasion framework${RESET} ~ bypassing anti-virus"
  2654. apt -y -qq install veil-evasion \
  2655.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2656. #bash /usr/share/veil-evasion/setup/setup.sh --silent
  2657. mkdir -p /var/lib/veil-evasion/go/bin/
  2658. touch /etc/veil/settings.py
  2659. sed -i 's/TERMINAL_CLEAR=".*"/TERMINAL_CLEAR="false"/' /etc/veil/settings.py
  2660.  
  2661.  
  2662. ##### Install OP packers
  2663. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}OP packers${RESET} ~ bypassing anti-virus"
  2664. apt -y -qq install upx-ucl curl \
  2665.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2666. mkdir -p /opt/packers/
  2667. echo -n '[1/3]'; timeout 300 curl --progress -k -L -f "http://www.eskimo.com/~scottlu/win/cexe.exe" > /opt/packers/cexe.exe \
  2668.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading cexe.exe" 1>&2            #***!!! hardcoded version! Need to manually check for updates
  2669. echo -n '[2/3]'; timeout 300 curl --progress -k -L -f "http://www.farbrausch.de/~fg/kkrunchy/kkrunchy_023a2.zip" > /opt/packers/kkrunchy.zip \
  2670.   && unzip -q -o -d /opt/packers/ /opt/packers/kkrunchy.zip \
  2671.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading kkrunchy.zip" 1>&2        #***!!! hardcoded version! Need to manually check for updates
  2672. echo -n '[3/3]'; timeout 300 curl --progress -k -L -f "https://pescrambler.googlecode.com/files/PEScrambler_v0_1.zip" > /opt/packers/PEScrambler.zip \
  2673.   && unzip -q -o -d /opt/packers/ /opt/packers/PEScrambler.zip \
  2674.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading PEScrambler.zip" 1>&2     #***!!! hardcoded version! Need to manually check for updates
  2675. #*** ??????? Need to make a bash script like hyperion...
  2676. #--- Link to others
  2677. apt -y -qq install windows-binaries \
  2678.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2679. ln -sf /opt/packers/ /usr/share/windows-binaries/packers
  2680.  
  2681.  
  2682. ##### Install hyperion
  2683. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}hyperion${RESET} ~ bypassing anti-virus"
  2684. apt -y -qq install unzip windows-binaries \
  2685.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2686. unzip -q -o -d /usr/share/windows-binaries/ $(find /usr/share/windows-binaries/ -name "Hyperion-*.zip" -type f -print -quit)
  2687. #--- Compile
  2688. i686-w64-mingw32-g++ -static-libgcc -static-libstdc++ \
  2689.   /usr/share/windows-binaries/Hyperion-1.0/Src/Crypter/*.cpp \
  2690.   -o /usr/share/windows-binaries/Hyperion-1.0/Src/Crypter/bin/crypter.exe
  2691. ln -sf /usr/share/windows-binaries/Hyperion-1.0/Src/Crypter/bin/crypter.exe /usr/share/windows-binaries/Hyperion-1.0/crypter.exe                                                            #***!!! hardcoded path!
  2692. wine ~/.wine/drive_c/MinGW/bin/g++.exe /usr/share/windows-binaries/Hyperion-1.0/Src/Crypter/*.cpp \
  2693.   -o /usr/share/windows-binaries/hyperion.exe 2>&1 \
  2694.   | grep -v 'If something goes wrong, please rerun with\|for more detailed debugging output'
  2695. #--- Add to path
  2696. file=/usr/local/bin/hyperion
  2697. cat <<EOF > "${file}" \
  2698.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  2699. #!/bin/bash
  2700.  
  2701. ## Note: This is far from perfect...
  2702.  
  2703. CWD=\$(pwd)/
  2704. BWD="?"
  2705.  
  2706. ## Using full path?
  2707. [ -e "/\${1}" ] && BWD=""
  2708.  
  2709. ## Using relative path?
  2710. [ -e "./\${1}" ] && BWD="\${CWD}"
  2711.  
  2712. ## Can't find input file!
  2713. [[ "\${BWD}" == "?" ]] && echo -e ' '${RED}'[!]'${RESET}' Cant find \$1. Quitting...' && exit
  2714.  
  2715. ## The magic!
  2716. cd /usr/share/windows-binaries/Hyperion-1.0/
  2717. $(which wine) ./Src/Crypter/bin/crypter.exe \${BWD}\${1} output.exe
  2718.  
  2719. ## Restore our path
  2720. cd \${CWD}/
  2721. sleep 1s
  2722.  
  2723. ## Move the output file
  2724. mv -f /usr/share/windows-binaries/Hyperion-1.0/output.exe \${2}
  2725.  
  2726. ## Generate file hashes
  2727. for FILE in \${1} \${2}; do
  2728.   echo "[i] \$(md5sum \${FILE})"
  2729. done
  2730. EOF
  2731. chmod +x "${file}"
  2732.  
  2733.  
  2734. ##### Install shellter
  2735. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}shellter${RESET} ~ dynamic shellcode injector"
  2736. apt -y -qq install shellter \
  2737.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2738.  
  2739.  
  2740. ##### Install the backdoor factory
  2741. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Backdoor Factory${RESET} ~ bypassing anti-virus"
  2742. apt -y -qq install backdoor-factory \
  2743.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2744.  
  2745.  
  2746. ##### Install Backdoor Factory Proxy (BDFProxy)
  2747. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Backdoor Factory Proxy (BDFProxy)${RESET} ~ patches binaries files during a MITM"
  2748. apt -y -qq install bdfproxy \
  2749.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2750.  
  2751.  
  2752. ##### Install BetterCap
  2753. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}BetterCap${RESET} ~ MITM framework"
  2754. apt -y -qq install git ruby-dev libpcap-dev \
  2755.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2756. git clone -q -b master https://github.com/evilsocket/bettercap.git /opt/bettercap-git/ \
  2757.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2758. pushd /opt/bettercap-git/ >/dev/null
  2759. git pull -q
  2760. gem build bettercap.gemspec
  2761. gem install bettercap*.gem
  2762. popd >/dev/null
  2763.  
  2764.  
  2765. ##### Install mitmf
  2766. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}MITMf${RESET} ~ framework for MITM attacks"
  2767. apt -y -qq install mitmf \
  2768.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2769.  
  2770.  
  2771. ##### Install responder
  2772. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Responder${RESET} ~ rogue server"
  2773. apt -y -qq install responder \
  2774.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2775.  
  2776.  
  2777. ##### Install seclist
  2778. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}seclist${RESET} ~ multiple types of (word)lists (and similar things)"
  2779. apt -y -qq install seclists \
  2780.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2781. #--- Link to others
  2782. apt -y -qq install wordlists \
  2783.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2784. [ -e /usr/share/seclists ] \
  2785.   && ln -sf /usr/share/seclists /usr/share/wordlists/seclists
  2786.  
  2787.  
  2788. ##### Update wordlists
  2789. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Updating ${GREEN}wordlists${RESET} ~ collection of wordlists"
  2790. apt -y -qq install wordlists curl \
  2791.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2792. #--- Extract rockyou wordlist
  2793. [ -e /usr/share/wordlists/rockyou.txt.gz ] \
  2794.   && gzip -dc < /usr/share/wordlists/rockyou.txt.gz > /usr/share/wordlists/rockyou.txt
  2795. #--- Add 10,000 Top/Worst/Common Passwords
  2796. mkdir -p /usr/share/wordlists/
  2797. (curl --progress -k -L -f "http://xato.net/files/10k most common.zip" > /tmp/10kcommon.zip 2>/dev/null \
  2798.   || curl --progress -k -L -f "http://download.g0tmi1k.com/wordlists/common-10k_most_common.zip" > /tmp/10kcommon.zip 2>/dev/null) \
  2799.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading 10kcommon.zip" 1>&2
  2800. unzip -q -o -d /usr/share/wordlists/ /tmp/10kcommon.zip 2>/dev/null   #***!!! hardcoded version! Need to manually check for updates
  2801. mv -f /usr/share/wordlists/10k{\ most\ ,_most_}common.txt
  2802. #--- Linking to more - folders
  2803. [ -e /usr/share/dirb/wordlists ] \
  2804.   && ln -sf /usr/share/dirb/wordlists /usr/share/wordlists/dirb
  2805. #--- Extract sqlmap wordlist
  2806. unzip -o -d /usr/share/sqlmap/txt/ /usr/share/sqlmap/txt/wordlist.zip
  2807. ln -sf /usr/share/sqlmap/txt/wordlist.txt /usr/share/wordlists/sqlmap.txt
  2808. #--- Not enough? Want more? Check below!
  2809. #apt search wordlist
  2810. #find / \( -iname '*wordlist*' -or -iname '*passwords*' \) #-exec ls -l {} \;
  2811.  
  2812.  
  2813. ##### Install apt-file
  2814. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}apt-file${RESET} ~ which package includes a specific file"
  2815. apt -y -qq install apt-file \
  2816.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2817. apt-file update
  2818.  
  2819.  
  2820. ##### Install apt-show-versions
  2821. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}apt-show-versions${RESET} ~ which package version in repo"
  2822. apt -y -qq install apt-show-versions \
  2823.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2824.  
  2825.  
  2826. ##### Install Babel scripts
  2827. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Babel scripts${RESET} ~ post exploitation scripts"
  2828. apt -y -qq install git \
  2829.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2830. git clone -q -b master https://github.com/attackdebris/babel-sf.git /opt/babel-sf-git/ \
  2831.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2832. pushd /opt/babel-sf-git/ >/dev/null
  2833. git pull -q
  2834. popd >/dev/null
  2835.  
  2836.  
  2837. ##### Install checksec
  2838. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}checksec${RESET} ~ check *nix OS for security features"
  2839. apt -y -qq install curl \
  2840.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2841. mkdir -p /usr/share/checksec/
  2842. file=/usr/share/checksec/checksec.sh
  2843. timeout 300 curl --progress -k -L -f "http://www.trapkit.de/tools/checksec.sh" > "${file}" \
  2844.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading checksec.sh" 1>&2     #***!!! hardcoded patch
  2845. chmod +x "${file}"
  2846.  
  2847.  
  2848. ##### Install shellconv
  2849. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}shellconv${RESET} ~ shellcode disassembler"
  2850. apt -y -qq install git \
  2851.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2852. git clone -q -b master https://github.com/hasherezade/shellconv.git /opt/shellconv-git/ \
  2853.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2854. pushd /opt/shellconv-git/ >/dev/null
  2855. git pull -q
  2856. popd >/dev/null
  2857. #--- Add to path
  2858. file=/usr/local/bin/shellconv-git
  2859. cat <<EOF > "${file}" \
  2860.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  2861. #!/bin/bash
  2862.  
  2863. cd /opt/shellconv-git/ && python shellconv.py "\$@"
  2864. EOF
  2865. chmod +x "${file}"
  2866.  
  2867.  
  2868. ##### Install bless
  2869. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}bless${RESET} ~ GUI hex editor"
  2870. apt -y -qq install bless \
  2871.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2872.  
  2873.  
  2874. ##### Install dhex
  2875. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}dhex${RESET} ~ CLI hex compare"
  2876. apt -y -qq install dhex \
  2877.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2878.  
  2879.  
  2880. ##### Install firmware-mod-kit
  2881. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}firmware-mod-kit${RESET} ~ customize firmware"
  2882. apt -y -qq install firmware-mod-kit \
  2883.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2884.  
  2885.  
  2886. ##### Install lnav
  2887. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}lnav${RESET} ~ CLI log veiwer"
  2888. apt -y -qq install lnav \
  2889.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2890.  
  2891.  
  2892. ##### Install commix
  2893. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}commix${RESET} ~ automatic command injection"
  2894. apt -y -qq install commix \
  2895.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2896.  
  2897.  
  2898. ##### Install fimap
  2899. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}fimap${RESET} ~ automatic LFI/RFI tool"
  2900. apt -y -qq install fimap \
  2901.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2902.  
  2903.  
  2904. ##### Install smbmap
  2905. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}smbmap${RESET} ~ SMB enumeration tool"
  2906. apt -y -qq install smbmap \
  2907.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2908.  
  2909.  
  2910. ##### Install smbspider
  2911. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}smbspider${RESET} ~ search network shares"
  2912. apt -y -qq install git \
  2913.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2914. git clone -q -b master https://github.com/T-S-A/smbspider.git /opt/smbspider-git/ \
  2915.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2916. pushd /opt/smbspider-git/ >/dev/null
  2917. git pull -q
  2918. popd >/dev/null
  2919.  
  2920.  
  2921. ##### Install CrackMapExec
  2922. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}CrackMapExec${RESET} ~ Swiss army knife for Windows environments"
  2923. apt -y -qq install git \
  2924.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2925. git clone -q -b master https://github.com/byt3bl33d3r/CrackMapExec.git /opt/crackmapexec-git/ \
  2926.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2927. pushd /opt/crackmapexec-git/ >/dev/null
  2928. git pull -q
  2929. popd >/dev/null
  2930.  
  2931.  
  2932. ##### Install credcrack
  2933. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}credcrack${RESET} ~ credential harvester via Samba"
  2934. apt -y -qq install git \
  2935.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2936. git clone -q -b master https://github.com/gojhonny/CredCrack.git /opt/credcrack-git/ \
  2937.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2938. pushd /opt/credcrack-git/ >/dev/null
  2939. git pull -q
  2940. popd >/dev/null
  2941.  
  2942.  
  2943. ##### Install Empire
  2944. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Empire${RESET} ~ PowerShell post-exploitation"
  2945. apt -y -qq install git \
  2946.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2947. git clone -q -b master https://github.com/PowerShellEmpire/Empire.git /opt/empire-git/ \
  2948.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2949. pushd /opt/empire-git/ >/dev/null
  2950. git pull -q
  2951. popd >/dev/null
  2952.  
  2953.  
  2954. ##### Install wig (https://bugs.kali.org/view.php?id=1932)
  2955. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}wig${RESET} ~ web application detection"
  2956. apt -y -qq install git \
  2957.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2958. git clone -q -b master https://github.com/jekyc/wig.git /opt/wig-git/ \
  2959.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2960. pushd /opt/wig-git/ >/dev/null
  2961. git pull -q
  2962. popd >/dev/null
  2963. #--- Add to path
  2964. file=/usr/local/bin/wig-git
  2965. cat <<EOF > "${file}" \
  2966.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  2967. #!/bin/bash
  2968.  
  2969. cd /opt/wig-git/ && python wig.py "\$@"
  2970. EOF
  2971. chmod +x "${file}"
  2972.  
  2973.  
  2974. ##### Install CMSmap
  2975. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}CMSmap${RESET} ~ CMS detection"
  2976. apt -y -qq install git \
  2977.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2978. git clone -q -b master https://github.com/Dionach/CMSmap.git /opt/cmsmap-git/ \
  2979.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  2980. pushd /opt/cmsmap-git/ >/dev/null
  2981. git pull -q
  2982. popd >/dev/null
  2983. #--- Add to path
  2984. file=/usr/local/bin/cmsmap-git
  2985. cat <<EOF > "${file}" \
  2986.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  2987. #!/bin/bash
  2988.  
  2989. cd /opt/cmsmap-git/ && python cmsmap.py "\$@"
  2990. EOF
  2991. chmod +x "${file}"
  2992.  
  2993.  
  2994. ##### Install droopescan
  2995. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}DroopeScan${RESET} ~ Drupal vulnerability scanner"
  2996. apt -y -qq install git \
  2997.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  2998. git clone -q -b master https://github.com/droope/droopescan.git /opt/droopescan-git/ \
  2999.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  3000. pushd /opt/droopescan-git/ >/dev/null
  3001. git pull -q
  3002. popd >/dev/null
  3003. #--- Add to path
  3004. file=/usr/local/bin/droopescan-git
  3005. cat <<EOF > "${file}" \
  3006.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  3007. #!/bin/bash
  3008.  
  3009. cd /opt/droopescan-git/ && python droopescan "\$@"
  3010. EOF
  3011. chmod +x "${file}"
  3012.  
  3013.  
  3014. ##### Install BeEF XSS
  3015. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}BeEF XSS${RESET} ~ XSS framework"
  3016. apt -y -qq install beef-xss \
  3017.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3018. #--- Configure beef
  3019. file=/usr/share/beef-xss/config.yaml; [ -e "${file}" ] && cp -n $file{,.bkup}
  3020. username="root"
  3021. password="toor"
  3022. sed -i 's/user:.*".*"/user:   "'${username}'"/' "${file}"
  3023. sed -i 's/passwd:.*".*"/passwd:  "'${password}'"/'  "${file}"
  3024. echo -e " ${YELLOW}[i]${RESET} BeEF username: ${username}"
  3025. echo -e " ${YELLOW}[i]${RESET} BeEF password: ${password}   ***${BOLD}CHANGE THIS ASAP${RESET}***"
  3026. echo -e " ${YELLOW}[i]${RESET} Edit: /usr/share/beef-xss/config.yaml"
  3027. #--- Example
  3028. #<script src="http://192.168.155.175:3000/hook.js" type="text/javascript"></script>
  3029.  
  3030.  
  3031. ##### Install patator (GIT)
  3032. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}patator${RESET} (GIT) ~ brute force"
  3033. apt -y -qq install git \
  3034.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3035. git clone -q -b master https://github.com/lanjelot/patator.git /opt/patator-git/ \
  3036.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  3037. pushd /opt/patator-git/ >/dev/null
  3038. git pull -q
  3039. popd >/dev/null
  3040. #--- Add to path
  3041. file=/usr/local/bin/patator-git
  3042. cat <<EOF > "${file}" \
  3043.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  3044. #!/bin/bash
  3045.  
  3046. cd /opt/patator-git/ && python patator.py "\$@"
  3047. EOF
  3048. chmod +x "${file}"
  3049.  
  3050.  
  3051. ##### Install crowbar
  3052. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}crowbar${RESET} ~ brute force"
  3053. apt -y -qq install git openvpn freerdp-x11 vncviewer \
  3054.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3055. git clone -q -b master https://github.com/galkan/crowbar.git /opt/crowbar-git/ \
  3056.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  3057. pushd /opt/crowbar-git/ >/dev/null
  3058. git pull -q
  3059. popd >/dev/null
  3060. #--- Add to path
  3061. file=/usr/local/bin/crowbar-git
  3062. cat <<EOF > "${file}" \
  3063.   || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
  3064. #!/bin/bash
  3065.  
  3066. cd /opt/crowbar-git/ && python crowbar.py "\$@"
  3067. EOF
  3068. chmod +x "${file}"
  3069.  
  3070.  
  3071. ##### Install xprobe
  3072. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}xprobe${RESET} ~ OS fingerprinting"
  3073. apt -y -qq install xprobe \
  3074.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3075.  
  3076.  
  3077. ##### Install p0f
  3078. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}p0f${RESET} ~ OS fingerprinting"
  3079. apt -y -qq install p0f \
  3080.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3081. #p0f -i eth0 -p & curl 192.168.0.1
  3082.  
  3083.  
  3084. ##### Install nbtscan ~ http://unixwiz.net/tools/nbtscan.html vs http://inetcat.org/software/nbtscan.html (see http://sectools.org/tool/nbtscan/)
  3085. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}nbtscan${RESET} (${GREEN}inetcat${RESET} & ${GREEN}unixwiz${RESET}) ~ netbios scanner"
  3086. #--- inetcat - 1.5.x
  3087. apt -y -qq install nbtscan \
  3088.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3089. #--- Examples
  3090. #nbtscan -r 192.168.0.1/24
  3091. #nbtscan -r 192.168.0.1/24 -v
  3092. #--- unixwiz - 1.0.x
  3093. mkdir -p /usr/local/src/nbtscan-unixwiz/
  3094. timeout 300 curl --progress -k -L -f "http://unixwiz.net/tools/nbtscan-source-1.0.35.tgz" > /usr/local/src/nbtscan-unixwiz/nbtscan.tgz \
  3095.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading nbtscan.tgz" 1>&2    #***!!! hardcoded version! Need to manually check for updates
  3096. tar -zxf /usr/local/src/nbtscan-unixwiz/nbtscan.tgz -C /usr/local/src/nbtscan-unixwiz/
  3097. pushd /usr/local/src/nbtscan-unixwiz/ >/dev/null
  3098. make -s clean;
  3099. make -s 2>/dev/null    # bad, I know
  3100. popd >/dev/null
  3101. #--- Add to path
  3102. ln -sf /usr/local/src/nbtscan-unixwiz/nbtscan /usr/local/bin/nbtscan-uw
  3103. #--- Examples
  3104. #nbtscan-uw -f 192.168.0.1/24
  3105.  
  3106.  
  3107. ##### Setup tftp client & server
  3108. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Setting up ${GREEN}tftp client${RESET} & ${GREEN}server${RESET} ~ file transfer methods"
  3109. apt -y -qq install tftp atftpd \
  3110.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3111. #--- Configure atftpd
  3112. file=/etc/default/atftpd; [ -e "${file}" ] && cp -n $file{,.bkup}
  3113. echo -e 'USE_INETD=false\nOPTIONS="--tftpd-timeout 300 --retry-timeout 5 --maxthread 100 --verbose=5 --daemon --port 69 /var/tftp"' > "${file}"
  3114. mkdir -p /var/tftp/
  3115. chown -R nobody\:root /var/tftp/
  3116. chmod -R 0755 /var/tftp/
  3117. #--- Setup alias
  3118. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  3119. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  3120. grep -q '^## tftp' "${file}" 2>/dev/null \
  3121.   || echo -e '## tftp\nalias tftproot="cd /var/tftp/"\n' >> "${file}"
  3122. #--- Apply new alias
  3123. source "${file}" || source ~/.zshrc
  3124. #--- Remove from start up
  3125. systemctl disable atftpd
  3126. #--- Disabling IPv6 can help
  3127. #echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
  3128. #echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
  3129.  
  3130.  
  3131. ##### Install Pure-FTPd
  3132. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}Pure-FTPd${RESET} ~ FTP server/file transfer method"
  3133. apt -y -qq install pure-ftpd \
  3134.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3135. #--- Setup pure-ftpd
  3136. mkdir -p /var/ftp/
  3137. groupdel ftpgroup 2>/dev/null;
  3138. groupadd ftpgroup
  3139. userdel ftp 2>/dev/null;
  3140. useradd -r -M -d /var/ftp/ -s /bin/false -c "FTP user" -g ftpgroup ftp
  3141. chown -R ftp\:ftpgroup /var/ftp/
  3142. chmod -R 0755 /var/ftp/
  3143. pure-pw userdel ftp 2>/dev/null;
  3144. echo -e '\n' | pure-pw useradd ftp -u ftp -d /var/ftp/
  3145. pure-pw mkdb
  3146. #--- Configure pure-ftpd
  3147. echo "no" > /etc/pure-ftpd/conf/UnixAuthentication
  3148. echo "no" > /etc/pure-ftpd/conf/PAMAuthentication
  3149. echo "yes" > /etc/pure-ftpd/conf/NoChmod
  3150. echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone
  3151. #echo "yes" > /etc/pure-ftpd/conf/AnonymousOnly
  3152. echo "no" > /etc/pure-ftpd/conf/NoAnonymous
  3153. echo "yes" > /etc/pure-ftpd/conf/AnonymousCanCreateDirs
  3154. echo "yes" > /etc/pure-ftpd/conf/AllowAnonymousFXP
  3155. echo "no" > /etc/pure-ftpd/conf/AnonymousCantUpload
  3156. echo "30768 31768" > /etc/pure-ftpd/conf/PassivePortRange              #cat /proc/sys/net/ipv4/ip_local_port_range
  3157. echo "/etc/pure-ftpd/welcome.msg" > /etc/pure-ftpd/conf/FortunesFile   #/etc/motd
  3158. echo "FTP" > /etc/pure-ftpd/welcome.msg
  3159. ln -sf /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/50pure
  3160. #--- 'Better' MOTD
  3161. apt -y -qq install cowsay \
  3162.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3163. echo "moo" | /usr/games/cowsay > /etc/pure-ftpd/welcome.msg
  3164. echo -e " ${YELLOW}[i]${RESET} Pure-FTPd username: anonymous"
  3165. echo -e " ${YELLOW}[i]${RESET} Pure-FTPd password: anonymous"
  3166. #--- Apply settings
  3167. systemctl restart pure-ftpd
  3168. #--- Setup alias
  3169. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  3170. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  3171. grep -q '^## ftp' "${file}" 2>/dev/null \
  3172.   || echo -e '## ftp\nalias ftproot="cd /var/ftp/"\n' >> "${file}"
  3173. #--- Apply new alias
  3174. source "${file}" || source ~/.zshrc
  3175. #--- Remove from start up
  3176. systemctl disable pure-ftpd
  3177.  
  3178.  
  3179. ##### Install samba
  3180. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}samba${RESET} ~ file transfer method"
  3181. #--- Installing samba
  3182. apt -y -qq install samba \
  3183.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3184. apt -y -qq install cifs-utils \
  3185.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3186. #--- Create samba user
  3187. groupdel smbgroup 2>/dev/null;
  3188. groupadd smbgroup
  3189. userdel samba 2>/dev/null;
  3190. useradd -r -M -d /nonexistent -s /bin/false -c "Samba user" -g smbgroup samba
  3191. #--- Use the samba user
  3192. file=/etc/samba/smb.conf; [ -e "${file}" ] && cp -n $file{,.bkup}
  3193. sed -i 's/guest account = .*/guest account = samba/' "${file}" 2>/dev/null
  3194. grep -q 'guest account' "${file}" 2>/dev/null \
  3195.   || sed -i 's#\[global\]#\[global\]\n   guest account = samba#' "${file}"
  3196. #--- Setup samba paths
  3197. grep -q '^\[shared\]' "${file}" 2>/dev/null \
  3198.   || cat <<EOF >> "${file}"
  3199.  
  3200. [shared]
  3201.   comment = Shared
  3202.   path = /var/samba/
  3203.   browseable = yes
  3204.   guest ok = yes
  3205.   #guest only = yes
  3206.   read only = no
  3207.   writable = yes
  3208.   create mask = 0644
  3209.   directory mask = 0755
  3210. EOF
  3211. #--- Create samba path and configure it
  3212. mkdir -p /var/samba/
  3213. chown -R samba\:smbgroup /var/samba/
  3214. chmod -R 0755 /var/samba/
  3215. #--- Bug fix
  3216. touch /etc/printcap
  3217. #--- Check
  3218. #systemctl restart samba
  3219. #smbclient -L \\127.0.0.1 -N
  3220. #mount -t cifs -o guest //127.0.0.1/share /mnt/smb     mkdir -p /mnt/smb
  3221. #--- Disable samba at startup
  3222. systemctl stop samba
  3223. systemctl disable samba
  3224. echo -e " ${YELLOW}[i]${RESET} Samba username: guest"
  3225. echo -e " ${YELLOW}[i]${RESET} Samba password: <blank>"
  3226. #--- Setup alias
  3227. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  3228. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  3229. grep -q '^## smb' "${file}" 2>/dev/null \
  3230.   || echo -e '## smb\nalias smb="cd /var/samba/"\n#alias smbroot="cd /var/samba/"\n' >> "${file}"
  3231. #--- Apply new alias
  3232. source "${file}" || source ~/.zshrc
  3233.  
  3234.  
  3235. ##### Install apache2 & php5
  3236. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}apache2${RESET} & ${GREEN}php5${RESET} ~ web server"
  3237. apt -y -qq install apache2 php5 php5-cli php5-curl \
  3238.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3239. touch /var/www/html/favicon.ico
  3240. grep -q '<title>Apache2 Debian Default Page: It works</title>' /var/www/html/index.html 2>/dev/null \
  3241.   && rm -f /var/www/html/index.html \
  3242.   && echo '<?php echo "Access denied for " . $_SERVER["REMOTE_ADDR"]; ?>' > /var/www/html/index.php
  3243. #--- Setup alias
  3244. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  3245. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  3246. grep -q '^## www' "${file}" 2>/dev/null \
  3247.   || echo -e '## www\nalias wwwroot="cd /var/www/html/"\n' >> "${file}"
  3248. #--- Apply new alias
  3249. source "${file}" || source ~/.zshrc
  3250.  
  3251.  
  3252. ##### Install mysql
  3253. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}MySQL${RESET} ~ database"
  3254. apt -y -qq install mysql-server \
  3255.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3256. echo -e " ${YELLOW}[i]${RESET} MySQL username: root"
  3257. echo -e " ${YELLOW}[i]${RESET} MySQL password: <blank>   ***${BOLD}CHANGE THIS ASAP${RESET}***"
  3258. [[ -e ~/.my.cnf ]] \
  3259.   || cat <<EOF > ~/.my.cnf
  3260. [client]
  3261. user=root
  3262. host=localhost
  3263. password=
  3264. EOF
  3265.  
  3266.  
  3267. ##### Install rsh-client
  3268. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}rsh-client${RESET} ~ remote shell connections"
  3269. apt -y -qq install rsh-client \
  3270.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3271.  
  3272.  
  3273. ##### Install sshpass
  3274. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}sshpass${RESET} ~ automating SSH connections"
  3275. apt -y -qq install sshpass \
  3276.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3277.  
  3278.  
  3279. ##### Install DBeaver
  3280. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}DBeaver${RESET} ~ GUI DB manager"
  3281. apt -y -qq install curl \
  3282.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3283. arch="i386"
  3284. [[ "$(uname -m)" == "x86_64" ]] && arch="amd64"
  3285. timeout 300 curl --progress -k -L -f "http://dbeaver.jkiss.org/files/dbeaver-ce_latest_${arch}.deb" > /tmp/dbeaver.deb \
  3286.   || echo -e ' '${RED}'[!]'${RESET}" Issue downloading dbeaver.deb" 1>&2   #***!!! hardcoded version! Need to manually check for updates
  3287. if [ -e /tmp/dbeaver.deb ]; then
  3288.   dpkg -i /tmp/dbeaver.deb
  3289.   #--- Add to path
  3290.   ln -sf /usr/share/dbeaver/dbeaver /usr/local/bin/dbeaver
  3291. fi
  3292.  
  3293.  
  3294. ##### Install ashttp
  3295. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}ashttp${RESET} ~ terminal via the web"
  3296. apt -y -qq install git \
  3297.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3298. git clone -q -b master https://github.com/JulienPalard/ashttp.git /opt/ashttp-git/ \
  3299.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  3300. pushd /opt/ashttp-git/ >/dev/null
  3301. git pull -q
  3302. popd >/dev/null
  3303.  
  3304.  
  3305. ##### Install gotty
  3306. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Installing ${GREEN}gotty${RESET} ~ terminal via the web"
  3307. apt -y -qq install git \
  3308.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3309. git clone -q -b master https://github.com/yudai/gotty.git /opt/gotty-git/ \
  3310.   || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
  3311. pushd /opt/gotty-git/ >/dev/null
  3312. git pull -q
  3313. popd >/dev/null
  3314.  
  3315.  
  3316. ##### Preparing a jail ~ http://allanfeid.com/content/creating-chroot-jail-ssh-access // http://www.cyberciti.biz/files/lighttpd/l2chroot.txt
  3317. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Preparing up a ${GREEN}jail${RESET} ~ testing environment"
  3318. apt -y -qq install debootstrap curl \
  3319.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3320.  
  3321.  
  3322. ##### Setup SSH
  3323. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) Setting up ${GREEN}SSH${RESET} ~ CLI access"
  3324. apt -y -qq install openssh-server \
  3325.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3326. #--- Wipe current keys
  3327. rm -f /etc/ssh/ssh_host_*
  3328. find ~/.ssh/ -type f ! -name authorized_keys -delete 2>/dev/null
  3329. #--- Generate new keys
  3330. ssh-keygen -b 4096 -t rsa1 -f /etc/ssh/ssh_host_key -P "" >/dev/null
  3331. ssh-keygen -b 4096 -t rsa -f /etc/ssh/ssh_host_rsa_key -P "" >/dev/null
  3332. ssh-keygen -b 1024 -t dsa -f /etc/ssh/ssh_host_dsa_key -P "" >/dev/null
  3333. ssh-keygen -b 521 -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -P "" >/dev/null
  3334. ssh-keygen -b 4096 -t rsa -f ~/.ssh/id_rsa -P "" >/dev/null
  3335. #--- Change MOTD
  3336. apt -y -qq install cowsay \
  3337.   || echo -e ' '${RED}'[!] Issue with apt install'${RESET} 1>&2
  3338. echo "Moo" | /usr/games/cowsay > /etc/motd
  3339. #--- Change SSH settings
  3340. file=/etc/ssh/sshd_config; [ -e "${file}" ] && cp -n $file{,.bkup}
  3341. sed -i 's/^PermitRootLogin .*/PermitRootLogin yes/g' "${file}"      # Accept password login (overwrite Debian 8+'s more secure default option...)
  3342. sed -i 's/^#AuthorizedKeysFile /AuthorizedKeysFile /g' "${file}"    # Allow for key based login
  3343. #sed -i 's/^Port .*/Port 2222/g' "${file}"
  3344. #--- Enable ssh at startup
  3345. #systemctl enable ssh
  3346. #--- Setup alias (handy for 'zsh: correct 'ssh' to '.ssh' [nyae]? n')
  3347. file=~/.bash_aliases; [ -e "${file}" ] && cp -n $file{,.bkup}   #/etc/bash.bash_aliases
  3348. ([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
  3349. grep -q '^## ssh' "${file}" 2>/dev/null \
  3350.   || echo -e '## ssh\nalias ssh-start="systemctl restart ssh"\nalias ssh-stop="systemctl stop ssh"\n' >> "${file}"
  3351. #--- Apply new alias
  3352. source "${file}" || source ~/.zshrc
  3353.  
  3354.  
  3355.  
  3356. ##### Custom insert point
  3357.  
  3358.  
  3359.  
  3360. ##### Clean the system
  3361. (( STAGE++ )); echo -e "\n\n ${GREEN}[+]${RESET} (${STAGE}/${TOTAL}) ${GREEN}Cleaning${RESET} the system"
  3362. #--- Clean package manager
  3363. for FILE in clean autoremove; do apt -y -qq "${FILE}"; done
  3364. apt -y -qq purge $(dpkg -l | tail -n +6 | egrep -v '^(h|i)i' | awk '{print $2}')   # Purged packages
  3365. #--- Update slocate database
  3366. updatedb
  3367. #--- Reset folder location
  3368. cd ~/ &>/dev/null
  3369. #--- Remove any history files (as they could contain sensitive info)
  3370. history -c 2>/dev/null
  3371. for i in $(cut -d: -f6 /etc/passwd | sort -u); do
  3372.   [ -e "${i}" ] && find "${i}" -type f -name '.*_history' -delete
  3373. done
  3374.  
  3375.  
  3376. ##### Time taken
  3377. finish_time=$(date +%s)
  3378. echo -e "\n\n ${YELLOW}[i]${RESET} Time (roughly) taken: ${YELLOW}$(( $(( finish_time - start_time )) / 60 )) minutes${RESET}"
  3379.  
  3380.  
  3381. #-Done-----------------------------------------------------------------#
  3382.  
  3383.  
  3384. ##### Done!
  3385. echo -e "\n ${YELLOW}[i]${RESET} Don't forget to:"
  3386. echo -e " ${YELLOW}[i]${RESET} + Check the above output (Did everything install? Any errors? (${RED}HINT: What's in RED${RESET}?)"
  3387. echo -e " ${YELLOW}[i]${RESET} + Manually install: Nessus, Nexpose, and/or Metasploit Community"
  3388. echo -e " ${YELLOW}[i]${RESET} + Agree/Accept to: Maltego, OWASP ZAP, w3af, etc"
  3389. echo -e " ${YELLOW}[i]${RESET} + Setup git:   ${YELLOW}git config --global user.name <name>;git config --global user.email <email>${RESET}"
  3390. echo -e " ${YELLOW}[i]${RESET} + ${BOLD}Change default passwords${RESET}: PostgreSQL/MSF, MySQL, OpenVAS, BeEF XSS, etc"
  3391. echo -e " ${YELLOW}[i]${RESET} + ${YELLOW}Reboot${RESET}"
  3392. (dmidecode | grep -iq virtual) \
  3393.   && echo -e " ${YELLOW}[i]${RESET} + Take a snapshot   (Virtual machine detected)"
  3394.  
  3395. echo -e '\n'${BLUE}'[*]'${RESET}' '${BOLD}'Done!'${RESET}'\n\a'
  3396. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement