This commit is contained in:
n0mad1k
2025-04-12 06:50:16 -04:00
parent 07fd21666b
commit 50dd4f99e4
+99 -27
View File
@@ -2,65 +2,122 @@
# Common task for installing offensive security tools # Common task for installing offensive security tools
# Shared across all providers # Shared across all providers
- name: Determine home directory path
set_fact:
home_dir: "{{ (ansible_user == 'root') | ternary('/root', '/home/' + ansible_user) }}"
tools_dir: "{{ (ansible_user == 'root') | ternary('/root/Tools', '/home/' + ansible_user + '/Tools') }}"
- name: Create Tools directory - name: Create Tools directory
file: file:
path: /home/{{ ansible_user }}/Tools path: "{{ tools_dir }}"
state: directory state: directory
owner: "{{ ansible_user }}" owner: "{{ ansible_user }}"
group: "{{ ansible_user }}" group: "{{ ansible_user }}"
mode: '0755' mode: '0755'
- name: Ensure pipx path is configured - name: Install base dependencies
apt:
name:
- python3-pip
- python3-venv
- pipx
- curl
- wget
- git
- jq
- unzip
- tmux
state: present
update_cache: yes
- name: Check if pipx is installed
command: which pipx
register: pipx_check
ignore_errors: true
changed_when: false
- name: Configure pipx path
shell: | shell: |
export PATH="$PATH:{{ home_dir }}/.local/bin"
pipx ensurepath pipx ensurepath
become: true
args: args:
executable: /bin/bash executable: /bin/bash
register: pipx_path_result
until: pipx_path_result is success
retries: 3
delay: 5
when: pipx_check.rc == 0
- name: Set PATH for subsequent operations
set_fact:
custom_path: "{{ home_dir }}/.local/bin:{{ ansible_env.PATH }}"
- name: Install tools via pipx - name: Install tools via pipx
shell: | shell: |
export PATH=$PATH:/root/.local/bin export PATH="{{ custom_path }}"
pipx ensurepath
pipx install git+https://github.com/Pennyw0rth/NetExec pipx install git+https://github.com/Pennyw0rth/NetExec
pipx install git+https://github.com/blacklanternsecurity/TREVORspray pipx install git+https://github.com/blacklanternsecurity/TREVORspray
pipx install impacket pipx install impacket
become: true environment:
args: PATH: "{{ custom_path }}"
executable: /bin/bash register: pipx_install_result
until: pipx_install_result is success
retries: 3
delay: 5
- name: Install offensive security tools
apt:
name:
- nmap
- tcpdump
- hydra
- john
- hashcat
- sqlmap
- gobuster
- dirb
- enum4linux
- dnsenum
- seclists
- responder
- golang
- proxychains
- tor
- crackmapexec
state: present
- name: Download Kerbrute - name: Download Kerbrute
shell: | shell: |
mkdir -p /home/{{ ansible_user }}/Tools/Kerbrute mkdir -p {{ tools_dir }}/Kerbrute
wget https://github.com/ropnop/kerbrute/releases/latest/download/kerbrute_linux_amd64 -O /home/{{ ansible_user }}/Tools/Kerbrute/kerbrute wget https://github.com/ropnop/kerbrute/releases/latest/download/kerbrute_linux_amd64 -O {{ tools_dir }}/Kerbrute/kerbrute
chmod +x /home/{{ ansible_user }}/Tools/Kerbrute/kerbrute chmod +x {{ tools_dir }}/Kerbrute/kerbrute
become: true
args: args:
executable: /bin/bash executable: /bin/bash
creates: /home/{{ ansible_user }}/Tools/Kerbrute/kerbrute creates: "{{ tools_dir }}/Kerbrute/kerbrute"
- name: Clone SharpCollection nightly builds - name: Clone SharpCollection nightly builds
git: git:
repo: https://github.com/Flangvik/SharpCollection.git repo: https://github.com/Flangvik/SharpCollection.git
dest: /home/{{ ansible_user }}/Tools/SharpCollection dest: "{{ tools_dir }}/SharpCollection"
version: master version: master
ignore_errors: yes ignore_errors: yes
- name: Clone PEASS-ng - name: Clone PEASS-ng
git: git:
repo: https://github.com/carlospolop/PEASS-ng.git repo: https://github.com/carlospolop/PEASS-ng.git
dest: /home/{{ ansible_user }}/Tools/PEASS-ng dest: "{{ tools_dir }}/PEASS-ng"
ignore_errors: yes ignore_errors: yes
- name: Clone MailSniper - name: Clone MailSniper
git: git:
repo: https://github.com/dafthack/MailSniper.git repo: https://github.com/dafthack/MailSniper.git
dest: /home/{{ ansible_user }}/Tools/MailSniper dest: "{{ tools_dir }}/MailSniper"
ignore_errors: yes ignore_errors: yes
- name: Clone Inveigh - name: Clone Inveigh
git: git:
repo: https://github.com/Kevin-Robertson/Inveigh.git repo: https://github.com/Kevin-Robertson/Inveigh.git
dest: /home/{{ ansible_user }}/Tools/Inveigh dest: "{{ tools_dir }}/Inveigh"
ignore_errors: yes ignore_errors: yes
- name: Install Sliver C2 server - name: Install Sliver C2 server
@@ -68,7 +125,9 @@
curl https://sliver.sh/install | bash curl https://sliver.sh/install | bash
systemctl enable sliver systemctl enable sliver
systemctl start sliver systemctl start sliver
become: true args:
executable: /bin/bash
ignore_errors: yes
- name: Install Metasploit Framework (Nightly Build) - name: Install Metasploit Framework (Nightly Build)
shell: | shell: |
@@ -76,24 +135,37 @@
chmod 755 /tmp/msfinstall chmod 755 /tmp/msfinstall
/tmp/msfinstall /tmp/msfinstall
rm -f /tmp/msfinstall rm -f /tmp/msfinstall
become: true
args: args:
executable: /bin/bash executable: /bin/bash
creates: /usr/bin/msfconsole creates: /usr/bin/msfconsole
ignore_errors: yes
- name: Grab GoPhish - name: Ensure GoPhish directory exists
file:
path: "{{ tools_dir }}/gophish"
state: directory
mode: '0755'
- name: Grab GoPhish latest release
shell: | shell: |
curl -L "$(curl -s https://api.github.com/repos/gophish/gophish/releases/latest | jq -r '.assets[] | select(.browser_download_url | contains("linux-64bit.zip")) | .browser_download_url')" -o /home/{{ ansible_user }}/Tools/gophish.zip curl -s https://api.github.com/repos/gophish/gophish/releases/latest | jq -r '.assets[] | select(.browser_download_url | contains("linux-64bit.zip")) | .browser_download_url'
unzip /home/{{ ansible_user }}/Tools/gophish.zip -d /home/{{ ansible_user }}/Tools/gophish register: gophish_url
rm -rf /home/{{ ansible_user }}/Tools/gophish.zip failed_when: gophish_url.stdout == ""
chmod +x /home/{{ ansible_user }}/Tools/gophish/gophish changed_when: false
- name: Download and install GoPhish
shell: |
curl -L "{{ gophish_url.stdout }}" -o {{ tools_dir }}/gophish.zip
unzip {{ tools_dir }}/gophish.zip -d {{ tools_dir }}/gophish
rm -f {{ tools_dir }}/gophish.zip
chmod +x {{ tools_dir }}/gophish/gophish
args: args:
creates: /home/{{ ansible_user }}/Tools/gophish/gophish creates: "{{ tools_dir }}/gophish/gophish"
- name: Deploy Gophish config.json with custom admin port - name: Deploy Gophish config.json with custom admin port
template: template:
src: gophish-config.j2 src: gophish-config.j2
dest: /home/{{ ansible_user }}/Tools/gophish/config.json dest: "{{ tools_dir }}/gophish/config.json"
owner: "{{ ansible_user }}" owner: "{{ ansible_user }}"
group: "{{ ansible_user }}" group: "{{ ansible_user }}"
mode: '0644' mode: '0644'
@@ -103,7 +175,7 @@
- name: Set proper ownership for Tools directory - name: Set proper ownership for Tools directory
file: file:
path: /home/{{ ansible_user }}/Tools path: "{{ tools_dir }}"
owner: "{{ ansible_user }}" owner: "{{ ansible_user }}"
group: "{{ ansible_user }}" group: "{{ ansible_user }}"
recurse: true recurse: true