From c012b2026d4908e8533e6d3c3d8b89d36b11f168 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 12 Jun 2023 16:48:51 -0400 Subject: Now using ansible roles. also removed linpeass --- kali.md | 38 ---- kali.yml | 334 ---------------------------- main.yml | 10 + master-bash_functions | 9 - roles/custom-config/README.md | 38 ++++ roles/custom-config/defaults/main.yml | 2 + roles/custom-config/files/tmux_conf | 14 ++ roles/custom-config/files/zsh_functions.zsh | 26 +++ roles/custom-config/handlers/main.yml | 2 + roles/custom-config/meta/main.yml | 52 +++++ roles/custom-config/tasks/main.yml | 132 +++++++++++ roles/custom-config/tests/inventory | 2 + roles/custom-config/tests/test.yml | 5 + roles/custom-config/vars/main.yml | 3 + roles/individual-apps/README.md | 38 ++++ roles/individual-apps/defaults/main.yml | 2 + roles/individual-apps/handlers/main.yml | 2 + roles/individual-apps/meta/main.yml | 52 +++++ roles/individual-apps/tasks/main.yml | 106 +++++++++ roles/individual-apps/tests/inventory | 2 + roles/individual-apps/tests/test.yml | 5 + roles/individual-apps/vars/main.yml | 3 + roles/package-mgmt/README.md | 38 ++++ roles/package-mgmt/defaults/main.yml | 2 + roles/package-mgmt/handlers/main.yml | 2 + roles/package-mgmt/meta/main.yml | 52 +++++ roles/package-mgmt/tasks/main.yml | 76 +++++++ roles/package-mgmt/tests/inventory | 2 + roles/package-mgmt/tests/test.yml | 5 + roles/package-mgmt/vars/main.yml | 6 + setup.sh | 9 +- tmux_conf | 14 -- zsh_functions.zsh | 26 --- 33 files changed, 680 insertions(+), 429 deletions(-) delete mode 100644 kali.md delete mode 100644 kali.yml create mode 100644 main.yml delete mode 100644 master-bash_functions create mode 100644 roles/custom-config/README.md create mode 100644 roles/custom-config/defaults/main.yml create mode 100644 roles/custom-config/files/tmux_conf create mode 100644 roles/custom-config/files/zsh_functions.zsh create mode 100644 roles/custom-config/handlers/main.yml create mode 100644 roles/custom-config/meta/main.yml create mode 100644 roles/custom-config/tasks/main.yml create mode 100644 roles/custom-config/tests/inventory create mode 100644 roles/custom-config/tests/test.yml create mode 100644 roles/custom-config/vars/main.yml create mode 100644 roles/individual-apps/README.md create mode 100644 roles/individual-apps/defaults/main.yml create mode 100644 roles/individual-apps/handlers/main.yml create mode 100644 roles/individual-apps/meta/main.yml create mode 100644 roles/individual-apps/tasks/main.yml create mode 100644 roles/individual-apps/tests/inventory create mode 100644 roles/individual-apps/tests/test.yml create mode 100644 roles/individual-apps/vars/main.yml create mode 100644 roles/package-mgmt/README.md create mode 100644 roles/package-mgmt/defaults/main.yml create mode 100644 roles/package-mgmt/handlers/main.yml create mode 100644 roles/package-mgmt/meta/main.yml create mode 100644 roles/package-mgmt/tasks/main.yml create mode 100644 roles/package-mgmt/tests/inventory create mode 100644 roles/package-mgmt/tests/test.yml create mode 100644 roles/package-mgmt/vars/main.yml delete mode 100644 tmux_conf delete mode 100644 zsh_functions.zsh diff --git a/kali.md b/kali.md deleted file mode 100644 index f893a3f..0000000 --- a/kali.md +++ /dev/null @@ -1,38 +0,0 @@ -## To install Kali and make it useful, install the following from apt: - -- terminator -- jxplorer -- seclists -- gobuster -- python3-pip -- crackmapexec -- neo4j (for bloodhound) -- openjdk-14-jdk (for things that are still made in Java for some reason like Ghidra) -- rlwrap -- eog -- xclip -- exif -- steghide - -## From github: -- JumboJohn: https://github.com/magnumripper/JohnTheRipper -- Nishang: https://github.com/samratashok/nishang -- Chisel: https://github.com/jpillora/chisel -- LinEnum: https://github.com/rebootuser/LinEnum -- PEASS: https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite -- PowerSploit: https://github.com/PowerShellMafia/PowerSploit - - (then switch to Dev branch) git checkout dev -- Impacket: https://github.com/SecureAuthCorp/impacket - - Impacket scripts come with Kali, but git repo is more recent. Use the setup.py to build and install before using. Then use python3 to execute! -- Bloodhound: https://github.com/BloodHoundAD/BloodHound - - start up neo4j: neo4j console - - Visit the resulting localhost port - - Create a password for the neo4j user - -## Misc -- FoxyProxy for firefox -- Ghidra: https://ghidra-sre.org/ -- Evil-WinRM, install from gem: gem install evil-winrm -- Remove stupid mouse bindings in vim. Edit /etc/vim/vimrc and add: - - set mouse= - - set ttymouse= diff --git a/kali.yml b/kali.yml deleted file mode 100644 index 7a65a77..0000000 --- a/kali.yml +++ /dev/null @@ -1,334 +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 bullseye 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" - kitty_installer: "https://sw.kovidgoyal.net/kitty/installer.sh" - tasks: - - 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 - ansible.builtin.shell: curl -fsSL {{ docker_repo_key }} | gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/docker-ce-keyring.gpg - - - name: Add Docker repo - ansible.builtin.apt_repository: - repo: "{{ docker_repo }}" - state: present - - - name: Add Sublime Text repo key - ansible.builtin.shell: curl -fsSL {{ sublime_repo_key }} | gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/sublime-text-keyring.gpg - - - name: Add Sublime Text repo - ansible.builtin.apt_repository: - repo: "{{ sublime_repo }}" - state: present - - - name: Ensuring all packages are up to date - ansible.builtin.apt: - update_cache: yes - upgrade: dist - - - name: Installing one-off packages from package manager - ansible.builtin.package: - name: - - bloodhound - - build-essential - - bytecode-viewer - - clang - - cmake - - crackmapexec - - curl - - default-jdk - - default-jre - - docker - - docker-compose - - eog - - feroxbuster - - flex - - forensics-extra - - gawk - - gdb - - gdbserver - - ghidra - - git - - gobuster - - golang-go - - jq - - jxplorer - - libffi-dev - - 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 - - terminator - - tmux - - xclip - - xfce4-terminal - - zaproxy - - zlib1g-dev - state: latest - - - 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: 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' - 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: Installing Impacket - ansible.builtin.shell: "python3 /opt/impacket/setup.py build && python3 /opt/impacket/setup.py install" - args: - chdir: /opt/impacket - - - name: Clone Bloodhound.py - ansible.builtin.git: - repo: 'https://github.com/fox-it/BloodHound.py.git' - dest: /opt/BloodHound.py - - - name: Clone PyFuscation - ansible.builtin.git: - repo: 'https://github.com/CBHue/PyFuscation.git' - dest: /opt/PyFuscation - - - 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: Clone Kerbrute - ansible.builtin.git: - repo: 'https://github.com/ropnop/kerbrute.git' - dest: /opt/kerbrute - - - name: Building Kerbrute... - ansible.builtin.command: chdir=/opt/kerbrute make linux - - - 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 - community.general.gem: - name: evil-winrm - norc: yes - 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" - - - name: Create Desktop Icon for Kitty 🐱 - ansible.builtin.copy: - dest: "/usr/share/applications/kitty.desktop" - content: | - [Desktop Entry] - Version=0.26.2 - Type=Application - Name=Kitty Terminal Emulator - 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/" - state: directory - recurse: yes - owner: "{{ item }}" - group: "{{ item }}" - mode: 0755 - - - name: Prepare personalized configs for Kitty 🐱 - loop: "{{ users.stdout_lines }}" - ansible.builtin.blockinfile: - path: "~{{ item }}/.config/kitty/kitty.conf" - insertafter: EOF - create: yes - 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: - path: /etc/vim/vimrc - marker: "\" {mark} ANSIBLE MANAGED BLOCK" - insertafter: EOF - state: present - block: | - set mouse= - set ttymouse= - - - - 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 zsh functions file for all users - ansible.builtin.copy: - src: "{{ zsh_func }}" - dest: "~{{ item }}/.zsh_functions" - owner: "{{ item }}" - group: "{{ item }}" - mode: '0640' - loop: "{{ users.stdout_lines }}" - - - name: Enabling zsh functions - loop: "{{ users.stdout_lines }}" - ansible.builtin.blockinfile: - path: "~{{ item }}/.zshrc" - state: present - insertafter: EOF - owner: "{{ item }}" - block: | - if [ -f ~/.zsh_functions ]; then - source ~/.zsh_functions - fi - - - name: Copying over tmux config to all users - ansible.builtin.copy: - src: "{{ tmux }}" - 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/main.yml b/main.yml new file mode 100644 index 0000000..15e199d --- /dev/null +++ b/main.yml @@ -0,0 +1,10 @@ +--- + - name: Golden Kali + hosts: localhost + become: true + gather_facts: false + + roles: + - package-mgmt + - individual-apps + - custom-config diff --git a/master-bash_functions b/master-bash_functions deleted file mode 100644 index 0b5026c..0000000 --- a/master-bash_functions +++ /dev/null @@ -1,9 +0,0 @@ -# This is a file I will store all bash functions I use - -scan() { - echo "Scanning with masscan..." - echo "If this takes way too long, ping $1 in a separate terminal" - echo "because masscan has a weird bug that holds connections open or something" - P=$(sudo masscan -p 1-65535 -e tun0 --rate=1000 $1 | grep Discovered | awk '{print $4}' | cut -d/ -f1 | tr "\n" "," | sed 's/\,$/\n/') ; sudo nmap -sC -sV -p $P -oN scanresults-$1.txt $1 - echo "Stored results in scanresults-$1.txt" -} diff --git a/roles/custom-config/README.md b/roles/custom-config/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/custom-config/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/custom-config/defaults/main.yml b/roles/custom-config/defaults/main.yml new file mode 100644 index 0000000..ccefed4 --- /dev/null +++ b/roles/custom-config/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for custom-config diff --git a/roles/custom-config/files/tmux_conf b/roles/custom-config/files/tmux_conf new file mode 100644 index 0000000..55cf067 --- /dev/null +++ b/roles/custom-config/files/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/roles/custom-config/files/zsh_functions.zsh b/roles/custom-config/files/zsh_functions.zsh new file mode 100644 index 0000000..e6df6e0 --- /dev/null +++ b/roles/custom-config/files/zsh_functions.zsh @@ -0,0 +1,26 @@ +# 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 +} + +# Get latest version of linpeas and download to current directory +alias getlinpeas='curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh > linpeas.sh' + +# I use this a ton +alias webserver='python -m http.server' + +# hey why not, change this number to your preferred revshell port. +alias revshell='ncat -lvnp 9090' \ No newline at end of file diff --git a/roles/custom-config/handlers/main.yml b/roles/custom-config/handlers/main.yml new file mode 100644 index 0000000..2fee87f --- /dev/null +++ b/roles/custom-config/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for custom-config diff --git a/roles/custom-config/meta/main.yml b/roles/custom-config/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/roles/custom-config/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/custom-config/tasks/main.yml b/roles/custom-config/tasks/main.yml new file mode 100644 index 0000000..1a7de05 --- /dev/null +++ b/roles/custom-config/tasks/main.yml @@ -0,0 +1,132 @@ +--- +# tasks file for custom-config +- name: Getting all interactive users + #ansible.builtin.shell "awk -F: '{ if (($3 >= 1000 && $3 != 65534) || $3 == 0) print $1)' /etc/passwd" + ansible.builtin.shell: "grep -E '(ba|da|k|c|z|tc|b|a|sc|sh)$' /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" + +- name: Create Desktop Icon for Kitty 🐱 + ansible.builtin.copy: + dest: "/usr/share/applications/kitty.desktop" + content: | + [Desktop Entry] + Version=0.26.2 + Type=Application + Name=Kitty Terminal Emulator + 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/" + state: directory + recurse: yes + owner: "{{ item }}" + group: "{{ item }}" + mode: 0755 + +- name: Prepare personalized configs for Kitty 🐱 + loop: "{{ users.stdout_lines }}" + ansible.builtin.blockinfile: + path: "~{{ item }}/.config/kitty/kitty.conf" + insertafter: EOF + create: yes + 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: + path: /etc/vim/vimrc + marker: "\" {mark} ANSIBLE MANAGED BLOCK" + insertafter: EOF + state: present + block: | + set mouse= + set ttymouse= + +- 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 zsh functions file for all users + ansible.builtin.copy: + src: zsh_functions.zsh + dest: "{{ item }}/.zsh_functions" + owner: "{{ item }}" + group: "{{ item }}" + mode: '0640' + loop: "{{ users.stdout_lines }}" + +- name: Enabling zsh functions + loop: "{{ users.stdout_lines }}" + ansible.builtin.blockinfile: + path: "~{{ item }}/.zshrc" + state: present + insertafter: EOF + owner: "{{ item }}" + block: | + if [ -f ~/.zsh_functions]; then + source ~/.zsh_functions + fi + +- name: Copying over tmux config to all users + ansible.builtin.copy: + src: 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/roles/custom-config/tests/inventory b/roles/custom-config/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/custom-config/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/custom-config/tests/test.yml b/roles/custom-config/tests/test.yml new file mode 100644 index 0000000..181d731 --- /dev/null +++ b/roles/custom-config/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - custom-config diff --git a/roles/custom-config/vars/main.yml b/roles/custom-config/vars/main.yml new file mode 100644 index 0000000..60c28e5 --- /dev/null +++ b/roles/custom-config/vars/main.yml @@ -0,0 +1,3 @@ +--- +# vars file for custom-config +kitty_installer: "https://sw.kovidgoyal.net/kitty/installer.sh" diff --git a/roles/individual-apps/README.md b/roles/individual-apps/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/individual-apps/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/individual-apps/defaults/main.yml b/roles/individual-apps/defaults/main.yml new file mode 100644 index 0000000..ebfe4e0 --- /dev/null +++ b/roles/individual-apps/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for individual-apps diff --git a/roles/individual-apps/handlers/main.yml b/roles/individual-apps/handlers/main.yml new file mode 100644 index 0000000..3c771dd --- /dev/null +++ b/roles/individual-apps/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for individual-apps diff --git a/roles/individual-apps/meta/main.yml b/roles/individual-apps/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/roles/individual-apps/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/individual-apps/tasks/main.yml b/roles/individual-apps/tasks/main.yml new file mode 100644 index 0000000..7b1b3d6 --- /dev/null +++ b/roles/individual-apps/tasks/main.yml @@ -0,0 +1,106 @@ +--- +# tasks file for individual-apps +- 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: 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' + 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 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: Installing Impacket + ansible.builtin.shell: "python3 /opt/impacket/setup.py build && python3 /opt/impacket/setup.py install" + args: + chdir: /opt/impacket + +- name: Clone Bloodhound.py + ansible.builtin.git: + repo: 'https://github.com/fox-it/BloodHound.py.git' + dest: /opt/BloodHound.py + +- name: Clone PyFuscation + ansible.builtin.git: + repo: 'https://github.com/CBHue/PyFuscation.git' + dest: /opt/PyFuscation + +- 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: Clone Kerbrute + ansible.builtin.git: + repo: 'https://github.com/ropnop/kerbrute.git' + dest: /opt/kerbrute + +- name: Building Kerbrute... + ansible.builtin.command: chdir=/opt/kerbrute make linux + +- 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 + community.general.gem: + name: evil-winrm + norc: yes + state: latest + user_install: no diff --git a/roles/individual-apps/tests/inventory b/roles/individual-apps/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/individual-apps/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/individual-apps/tests/test.yml b/roles/individual-apps/tests/test.yml new file mode 100644 index 0000000..9626dd6 --- /dev/null +++ b/roles/individual-apps/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - individual-apps diff --git a/roles/individual-apps/vars/main.yml b/roles/individual-apps/vars/main.yml new file mode 100644 index 0000000..c21af81 --- /dev/null +++ b/roles/individual-apps/vars/main.yml @@ -0,0 +1,3 @@ +--- +# vars file for individual-apps +ysoserial_jar: "https://github.com/frohoff/ysoserial/releases/latest/download/ysoserial-all.jar" diff --git a/roles/package-mgmt/README.md b/roles/package-mgmt/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/package-mgmt/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/package-mgmt/defaults/main.yml b/roles/package-mgmt/defaults/main.yml new file mode 100644 index 0000000..57adef2 --- /dev/null +++ b/roles/package-mgmt/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for package-mgmt diff --git a/roles/package-mgmt/handlers/main.yml b/roles/package-mgmt/handlers/main.yml new file mode 100644 index 0000000..ef24490 --- /dev/null +++ b/roles/package-mgmt/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for package-mgmt diff --git a/roles/package-mgmt/meta/main.yml b/roles/package-mgmt/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/roles/package-mgmt/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/package-mgmt/tasks/main.yml b/roles/package-mgmt/tasks/main.yml new file mode 100644 index 0000000..2b6360e --- /dev/null +++ b/roles/package-mgmt/tasks/main.yml @@ -0,0 +1,76 @@ +--- +# tasks file for package-mgmt +- 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 + +- name: Add Docker repo + ansible.builtin.apt_repository: + repo: "{{ docker_repo }}" + state: present + +- name: Add Sublime Text repo + ansible.builtin.apt_repository: + repo: "{{ sublime_repo }}" + state: present + +- name: Ensuring all packages are up to date + ansible.builtin.apt: + update_cache: yes + upgrade: dist + +- name: Installing one-off packages from package manager + ansible.builtin.package: + name: + - bloodhound + - build-essential + - bytecode-viewer + - clang + - cmake + - crackmapexec + - curl + - default-jdk + - default-jre + - docker + - docker-compose + - eog + - feroxbuster + - flex + - forensics-extra + - gawk + - gdb + - gdbserver + - ghidra + - git + - gobuster + - golang-go + - jq + - jxplorer + - libffi-dev + - 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 + - terminator + - tmux + - xclip + - xfce4-terminal + - zaproxy + - zlib1g-dev + state: latest diff --git a/roles/package-mgmt/tests/inventory b/roles/package-mgmt/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/package-mgmt/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/package-mgmt/tests/test.yml b/roles/package-mgmt/tests/test.yml new file mode 100644 index 0000000..929b029 --- /dev/null +++ b/roles/package-mgmt/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - package-mgmt diff --git a/roles/package-mgmt/vars/main.yml b/roles/package-mgmt/vars/main.yml new file mode 100644 index 0000000..8bb393e --- /dev/null +++ b/roles/package-mgmt/vars/main.yml @@ -0,0 +1,6 @@ +--- +# vars file for package-mgmt +docker_repo_key: "https://download.docker.com/linux/debian/gpg" +docker_repo: "deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable" +sublime_repo_key: "https://download.sublimetext.com/sublimehq-pub.gpg" +sublime_repo: "deb https://download.sublimetext.com/ apt/stable/" diff --git a/setup.sh b/setup.sh index 2148bd8..10957ea 100644 --- a/setup.sh +++ b/setup.sh @@ -17,13 +17,6 @@ if [[ $EUID -ne 0 ]]; then fi 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 *" @@ -44,7 +37,7 @@ 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}" +ansible-playbook ${PATH_TO_SCRIPT}/main.yml echo "***********************************" echo "* Done! *" diff --git a/tmux_conf b/tmux_conf deleted file mode 100644 index 55cf067..0000000 --- a/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/zsh_functions.zsh b/zsh_functions.zsh deleted file mode 100644 index e6df6e0..0000000 --- a/zsh_functions.zsh +++ /dev/null @@ -1,26 +0,0 @@ -# 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 -} - -# Get latest version of linpeas and download to current directory -alias getlinpeas='curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh > linpeas.sh' - -# I use this a ton -alias webserver='python -m http.server' - -# hey why not, change this number to your preferred revshell port. -alias revshell='ncat -lvnp 9090' \ No newline at end of file -- cgit v1.2.3 From 9bf3e9ec191e0baf9baf8f0d7f553a0fa0c28e69 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 12 Jun 2023 17:44:36 -0400 Subject: Smooshed some bugs --- roles/custom-config/tasks/main.yml | 5 +- roles/package-mgmt/tasks/main.yml | 109 +++++++++++++++++++------------------ 2 files changed, 58 insertions(+), 56 deletions(-) diff --git a/roles/custom-config/tasks/main.yml b/roles/custom-config/tasks/main.yml index 1a7de05..ec55f0e 100644 --- a/roles/custom-config/tasks/main.yml +++ b/roles/custom-config/tasks/main.yml @@ -1,8 +1,7 @@ --- # tasks file for custom-config - name: Getting all interactive users - #ansible.builtin.shell "awk -F: '{ if (($3 >= 1000 && $3 != 65534) || $3 == 0) print $1)' /etc/passwd" - ansible.builtin.shell: "grep -E '(ba|da|k|c|z|tc|b|a|sc|sh)$' /etc/passwd" + ansible.builtin.shell: "awk -F: '{ if (($3 >= 1000 && $3 != 65534) || $3 == 0) print $1}' /etc/passwd" register: users - name: Install Kitty Terminal Emulator 🐱 @@ -78,7 +77,7 @@ - name: Copying over zsh functions file for all users ansible.builtin.copy: src: zsh_functions.zsh - dest: "{{ item }}/.zsh_functions" + dest: "~{{ item }}/.zsh_functions" owner: "{{ item }}" group: "{{ item }}" mode: '0640' diff --git a/roles/package-mgmt/tasks/main.yml b/roles/package-mgmt/tasks/main.yml index 2b6360e..ca5381e 100644 --- a/roles/package-mgmt/tasks/main.yml +++ b/roles/package-mgmt/tasks/main.yml @@ -8,6 +8,9 @@ repo: "{{ docker_repo }}" state: present +- name: Add Sublime Text repo key + ansible.builtin.shell: curl -fsSL {{ sublime_repo_key }} | gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/sublime-text-keyring.gpg + - name: Add Sublime Text repo ansible.builtin.apt_repository: repo: "{{ sublime_repo }}" @@ -21,56 +24,56 @@ - name: Installing one-off packages from package manager ansible.builtin.package: name: - - bloodhound - - build-essential - - bytecode-viewer - - clang - - cmake - - crackmapexec - - curl - - default-jdk - - default-jre - - docker - - docker-compose - - eog - - feroxbuster - - flex - - forensics-extra - - gawk - - gdb - - gdbserver - - ghidra - - git - - gobuster - - golang-go - - jq - - jxplorer - - libffi-dev - - 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 - - terminator - - tmux - - xclip - - xfce4-terminal - - zaproxy - - zlib1g-dev - state: latest + - bloodhound + - build-essential + - bytecode-viewer + - clang + - cmake + - crackmapexec + - curl + - default-jdk + - default-jre + - docker + - docker-compose + - eog + - feroxbuster + - flex + - forensics-extra + - gawk + - gdb + - gdbserver + - ghidra + - git + - gobuster + - golang-go + - jq + - jxplorer + - libffi-dev + - 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 + - terminator + - tmux + - xclip + - xfce4-terminal + - zaproxy + - zlib1g-dev + state: latest -- cgit v1.2.3 From 61d2136b432a041e5bf1dc04503fa5fb05a60631 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 12 Jun 2023 22:08:39 -0400 Subject: All set for merging, though need to document more next --- README.md | 8 +++++--- setup.sh | 30 ++++++++++++++++-------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index c665a63..5a16545 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,15 @@ And if you don't like my modifications, I encourage you to fork this repo and ma 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: ```bash -git clone https://github.com/AgroDan/golden-kali.git && sudo bash ./golden-kali/setup.sh +git clone https://github.com/AgroDan/golden-kali.git && 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 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. +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. Additional changes will now prompt you for your password to execute the ansible changes as root. This is necessary to install packages via apt. However now pip and ansible will be installed as the current user rather than the root user. 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 +- Latest change: Ansible roles! + 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. @@ -24,4 +26,4 @@ Through exhaustive testing and re-testing, we have determined that this will ins 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 +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. diff --git a/setup.sh b/setup.sh index 10957ea..d787460 100644 --- a/setup.sh +++ b/setup.sh @@ -10,34 +10,36 @@ if [ -z ${BASH} ]; then exit 1 fi -# Are we root? -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as sudo or root." +# Are we root? Because we shouldn't be. +if [[ $EUID -eq 0 ]]; then + echo "This script should be run as a normal user, not root." exit 2 fi PATH_TO_SCRIPT=$(dirname $(readlink -f $0)) -echo "***********************************" -echo "* Installing pip *" -echo "***********************************" +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 +export PATH=$PATH:~/.local/bin -echo "***********************************" -echo "* Installing ansible *" -echo "***********************************" +echo "************************************" +echo "* Installing ansible *" +echo "************************************" pip install ansible -echo "***********************************" -echo "* Running Kali playbook *" -echo "***********************************" +echo "************************************" +echo "* Running Golden Kali Playbook *" +echo "************************************" -ansible-playbook ${PATH_TO_SCRIPT}/main.yml +echo +echo "Please enter your password to configure system:" +ansible-playbook ${PATH_TO_SCRIPT}/main.yml --ask-become-pass echo "***********************************" echo "* Done! *" -- cgit v1.2.3 From 5610d030dda5d14ff62fb1a5eddcd1f3683fd6b8 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Tue, 13 Jun 2023 10:53:59 -0400 Subject: Modified various readmes --- README.md | 14 ++++++++++++-- roles/custom-config/README.md | 36 +----------------------------------- roles/individual-apps/README.md | 33 ++------------------------------- roles/package-mgmt/README.md | 33 ++------------------------------- 4 files changed, 17 insertions(+), 99 deletions(-) diff --git a/README.md b/README.md index 5a16545..92784e3 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # 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. - ## 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: @@ -12,6 +10,18 @@ git clone https://github.com/AgroDan/golden-kali.git && bash ./golden-kali/setup 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. Additional changes will now prompt you for your password to execute the ansible changes as root. This is necessary to install packages via apt. However now pip and ansible will be installed as the current user rather than the root user. 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. +## I Encourage Forking + +I expect that my customizations will not necessarily work for everyone. Like I said, this is tailored to _my_ preferences. Feel free to fork the code, or just straight-up copy word for word and start your own. If you do, here's some notes about how to customize: + +- This is mostly ansible scripts. Some working knowledge of tuning ansible is required here. It's not difficult [I assure you](https://docs.ansible.com/). +- I have split up work into three roles: + - If you need to modify packages installed from the Package manager, modify `/roles/package-mgmt/tasks/main.yml` + - If you need to modify one-off packages installed from `git`, `pip`, `gem` or even how to compile them, modify `/roles/individual-apps/tasks/main.yml` + - If you need to modify desktop-based configurations, modify `/roles/custom-config/tasks/main.yml` +- Even if you don't know ansible, you can probably guess what you need to change by using what I wrote as an example template. +- Contributions are always welcome! I know enough ansible to do neat things, but I'm by no means an expert. Feel free to tell me what I'm doing wrong and how I can go about making it even better! + ## Changelog - Latest change: Ansible roles! diff --git a/roles/custom-config/README.md b/roles/custom-config/README.md index 225dd44..9a20a30 100644 --- a/roles/custom-config/README.md +++ b/roles/custom-config/README.md @@ -1,38 +1,4 @@ Role Name ========= -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. - -Role Variables --------------- - -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - -Dependencies ------------- - -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } - -License -------- - -BSD - -Author Information ------------------- - -An optional section for the role authors to include contact information, or a website (HTML is not allowed). +This role handles customization of the desktop experience only. Adding things like zsh functions I use, getting rid of mouse interactivity with vim (because who in their right mind thought this was a good idea???), and other small tweaks that I needed. Put customization in here. diff --git a/roles/individual-apps/README.md b/roles/individual-apps/README.md index 225dd44..004e8b6 100644 --- a/roles/individual-apps/README.md +++ b/roles/individual-apps/README.md @@ -1,38 +1,9 @@ Role Name ========= -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. +This role will install individual packages that are _not_ tied to the package management system, IE apt. This also applies to git repositories and the like, as well as one-off compilation and build instructions, such as JumboJohn and Kerbrute. Role Variables -------------- -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - -Dependencies ------------- - -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } - -License -------- - -BSD - -Author Information ------------------- - -An optional section for the role authors to include contact information, or a website (HTML is not allowed). +Just using a link to the compiled ysoserial .jar file. diff --git a/roles/package-mgmt/README.md b/roles/package-mgmt/README.md index 225dd44..2c23fcf 100644 --- a/roles/package-mgmt/README.md +++ b/roles/package-mgmt/README.md @@ -1,38 +1,9 @@ Role Name ========= -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. +This role will handle any OS-level patching and package installs, including the installation of keys for repositories and such. This role typically takes a while to run because I always make sure I am patched and up to date before doing anything, and then of course the individual packages just take a while to install. Role Variables -------------- -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - -Dependencies ------------- - -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } - -License -------- - -BSD - -Author Information ------------------- - -An optional section for the role authors to include contact information, or a website (HTML is not allowed). +I have added the URLs to the specific keys I am using to install the repositories for things like Docker and Sublime Text. -- cgit v1.2.3 From dfa9f2398bd614f73a0df92cbcfd561c609a2f3b Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Tue, 13 Jun 2023 10:56:49 -0400 Subject: Wording change --- roles/custom-config/README.md | 2 +- roles/individual-apps/README.md | 2 +- roles/package-mgmt/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/custom-config/README.md b/roles/custom-config/README.md index 9a20a30..65ff9ca 100644 --- a/roles/custom-config/README.md +++ b/roles/custom-config/README.md @@ -1,4 +1,4 @@ -Role Name +Custom Config ========= This role handles customization of the desktop experience only. Adding things like zsh functions I use, getting rid of mouse interactivity with vim (because who in their right mind thought this was a good idea???), and other small tweaks that I needed. Put customization in here. diff --git a/roles/individual-apps/README.md b/roles/individual-apps/README.md index 004e8b6..5880d2b 100644 --- a/roles/individual-apps/README.md +++ b/roles/individual-apps/README.md @@ -1,4 +1,4 @@ -Role Name +Individual Apps ========= This role will install individual packages that are _not_ tied to the package management system, IE apt. This also applies to git repositories and the like, as well as one-off compilation and build instructions, such as JumboJohn and Kerbrute. diff --git a/roles/package-mgmt/README.md b/roles/package-mgmt/README.md index 2c23fcf..01452d7 100644 --- a/roles/package-mgmt/README.md +++ b/roles/package-mgmt/README.md @@ -1,4 +1,4 @@ -Role Name +Package Mgmt ========= This role will handle any OS-level patching and package installs, including the installation of keys for repositories and such. This role typically takes a while to run because I always make sure I am patched and up to date before doing anything, and then of course the individual packages just take a while to install. -- cgit v1.2.3