From d35bf7f3c52f5719558f73b77ed1fc34e6997e89 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Sun, 6 Nov 2022 17:14:38 -0500 Subject: Post CFC version test --- kali.yml | 119 ++++++++++++++---------- master-bashrc | 116 ------------------------ master-tmux_conf | 14 --- parrot.yml | 265 ------------------------------------------------------ setup-kali.sh | 63 ------------- setup-parrot.sh | 69 -------------- setup.sh | 40 +++++++++ tmux_conf | 14 +++ zsh_functions.zsh | 17 ++++ 9 files changed, 142 insertions(+), 575 deletions(-) delete mode 100644 master-bashrc delete mode 100644 master-tmux_conf delete mode 100644 parrot.yml delete mode 100644 setup-kali.sh delete mode 100644 setup-parrot.sh create mode 100644 setup.sh create mode 100644 tmux_conf create mode 100644 zsh_functions.zsh diff --git a/kali.yml b/kali.yml index fea5dfb..4bf2127 100644 --- a/kali.yml +++ b/kali.yml @@ -9,6 +9,10 @@ ysoserial_jar: "https://github.com/frohoff/ysoserial/releases/latest/download/ysoserial-all.jar" kitty_installer: "https://sw.kovidgoyal.net/kitty/installer.sh" tasks: + - ansible.builtin.fail: + msg: "This playbook must be run properly! Execute sudo bash setup.sh" + when: tmux is not defined or zsh_func is not defined + - name: Add Docker repo key ansible.builtin.shell: curl -fsSL {{ docker_repo_key }} | gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/docker-ce-keyring.gpg @@ -33,53 +37,60 @@ - name: Installing one-off packages from package manager ansible.builtin.package: name: - - gawk - - terminator - - jxplorer - - seclists - - gobuster - - python3 - - python3-dev - - python3-pip + - bloodhound + - build-essential + - bytecode-viewer + - clang + - cmake - crackmapexec - - neo4j + - curl - default-jdk - default-jre - - rlwrap - - eog - - xclip - - steghide - - git - - ltrace - - strace - - gdb - - gdbserver - docker - docker-compose + - eog + - feroxbuster + - flex - forensics-extra - - ncat + - gawk + - gdb + - gdbserver + - ghidra + - git + - gobuster + - golang-go - jq - - powershell - - samba - - tmux - - libssl-dev + - jxplorer - libffi-dev - - build-essential + - liblzma-dev + - libssl-dev + - libxml2-dev + - ltrace + - ncat + - neo4j + - ntpdate + - mingw-w64 + - patch + - powershell + - python3 + - python3-dev + - python3-pip + - p7zip-full - remmina + - rlwrap + - samba + - seclists + - steghide + - strace - sublime-text - - golang-go - - ghidra - - bytecode-viewer - - ntpdate - - bloodhound + - terminator + - tmux + - xclip + - xfce4-terminal - zaproxy + - zlib1g-dev state: latest - - name: Install ShellUp! - ansible.builtin.git: - repo: 'https://github.com/AgroDan/shellup.git' - dest: /opt/shellup - - name: Install pwntools ansible.builtin.pip: name: git+https://github.com/Gallopsled/pwntools.git@dev @@ -207,36 +218,48 @@ set mouse= set ttymouse= - - name: Getting all interactive users <> + - name: Getting all interactive users ansible.builtin.shell: "awk -F: '{ if (($3 >= 1000 && $3 != 65534) || $3 == 0) print $1}' /etc/passwd" register: users - + + - name: Add sudo-NOPASSWD to users + loop: "{{ users.stdout_lines }}" + ansible.builtin.lineinfile: + path: /etc/sudoers + state: present + insertafter: EOF + line: "{{ item }} ALL=(ALL) NOPASSWD: ALL" + validate: /usr/sbin/visudo -cf %s + - name: Initialize Gef for all users ansible.builtin.script: /opt/gef/scripts/gef.sh become_user: "{{ item }}" loop: "{{ users.stdout_lines }}" - - name: Copying over bashrc file to all users + - name: Copying over zsh functions file for all users ansible.builtin.copy: - src: /tmp/master-bashrc - dest: "~{{ item }}/.bashrc" + src: "{{ zsh_func }}" + dest: "~{{ item }}/.zsh_functions" owner: "{{ item }}" group: "{{ item }}" mode: '0640' loop: "{{ users.stdout_lines }}" - - name: Copying over bash functions file for all users - ansible.builtin.copy: - src: /tmp/master-bash_functions - dest: "~{{ item }}/.bash_functions" + - name: Enabling zsh functions + loop: "{{ users.stdout_lins }}" + ansible.builtin.blockinfile: + path: "~{{ item }}/.zshrc" + state: present + insertafter: EOF owner: "{{ item }}" - group: "{{ item }}" - mode: '0640' - loop: "{{ users.stdout_lines }}" - + block: | + if [ -f ~/.zsh_functions ]; then + source ~/.zsh_functions + fi + - name: Copying over tmux config to all users ansible.builtin.copy: - src: /tmp/master-tmux_conf + src: "{{ tmux }}" dest: "~{{ item }}/.tmux.conf" owner: "{{ item }}" group: "{{ item }}" diff --git a/master-bashrc b/master-bashrc deleted file mode 100644 index d509df6..0000000 --- a/master-bashrc +++ /dev/null @@ -1,116 +0,0 @@ -# ~/.bashrc: executed by bash(1) for non-login shells. - -# You may uncomment the following lines if you want `ls' to be colorized: -# export LS_OPTIONS='--color=auto' -# eval "`dircolors`" -# alias ls='ls $LS_OPTIONS' -# alias ll='ls $LS_OPTIONS -l' -# alias l='ls $LS_OPTIONS -lA' -# -# Some more alias to avoid making mistakes: -# alias rm='rm -i' -# alias cp='cp -i' -# alias mv='mv -i' -# ~/.bashrc: executed by bash(1) for non-login shells. -# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) -# for examples - -# don't put duplicate lines or lines starting with space in the history. -# See bash(1) for more options -HISTCONTROL=ignoreboth - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=1000 -HISTFILESIZE=2000 - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -#shopt -s globstar - -# make less more friendly for non-text input files, see lesspipe(1) -#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (used in the prompt below) -if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm-color) color_prompt=yes;; -esac - -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - -# This is just a better prompt -if [ "$color_prompt" = yes ]; then - PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\] " -else - PS1='┌──[\u@\h]─[\w]\n└──╼ \$ ' -fi - -# enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' -fi - -# some more ls aliases -#alias ll='ls -l' -#alias la='ls -A' -#alias l='ls -CF' - -# Alias definitions. -# You may want to put all your additions into a separate file like -# ~/.bash_aliases, instead of adding them here directly. -# See /usr/share/doc/bash-doc/examples in the bash-doc package. - -if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases -fi - -# I like my own functions file -if [ -f ~/.bash_functions ]; then - . ~/.bash_functions -fi - -# enable programmable completion features (you don't need to enable -# this, if it's already enabled in /etc/bash.bashrc and /etc/profile -# sources /etc/bash.bashrc). -if ! shopt -oq posix; then - if [ -f /usr/share/bash-completion/bash_completion ]; then - . /usr/share/bash-completion/bash_completion - elif [ -f /etc/bash_completion ]; then - . /etc/bash_completion - fi -fi - -# My classic opener, props to liveoverflow -echo "Knock knock, Agr0." diff --git a/master-tmux_conf b/master-tmux_conf deleted file mode 100644 index 55cf067..0000000 --- a/master-tmux_conf +++ /dev/null @@ -1,14 +0,0 @@ -# remap CTRL-b to CTRL-a because it's better -unbind C-b -set-option -g prefix C-a -bind-key C-a send-prefix - -# vi master race -set -g mode-keys vi -set -sg escape-time 0 - -# I <3 history -set -g history-limit 500000 - -# colors! -set -g default-terminal "screen-256color" diff --git a/parrot.yml b/parrot.yml deleted file mode 100644 index c599d63..0000000 --- a/parrot.yml +++ /dev/null @@ -1,265 +0,0 @@ ---- - - hosts: localhost - become: yes - vars: - docker_repo_key: "https://download.docker.com/linux/debian/gpg" - docker_repo: "deb [arch=amd64] https://download.docker.com/linux/debian buster stable" - sublime_repo_key: "https://download.sublimetext.com/sublimehq-pub.gpg" - sublime_repo: "deb https://download.sublimetext.com/ apt/stable/" - ysoserial_jar: "https://github.com/frohoff/ysoserial/releases/latest/download/ysoserial-all.jar" - # good_repo: - # - "deb https://mirror.clarkson.edu/parrot/ rolling main contrib non-free" - # - "deb-src https://mirror.clarkson.edu/parrot/ rolling main contrib non-free" - # bad_repo: - # - "deb https://deb.parrot.sh/parrot/ rolling main contrib non-free" - # - "deb-src https://deb.parrot.sh/parrot/ rolling main contrib non-free" - tasks: - - name: Add Docker Repo Key - ansible.builtin.apt_key: - url: "{{ docker_repo_key }}" - state: present - - - name: Add Docker Repo - ansible.builtin.apt_repository: - repo: "{{ docker_repo }}" - state: present - - - name: Add Sublime Text Repo Key - ansible.builtin.apt_key: - url: "{{ sublime_repo_key }}" - state: present - - - name: Add Sublime Text Repo - ansible.builtin.apt_repository: - repo: "{{ sublime_repo }}" - state: present - - # - name: Not using auto-repo (this may work for you, but not for me) - # apt_repository: - # repo: "{{ item }}" - # state: absent - # loop: "{{ bad_repo }}" - - # - name: Specifying a better repo - # apt_repository: - # repo: "{{ item }}" - # state: present - # loop: "{{ good_repo }}" - - - name: Ensuring all packages are up to date - ansible.builtin.apt: - update_cache: yes - upgrade: dist - - - name: Get this neovim crap outta here (╯°□°)╯︵ ┻━┻ - ansible.builtin.apt: - name: neovim - state: absent - - - name: Installing one-off packages from package manager - ansible.builtin.apt: - update_cache: yes - name: - - vim - - gawk - - terminator - - gobuster - - python3-dev - - python3-pip - - pipx - - neo4j - - rlwrap - - eog - - xclip - - steghide - - git - - ltrace - - strace - - gdb - - gdbserver - - docker - - docker-compose - - forensics-extra - - ncat - - jq - - powershell - - samba - - tmux - - libssl-dev - - libffi-dev - - build-essential - - open-vm-tools - - open-vm-tools-desktop - - remmina - - sublime-text - state: latest - force_apt_get: yes - - - name: Install CrackMapExec - community.general.pipx: - name: crackmapexec - - - name: Install ShellUp! - ansible.builtin.git: - repo: 'https://github.com/AgroDan/shellup.git' - dest: /opt/shellup - - - name: Install Seclists (Kali has this in the repos) - ansible.builtin.git: - repo: 'https://github.com/danielmiessler/SecLists.git' - dest: /opt/seclists - - - name: Install pwntools - ansible.builtin.pip: - name: git+https://github.com/Gallopsled/pwntools.git@dev - - - name: Clone Invoke-Obfuscation (•_•) ( •_•)>⌐■-■ (⌐■_■) - ansible.builtin.git: - repo: 'https://github.com/danielbohannon/Invoke-Obfuscation' - dest: /opt/Invoke-Obfuscation - - - name: Clone JumboJohn - ansible.builtin.git: - repo: 'https://github.com/magnumripper/JohnTheRipper' - dest: /opt/JohnTheRipper - - - name: Compiling JumboJohn, hold onto yer butts... - ansible.builtin.command: chdir=/opt/JohnTheRipper/src {{ item }} - with_items: - - ./configure - - make - - make install - - - name: Clone Nishang - ansible.builtin.git: - repo: 'https://github.com/samratashok/nishang' - dest: /opt/nishang - - - name: Clone Chisel - ansible.builtin.git: - repo: 'https://github.com/jpillora/chisel' - dest: /opt/chisel - - - name: Clone LinEnum - ansible.builtin.git: - repo: 'https://github.com/rebootuser/LinEnum' - dest: /opt/LinEnum - - - name: Clone PEASS - ansible.builtin.git: - repo: 'https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite' - dest: /opt/privilege-escalation-awesome-scripts-suite - - - name: Clone PowerSploit - ansible.builtin.git: - repo: 'https://github.com/PowerShellMafia/PowerSploit' - dest: /opt/PowerSploit - - - name: Clone Impacket - ansible.builtin.git: - repo: 'https://github.com/SecureAuthCorp/impacket' - dest: /opt/impacket - - - name: Clone Bloodhound - ansible.builtin.git: - repo: 'https://github.com/BloodHoundAD/BloodHound' - dest: /opt/BloodHound - - - name: Clone Gef - ansible.builtin.git: - repo: 'https://github.com/hugsy/gef.git' - dest: /opt/gef - - - name: Clone Static Binaries - ansible.builtin.git: - repo: 'https://github.com/andrew-d/static-binaries' - dest: /opt/static-binaries - - - name: Clone Ysoserial - ansible.builtin.git: - repo: 'https://github.com/frohoff/ysoserial' - dest: /opt/ysoserial - - - name: Downloading Ysoserial JAR file - ansible.builtin.get_url: - url: "{{ ysoserial_jar }}" - dest: /opt/ysoserial/ysoserial-all.jar - mode: '0644' - - - name: Get Evil-WinRM via gem installer - ansible.builtin.gem: - name: evil-winrm - state: latest - user_install: no - - - name: Disable mouse interactivity in vim (╯°□°)╯︵ ┻━┻ - ansible.builtin.blockinfile: - path: /etc/vim/vimrc - marker: "\" {mark} ANSIBLE MANAGED BLOCK" - insertafter: EOF - state: present - block: | - set mouse= - set ttymouse= - - - name: Getting all interactive users <> - ansible.builtin.shell: "awk -F: '{ if (($3 >= 1000 && $3 != 65534) || $3 == 0) print $1}' /etc/passwd" - register: users - - - name: Initialize Gef for all users - ansible.builtin.script: /opt/gef/scripts/gef.sh - become_user: "{{ item }}" - loop: "{{ users.stdout_lines }}" - - - name: Copying over bashrc file to all users - ansible.builtin.copy: - src: /tmp/master-bashrc - dest: "~{{ item }}/.bashrc" - owner: "{{ item }}" - group: "{{ item }}" - mode: '0640' - loop: "{{ users.stdout_lines }}" - - - name: Copying over bash functions file for all users - ansible.builtin.copy: - src: /tmp/master-bash_functions - dest: "~{{ item }}/.bash_functions" - owner: "{{ item }}" - group: "{{ item }}" - mode: '0640' - loop: "{{ users.stdout_lines }}" - - - name: Copying over tmux config to all users - ansible.builtin.copy: - src: /tmp/master-tmux_conf - dest: "~{{ item }}/.tmux.conf" - owner: "{{ item }}" - group: "{{ item }}" - mode: '0640' - loop: "{{ users.stdout_lines }}" - - - name: Create /srv/smb/ directory for payload population - ansible.builtin.file: - path: /srv/smb - state: directory - mode: '0755' - - - name: Creating IWR share in samba config - ansible.builtin.blockinfile: - path: /etc/samba/smb.conf - insertafter: EOF - state: present - block: | - [iwr] - comment = Invoke-WebReq'd em? Damn near killed em! - path = /srv/smb - guest ok = yes - browseable = yes - create mask = 0600 - directory mask = 0755 - - - name: Ensure that samba doesn't start on boot - ansible.builtin.systemd: - name: smbd - enabled: no - state: stopped diff --git a/setup-kali.sh b/setup-kali.sh deleted file mode 100644 index d8f2471..0000000 --- a/setup-kali.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as sudo or root." - exit 1 -fi - -# Generate psuedo-random string to fool servers into not giving you -# cached crap, mostly for debugging purposes. This is kinda neato -RANDO=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n1) - -echo "***********************************" -echo "* Installing pip *" -echo "***********************************" - -curl -s https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py -python3 /tmp/get-pip.py --user --no-warn-script-location - -export PATH=$PATH:/root/.local/bin - -echo "***********************************" -echo "* Installing ansible *" -echo "***********************************" - -pip install ansible - -echo "***********************************" -echo "* Pulling master bashrc *" -echo "***********************************" - -curl -sL "http://raw.github.com/AgroDan/FreshInstall/master/master-bashrc?nocache=$RANDO" -o /tmp/master-bashrc - -echo "***********************************" -echo "* Pulling bash_functions *" -echo "***********************************" - -curl -sL "http://raw.github.com/AgroDan/FreshInstall/master/master-bash_functions?nocache=$RANDO" -o /tmp/master-bash_functions - -echo "***********************************" -echo "* Pulling .tmux.conf *" -echo "***********************************" - -curl -sL "http://raw.github.com/AgroDan/FreshInstall/master/master-tmux_conf?nocache=$RANDO" -o /tmp/master-tmux_conf - -echo "***********************************" -echo "* Running Kali playbook *" -echo "***********************************" - -curl -sL "http://raw.github.com/AgroDan/FreshInstall/master/kali.yml?nocache=$RANDO" -o /tmp/kali.yml - -ansible-playbook /tmp/kali.yml - -echo "***********************************" -echo "* Cleaning up *" -echo "***********************************" - -rm -f /tmp/master-bashrc /tmp/master-bash_functions /tmp/master-tmux_conf /tmp/get-pip.py /tmp/kali.yml - -echo "***********************************" -echo "* Done! *" -echo "***********************************" - -echo "You should be set up. Check above for any errors." diff --git a/setup-parrot.sh b/setup-parrot.sh deleted file mode 100644 index 314719e..0000000 --- a/setup-parrot.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as sudo or root." - exit 1 -fi - -# Generate psuedo-random string to fool servers into not giving you -# cached crap, mostly for debugging purposes. This is kinda neato -RANDO=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n1) - -echo "***********************************" -echo "* Installing pip *" -echo "***********************************" - -curl -s https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py -python3 /tmp/get-pip.py --user --no-warn-script-location - -export PATH=$PATH:/root/.local/bin - -echo "***********************************" -echo "* Installing ansible *" -echo "***********************************" - -pip install ansible - -echo "***********************************" -echo "* Installing Ansible Collection *" -echo "***********************************" - -ansible-galaxy collection install community.general - -echo "***********************************" -echo "* Pulling master bashrc *" -echo "***********************************" - -curl -sL "http://raw.github.com/AgroDan/FreshInstall/master/master-bashrc?nocache=$RANDO" -o /tmp/master-bashrc - -echo "***********************************" -echo "* Pulling bash_functions *" -echo "***********************************" - -curl -sL "http://raw.github.com/AgroDan/FreshInstall/master/master-bash_functions?nocache=$RANDO" -o /tmp/master-bash_functions - -echo "***********************************" -echo "* Pulling .tmux.conf *" -echo "***********************************" - -curl -sL "http://raw.github.com/AgroDan/FreshInstall/master/master-tmux_conf?nocache=$RANDO" -o /tmp/master-tmux_conf - -echo "***********************************" -echo "* Running ParrotOS playbook *" -echo "***********************************" - -curl -sL "http://raw.github.com/AgroDan/FreshInstall/master/parrot.yml?nocache=$RANDO" -o /tmp/parrot.yml - -ansible-playbook /tmp/parrot.yml - -echo "***********************************" -echo "* Cleaning up *" -echo "***********************************" - -rm -f /tmp/master-bashrc /tmp/master-bash_functions /tmp/master-tmux_conf /tmp/get-pip.py /tmp/parrot.yml - -echo "***********************************" -echo "* Done! *" -echo "***********************************" - -echo "You should be set up. Check above for any errors." diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..50a7f46 --- /dev/null +++ b/setup.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Exit immediately on failure +set -eu + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as sudo or root." + exit 1 +fi + +PATH_TO_SCRIPT=$(dirname $0) +ZSH_FUNC_FILE="zsh_functions.zsh" +TMUX_FILE="tmux_conf" + +echo "***********************************" +echo "* Installing pip *" +echo "***********************************" + +curl -s https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py +python3 /tmp/get-pip.py --user --no-warn-script-location + +export PATH=$PATH:/root/.local/bin + +echo "***********************************" +echo "* Installing ansible *" +echo "***********************************" + +pip install ansible + +echo "***********************************" +echo "* Running Kali playbook *" +echo "***********************************" + +ansible-playbook ${PATH_TO_SCRIPT}/kali.yml --extra-vars "tmux=${PATH_TO_SCRIPT}/${TMUX_FILE} zsh_func=${PATH_TO_SCRIPT}/${ZSH_FUNC_FILE}" + +echo "***********************************" +echo "* Done! *" +echo "***********************************" + +echo "You should be set up. Check above for any errors." diff --git a/tmux_conf b/tmux_conf new file mode 100644 index 0000000..55cf067 --- /dev/null +++ b/tmux_conf @@ -0,0 +1,14 @@ +# remap CTRL-b to CTRL-a because it's better +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# vi master race +set -g mode-keys vi +set -sg escape-time 0 + +# I <3 history +set -g history-limit 500000 + +# colors! +set -g default-terminal "screen-256color" diff --git a/zsh_functions.zsh b/zsh_functions.zsh new file mode 100644 index 0000000..5dd56f6 --- /dev/null +++ b/zsh_functions.zsh @@ -0,0 +1,17 @@ +# This is a handy list of functions I use + +scan() { + SCANDIR="${PWD}/nmap_scans" + if [ -z $1 ]; + then + read "TARGET?Enter a target: " + else + TARGET=$1 + fi + + echo "Scanning ${TARGET}..." + mkdir -p $SCANDIR + sudo nmap -sS -sV -sC -oN $SCANDIR/initial-scan -v $TARGET + sudo nmap -sS -p- -oN $SCANDIR/allports -v0 $TARGET &disown + sudo nmap -sU -oN $SCANDIR/udpports -v0 $TARGET &disown +} \ No newline at end of file -- cgit v1.2.3 From c7145109b9df30d139ec1175daab36d495fadbbd Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Sun, 6 Nov 2022 21:06:53 -0500 Subject: README clarification --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4b9b4a5..b26fde7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Fresh Install +# Golden Kali I believe every Kali VM should be ephemeral. Build it, do your damage, then blow it away. While that's impractical to do it for every single engagement, and since Kali is *almost perfect*, there are still a bunch of things that I modify after a fresh Kali build. Since re-doing all of those tasks is tiresome, I decided to create a solid foundation of "good enough" to start off a fresh build of Kali and download all of the tools I find myself using all the time. So I made this script. It starts a bash script to install pip, then install ansible, then use ansible to download all the appropriate packages, clone the appropriate repositories, and make the appropriate modifications to the system to get it to a point close enough to how I like. And if you don't like my modifications, I encourage you to fork this repo and make your own changes. @@ -6,10 +6,12 @@ And if you don't like my modifications, I encourage you to fork this repo and ma ## Usage If you just started up a new instance of **Kali**, to get it to a "proper working setup" that I've come to like, simply run the following command from a terminal: -`curl -sL https://raw.github.com/AgroDan/FreshInstall/master/setup-kali.sh | sudo bash` +`git clone https://github.com/AgroDan/Golden-Kali.git && sudo bash ./Golden-Kali/setup.sh` -I also dabble a bit in **Parrot OS**. I've since created a similar bootstrap for it as well: +The previous command used to be a `curl` instruction piped to `bash`. I changed that to a `git clone` instead to change up the way files would be included. It was cleaner and I was able to mess around with. I may be installing malicious software, but I wish no mal-intent to you. Peace, love, and hack all the things. -`curl -sL https://raw.github.com/AgroDan/FreshInstall/master/setup-parrot.sh | sudo bash` +## Changelog -I know the flippant instruction of "copy this curl | bash command as root" is scary, but this is after all github, so feel free to look through the provided code to know that I'm not installing some crazy backdoor or anything. I may be installing malicious software, but I wish no mal-intent to you. Peace, love, and hack all the things. +I made some significant changes to this repository from the previous iteration. First, the name has been changed to `golden-kali`. Second, I have removed support for ParrotOS. It's generally something I don't use all that often to support it, so this is what you have. I'm sure you can apply all of the ideas here for a ParrotOS build as well if that's your thing. + +Many of the changes here came as a result of this repository being included as a necessary install step process for the Red Team at (https://cyberforce.energy.gov/cyberforce-competition/)[DoE's Cyberforce Competition] in 2022. The code was modified heavily for the event's exhaustive playbook. I took what I had learned there and simply applied it here. \ No newline at end of file -- cgit v1.2.3 From 2a79c8c3499437ede38c81c82c2ca48b91ba3191 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 09:49:21 -0500 Subject: Fixed horrible typo that broke the whole thing --- README.md | 2 +- kali.yml | 7 ++++--- setup.sh | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b26fde7..3c46a84 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ And if you don't like my modifications, I encourage you to fork this repo and ma ## Usage If you just started up a new instance of **Kali**, to get it to a "proper working setup" that I've come to like, simply run the following command from a terminal: -`git clone https://github.com/AgroDan/Golden-Kali.git && sudo bash ./Golden-Kali/setup.sh` +`git clone https://github.com/AgroDan/golden-kali.git && sudo bash ./golden-kali/setup.sh` The previous command used to be a `curl` instruction piped to `bash`. I changed that to a `git clone` instead to change up the way files would be included. It was cleaner and I was able to mess around with. I may be installing malicious software, but I wish no mal-intent to you. Peace, love, and hack all the things. diff --git a/kali.yml b/kali.yml index 4bf2127..59f8735 100644 --- a/kali.yml +++ b/kali.yml @@ -9,8 +9,9 @@ ysoserial_jar: "https://github.com/frohoff/ysoserial/releases/latest/download/ysoserial-all.jar" kitty_installer: "https://sw.kovidgoyal.net/kitty/installer.sh" tasks: - - ansible.builtin.fail: - msg: "This playbook must be run properly! Execute sudo bash setup.sh" + - name: Confirming playbook was run properly + ansible.builtin.fail: + msg: "Do not call this playbook directly! Execute sudo bash setup.sh" when: tmux is not defined or zsh_func is not defined - name: Add Docker repo key @@ -194,7 +195,7 @@ user_install: no - name: Install Kitty Terminal Emulator 🐱 - ansible.builtin.command: "/usr/bin/curl -sL {{ kitty_installer }} | sh /dev/sdtin dest=/opt launch=n" + ansible.builtin.command: "/usr/bin/curl -sL {{ kitty_installer }} | sh /dev/stdin dest=/opt launch=n" - name: Create Desktop Icon for Kitty 🐱 ansible.builtin.copy: diff --git a/setup.sh b/setup.sh index 50a7f46..7bc8a54 100644 --- a/setup.sh +++ b/setup.sh @@ -37,4 +37,4 @@ echo "***********************************" echo "* Done! *" echo "***********************************" -echo "You should be set up. Check above for any errors." +echo "You should reboot your system now." -- cgit v1.2.3 From 71003821ac5630c8ea73851d4b87550c3eaf7c24 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 09:50:53 -0500 Subject: LERN2MARKDOWN --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c46a84..d8e3368 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,4 @@ The previous command used to be a `curl` instruction piped to `bash`. I changed I made some significant changes to this repository from the previous iteration. First, the name has been changed to `golden-kali`. Second, I have removed support for ParrotOS. It's generally something I don't use all that often to support it, so this is what you have. I'm sure you can apply all of the ideas here for a ParrotOS build as well if that's your thing. -Many of the changes here came as a result of this repository being included as a necessary install step process for the Red Team at (https://cyberforce.energy.gov/cyberforce-competition/)[DoE's Cyberforce Competition] in 2022. The code was modified heavily for the event's exhaustive playbook. I took what I had learned there and simply applied it here. \ No newline at end of file +Many of the changes here came as a result of this repository being included as a necessary install step process for the Red Team at [DoE's Cyberforce Competition](https://cyberforce.energy.gov/cyberforce-competition/) in 2022. The code was modified heavily for the event's exhaustive playbook. I took what I had learned there and simply applied it here. \ No newline at end of file -- cgit v1.2.3 From d205bb0f7bc281b804e0f1a68c972ac7634df73c Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 10:09:01 -0500 Subject: Wrong ansible module used for kitty install --- kali.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kali.yml b/kali.yml index 59f8735..5a147aa 100644 --- a/kali.yml +++ b/kali.yml @@ -195,7 +195,8 @@ user_install: no - name: Install Kitty Terminal Emulator 🐱 - ansible.builtin.command: "/usr/bin/curl -sL {{ kitty_installer }} | sh /dev/stdin dest=/opt launch=n" + ansible.builtin.shell: + cmd: "/usr/bin/curl -sL {{ kitty_installer }} | sh /dev/stdin dest=/opt launch=n" - name: Create Desktop Icon for Kitty 🐱 ansible.builtin.copy: -- cgit v1.2.3 From 0887f9ab50cd2f10bc26383093239e9b27c9d686 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 10:14:38 -0500 Subject: Fixing more dumb mistakes --- kali.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kali.yml b/kali.yml index 5a147aa..3cc1272 100644 --- a/kali.yml +++ b/kali.yml @@ -200,7 +200,7 @@ - name: Create Desktop Icon for Kitty 🐱 ansible.builtin.copy: - dest: "/usr/share/applications" + dest: "/usr/share/applications/kitty.desktop" content: | [Desktop Entry] Version=0.26.2 -- cgit v1.2.3 From ca83fcf15ea6a276116812c426ae042e2feb0e30 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 10:16:42 -0500 Subject: Dev note: Do not code with a lack of sleep --- kali.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kali.yml b/kali.yml index 3cc1272..9090633 100644 --- a/kali.yml +++ b/kali.yml @@ -248,7 +248,7 @@ loop: "{{ users.stdout_lines }}" - name: Enabling zsh functions - loop: "{{ users.stdout_lins }}" + loop: "{{ users.stdout_lines }}" ansible.builtin.blockinfile: path: "~{{ item }}/.zshrc" state: present -- cgit v1.2.3 From fe3212ab386017573698a5a0b62f7207988f6d62 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 10:35:43 -0500 Subject: Additional kitty stuff --- kali.yml | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/kali.yml b/kali.yml index 9090633..0dd2bd6 100644 --- a/kali.yml +++ b/kali.yml @@ -194,6 +194,10 @@ state: latest user_install: no + - name: Getting all interactive users + ansible.builtin.shell: "awk -F: '{ if (($3 >= 1000 && $3 != 65534) || $3 == 0) print $1}' /etc/passwd" + register: users + - name: Install Kitty Terminal Emulator 🐱 ansible.builtin.shell: cmd: "/usr/bin/curl -sL {{ kitty_installer }} | sh /dev/stdin dest=/opt launch=n" @@ -209,6 +213,34 @@ Exec=/opt/kitty.app/bin/kitty Icon=/opt/kitty.app/share/icons/hicolor/256x256/apps/kitty.png Categories=Utility + + - name: Prepare kitty.conf files for all interactive users 🐱 + loop: "{{ users.stdout_lines }}" + ansible.builtin.file: + dest: "~{{ item }}/.config/kitty/kitty.conf" + state: touch + recurse: yes + owner: "{{ item }}" + group: "{{ item }}" + + - name: Prepare personalized configs for Kitty 🐱 + loop: "{{ users.stdout_lines }}" + ansible.builtin.blockinfile: + path: "~{{ item }}/.config/kitty/kitty.conf" + insertafter: EOF + state: present + block: | + # New windows open in current directory + map ctrl+shift+enter launch --cwd=current + + # New tabs open in current directory + map ctrl+t new_tab --cwd=current + + # The coveted "zoom" function + map ctrl+shift+z toggle_layout stack + + # Disable mouse-click a link to open in a browser + mouse_map left click ungrabbed no_op - name: Disable mouse interactivity in vim (╯°□°)╯︵ ┻━┻ ansible.builtin.blockinfile: @@ -220,9 +252,6 @@ set mouse= set ttymouse= - - name: Getting all interactive users - ansible.builtin.shell: "awk -F: '{ if (($3 >= 1000 && $3 != 65534) || $3 == 0) print $1}' /etc/passwd" - register: users - name: Add sudo-NOPASSWD to users loop: "{{ users.stdout_lines }}" -- cgit v1.2.3 From 274d41d44693e6f0d13178e3c365131f4610178e Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 10:38:24 -0500 Subject: Fixing yet another dumb mistake --- kali.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kali.yml b/kali.yml index 0dd2bd6..bb55755 100644 --- a/kali.yml +++ b/kali.yml @@ -217,11 +217,12 @@ - name: Prepare kitty.conf files for all interactive users 🐱 loop: "{{ users.stdout_lines }}" ansible.builtin.file: - dest: "~{{ item }}/.config/kitty/kitty.conf" + dest: "~{{ item }}/.config/kitty/" state: touch recurse: yes owner: "{{ item }}" group: "{{ item }}" + mode: 0755 - name: Prepare personalized configs for Kitty 🐱 loop: "{{ users.stdout_lines }}" -- cgit v1.2.3 From 586198df376690aa7bed3d2e31b98d0dcad00efa Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 10:40:07 -0500 Subject: BAD DOBBY BAD BAD BAD --- kali.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kali.yml b/kali.yml index bb55755..b9b88eb 100644 --- a/kali.yml +++ b/kali.yml @@ -218,7 +218,7 @@ loop: "{{ users.stdout_lines }}" ansible.builtin.file: dest: "~{{ item }}/.config/kitty/" - state: touch + state: directory recurse: yes owner: "{{ item }}" group: "{{ item }}" -- cgit v1.2.3 From accb338b3ad6487ce1b82dd24ed38a6de5edaa19 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 10:51:44 -0500 Subject: one step at a time... --- kali.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/kali.yml b/kali.yml index b9b88eb..ed5095e 100644 --- a/kali.yml +++ b/kali.yml @@ -229,6 +229,7 @@ ansible.builtin.blockinfile: path: "~{{ item }}/.config/kitty/kitty.conf" insertafter: EOF + create: yes state: present block: | # New windows open in current directory -- cgit v1.2.3 From c059e2bf4d0050f7e08b38944c1065c2fde4d278 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 11:28:13 -0500 Subject: Bugfixes and more documentation --- README.md | 16 +++++++++++++--- kali.yml | 8 ++++++++ setup.sh | 17 +++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d8e3368..c4b1f2e 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,22 @@ And if you don't like my modifications, I encourage you to fork this repo and ma ## Usage If you just started up a new instance of **Kali**, to get it to a "proper working setup" that I've come to like, simply run the following command from a terminal: -`git clone https://github.com/AgroDan/golden-kali.git && sudo bash ./golden-kali/setup.sh` +```bash +git clone https://github.com/AgroDan/golden-kali.git && sudo bash ./golden-kali/setup.sh +``` -The previous command used to be a `curl` instruction piped to `bash`. I changed that to a `git clone` instead to change up the way files would be included. It was cleaner and I was able to mess around with. I may be installing malicious software, but I wish no mal-intent to you. Peace, love, and hack all the things. +The previous command used to be a `curl` instruction piped to `bash`. I changed that to a `git clone` instead to change up the way files would be included. It was cleaner and I was able to mess around with ansible's conditional logic a bit more. Note you are still allowing code to execute as the root user to install various tools that *I personally* find very useful. They may not be what you find useful, they may not be what you prefer. Please review the code above as it is all open source for your assurance. Know this: I may be installing malicious software, but I wish no mal-intent to you. Peace, love, and hack all the things. ## Changelog I made some significant changes to this repository from the previous iteration. First, the name has been changed to `golden-kali`. Second, I have removed support for ParrotOS. It's generally something I don't use all that often to support it, so this is what you have. I'm sure you can apply all of the ideas here for a ParrotOS build as well if that's your thing. -Many of the changes here came as a result of this repository being included as a necessary install step process for the Red Team at [DoE's Cyberforce Competition](https://cyberforce.energy.gov/cyberforce-competition/) in 2022. The code was modified heavily for the event's exhaustive playbook. I took what I had learned there and simply applied it here. \ No newline at end of file +Many of the changes here came as a result of this repository being included as a necessary install step process for the Red Team at [DoE's Cyberforce Competition](https://cyberforce.energy.gov/cyberforce-competition/) in 2022. The code was modified heavily for the event's exhaustive playbook. I took what I had learned there and simply applied it here. + +## Caveat Emptor + +Through exhaustive testing and re-testing, we have determined that this will install approximately XX Gigabytes of data onto your Kali machine. It is advised that you have at least YY Gigabytes free before running this installer! + +Despite all of our efforts, no one has been able to get this script to work on Apple's M1 architecture. This is for AMD64 only. Sorry! + +This script takes a _long_ time to complete. The longest step is patching and updating the machine before executing any of the plays. It is advised for your own sanity to ensure that your machine is patched to the latest before running this script. \ No newline at end of file diff --git a/kali.yml b/kali.yml index ed5095e..7a65a77 100644 --- a/kali.yml +++ b/kali.yml @@ -113,6 +113,14 @@ - make - make install + - name: Install trufflehog + ansible.builtin.pip: + name: trufflehog + + - name: Install LDAPDomainDump + ansible.builtin.pip: + name: ldapdomaindump + - name: Clone Nishang ansible.builtin.git: repo: 'https://github.com/samratashok/nishang' diff --git a/setup.sh b/setup.sh index 7bc8a54..5a42b91 100644 --- a/setup.sh +++ b/setup.sh @@ -3,15 +3,28 @@ # Exit immediately on failure set -eu +# Are we running in bash? +# Single bracket to be posix compliant in case we run in sh or something +if [ ! -z ${BASH} ]; then + echo "This script must be run from the Bash shell!" + exit 1 +fi + +# Are we root? if [[ $EUID -ne 0 ]]; then echo "This script must be run as sudo or root." - exit 1 + exit 2 fi -PATH_TO_SCRIPT=$(dirname $0) +PATH_TO_SCRIPT=$(dirname $(readlink -f $0)) ZSH_FUNC_FILE="zsh_functions.zsh" TMUX_FILE="tmux_conf" +if [[ ! -e ${PATH_TO_SCRIPT}/${ZSH_FUNC_FILE} ]] && [[ ! -e ${PATH_TO_SCRIPT}/${TMUX_FILE} ]]; then + echo "Cannot find supporting files! Please clone repository and try again!" + exit 3 +fi + echo "***********************************" echo "* Installing pip *" echo "***********************************" -- cgit v1.2.3 From 27dc9030e0de0c6622ae3f2cde189988d4a8464a Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 11:33:52 -0500 Subject: Bugfixes --- README.md | 2 +- setup.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c4b1f2e..c665a63 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Many of the changes here came as a result of this repository being included as a ## Caveat Emptor -Through exhaustive testing and re-testing, we have determined that this will install approximately XX Gigabytes of data onto your Kali machine. It is advised that you have at least YY Gigabytes free before running this installer! +Through exhaustive testing and re-testing, we have determined that this will install approximately 13 Gigabytes of data onto your Kali machine. It is advised that you have at least 15 Gigabytes free before running this installer! Despite all of our efforts, no one has been able to get this script to work on Apple's M1 architecture. This is for AMD64 only. Sorry! diff --git a/setup.sh b/setup.sh index 5a42b91..2148bd8 100644 --- a/setup.sh +++ b/setup.sh @@ -5,7 +5,7 @@ set -eu # Are we running in bash? # Single bracket to be posix compliant in case we run in sh or something -if [ ! -z ${BASH} ]; then +if [ -z ${BASH} ]; then echo "This script must be run from the Bash shell!" exit 1 fi -- cgit v1.2.3