From a049e26b96ca1d3f06d3e6f36573ca5c88f62109 Mon Sep 17 00:00:00 2001 From: Justin-p Date: Thu, 19 Nov 2020 19:12:25 +0100 Subject: [PATCH 1/2] switch away from docker --- defaults/main.yml | 9 ++++++--- meta/main.yml | 13 ------------ requirements.yml | 2 -- tasks/dependencies.yml | 13 ++++++++++++ tasks/evilginx2.yml | 46 ++++++++++++++++++++++++++++++++++++++++++ tasks/main.yml | 41 +++++-------------------------------- vars/main.yml | 2 +- 7 files changed, 71 insertions(+), 55 deletions(-) create mode 100644 tasks/dependencies.yml create mode 100644 tasks/evilginx2.yml diff --git a/defaults/main.yml b/defaults/main.yml index 59f462e..9187393 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,8 @@ --- # defaults file for evilginx2 -evilginx2_path: /opt/evilginx2 -evilginx2_repo_url: https://github.com/kgretzky/evilginx2 -evilginx2_repo_tag: 2.4.0 +evilginx2_version: 2.4.0 +evilginx2_platform: linux +evilginx2_arch: amd64 +evilginx2_sha256: sha256:595a77ddfb6f674bd5bc1c297ae912f5ebf6ba218a2f857ff46b7b37d1a9678b +evilginx2_download_destination: "/tmp/evilginx2-{{ evilginx2_version }}-{{ evilginx2_platform }}-{{ evilginx2_arch }}.zip" +evilginx2_install_destination: /opt/evilginx2 \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml index f75f981..3f8127d 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -58,16 +58,3 @@ dependencies: pip_package: python3-pip pip_install_packages: - name: docker - - include_role: - name: igor_mukhin.bash_aliases - version: v1.1.0 - vars: - bash_aliases: - - { - alias: 'setup_tmux', - command: 'tmux new-session -d -s "evilginx"' - } - - { - alias: 'start_evilginx2', - command: 'docker run -it -p 80:80 -p 443:443 -v /root/.evilginx:/root/.evilginx -v /opt/evilginx2/phishlets/:/app/phishlets evilginx2' - } diff --git a/requirements.yml b/requirements.yml index 99189a6..1f86a8f 100644 --- a/requirements.yml +++ b/requirements.yml @@ -12,5 +12,3 @@ pip_package: python3-pip pip_install_packages: - name: docker -- role: igor_mukhin.bash_aliases - version: v1.1.0 diff --git a/tasks/dependencies.yml b/tasks/dependencies.yml new file mode 100644 index 0000000..f91d172 --- /dev/null +++ b/tasks/dependencies.yml @@ -0,0 +1,13 @@ +--- +- name: Install dependencies from apt + ansible.builtin.package: + name: "{{ evilginx2_packages }}" + state: present + +- name: Ensure the "{{ evilginx2_path }}" directory exists + file: + path: "{{ evilginx2_path }}" + state: directory + owner: root + group: root + mode: "0750" diff --git a/tasks/evilginx2.yml b/tasks/evilginx2.yml new file mode 100644 index 0000000..14726f3 --- /dev/null +++ b/tasks/evilginx2.yml @@ -0,0 +1,46 @@ +--- +- name: Check if we already downloaded the zip. + stat: + path: "{{ evilginx2_download_destination }}" + register: tar + +- name: "Downloading gophish-v{{ gophish_version }}-{{ gophish_platform }}-{{ gophish_arch }}.zip." + get_url: + validate_certs: True + url: "{{ evilginx2_url }}" + checksum: "{{ evilginx2_sha256 }}" + dest: "{{ evilginx2_download_destination }}" + when: not tar.stat.exists + +#- name: Unzip gophish-v{{ gophish_version }}-{{ gophish_platform }}-{{ gophish_arch }}.zip + #unarchive: + # src: "{{ gophish_download_destination }}" + # dest: "{{ gophish_install_destination }}" + # remote_src: yes + # owner: "{{ gophish_user }}" + # group: "{{ gophish_user }}" + # mode: 0740 + #when: not zip.stat.exists + +# - include_role: +# name: igor_mukhin.bash_aliases +# version: v1.1.0 +# vars: +# bash_aliases: +# - { +# alias: 'setup_tmux', +# command: 'tmux new-session -d -s "evilginx"' +# } +# - { +# alias: 'start_evilginx2', +# command: 'docker run -it -p 80:80 -p 443:443 -v /root/.evilginx:/root/.evilginx -v /opt/evilginx2/phishlets/:/app/phishlets evilginx2' +# } + +#- name: Run evilginx2 container in tmux session # noqa 305 +# shell: "{{ item }}" +# with_items: +# - tmux new-session -d -s "start_tmux_server" +# - tmux kill-server +# - tmux new-session -d -s "evilginx2" +# - tmux send-keys -t evilginx2.0 start_evilginx2 ENTER +# changed_when: false diff --git a/tasks/main.yml b/tasks/main.yml index 6a0fea3..a188389 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,37 +1,6 @@ --- -# tasks file for evilginx2- include_role: -- name: Install git and tmux are installed - ansible.builtin.package: - name: "{{ evilginx2_packages }}" - state: present - -- name: Ensure the "{{ evilginx2_path }}" directory exists - file: - path: "{{ evilginx2_path }}" - state: directory - owner: root - group: root - mode: "0750" - -- name: Clone evilginx2 using the "{{ evilginx2_repo_tag }}" - git: - repo: "{{ evilginx2_repo_url }}" - dest: "{{ evilginx2_path }}" - version: "{{ evilginx2_repo_tag }}" - -- name: Build docker image for evilginx2 - docker_image: - name: evilginx2 - build: - pull: no - path: "{{ evilginx2_path }}" - source: build - -- name: Run evilginx2 container in tmux session # noqa 305 - shell: "{{ item }}" - with_items: - - tmux new-session -d -s "start_tmux_server" - - tmux kill-server - - tmux new-session -d -s "evilginx2" - - tmux send-keys -t evilginx2.0 start_evilginx2 ENTER - changed_when: false +# tasks file for evilginx2 +- block: + - import_tasks: dependencies.yml + - import_tasks: evilginx2.yml + become: true diff --git a/vars/main.yml b/vars/main.yml index 127a465..f696d81 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,5 +1,5 @@ --- # vars file for evilginx2 +evilginx2_url: "https://github.com/kgretzky/evilginx2/releases/v{{ evilginx2_version }}/evilginx2-{{ evilginx2_version }}-{{ evilginx2_platform }}-{{ evilginx2_arch }}.zip" evilginx2_packages: - - git - tmux \ No newline at end of file From eb8db3bf7a80dae734492daf424fe3cfc5302460 Mon Sep 17 00:00:00 2001 From: Justin-p Date: Thu, 19 Nov 2020 20:11:43 +0100 Subject: [PATCH 2/2] now installs evilginx in the system --- defaults/main.yml | 4 ++-- meta/main.yml | 11 +--------- tasks/dependencies.yml | 4 ++-- tasks/evilginx2.yml | 49 +++++++++++++++--------------------------- vars/main.yml | 2 +- 5 files changed, 23 insertions(+), 47 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 9187393..c113b30 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,5 +4,5 @@ evilginx2_version: 2.4.0 evilginx2_platform: linux evilginx2_arch: amd64 evilginx2_sha256: sha256:595a77ddfb6f674bd5bc1c297ae912f5ebf6ba218a2f857ff46b7b37d1a9678b -evilginx2_download_destination: "/tmp/evilginx2-{{ evilginx2_version }}-{{ evilginx2_platform }}-{{ evilginx2_arch }}.zip" -evilginx2_install_destination: /opt/evilginx2 \ No newline at end of file +evilginx2_download_destination: "/tmp/evilginx2-{{ evilginx2_version }}-{{ evilginx2_platform }}-{{ evilginx2_arch }}.tar.gz" +evilginx2_install_destination: /opt \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml index 3f8127d..8e61374 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -48,13 +48,4 @@ dependencies: version: 1.1.14 tags: molecule-idempotence-notest - role: robertdebock.core_dependencies - version: 1.5.0 - - include_role: - name: geerlingguy.docker - version: 2.8.1 - - role: geerlingguy.pip - version: 2.0.0 - vars: - pip_package: python3-pip - pip_install_packages: - - name: docker + version: 1.5.0 \ No newline at end of file diff --git a/tasks/dependencies.yml b/tasks/dependencies.yml index f91d172..5f8699b 100644 --- a/tasks/dependencies.yml +++ b/tasks/dependencies.yml @@ -4,9 +4,9 @@ name: "{{ evilginx2_packages }}" state: present -- name: Ensure the "{{ evilginx2_path }}" directory exists +- name: "Ensure the {{ evilginx2_install_destination }} directory exists" file: - path: "{{ evilginx2_path }}" + path: "{{ evilginx2_install_destination }}" state: directory owner: root group: root diff --git a/tasks/evilginx2.yml b/tasks/evilginx2.yml index 14726f3..eefc376 100644 --- a/tasks/evilginx2.yml +++ b/tasks/evilginx2.yml @@ -4,7 +4,7 @@ path: "{{ evilginx2_download_destination }}" register: tar -- name: "Downloading gophish-v{{ gophish_version }}-{{ gophish_platform }}-{{ gophish_arch }}.zip." +- name: "Downloading evilginx-{{ evilginx2_platform }}-{{ evilginx2_arch }}.tar.gz" get_url: validate_certs: True url: "{{ evilginx2_url }}" @@ -12,35 +12,20 @@ dest: "{{ evilginx2_download_destination }}" when: not tar.stat.exists -#- name: Unzip gophish-v{{ gophish_version }}-{{ gophish_platform }}-{{ gophish_arch }}.zip - #unarchive: - # src: "{{ gophish_download_destination }}" - # dest: "{{ gophish_install_destination }}" - # remote_src: yes - # owner: "{{ gophish_user }}" - # group: "{{ gophish_user }}" - # mode: 0740 - #when: not zip.stat.exists - -# - include_role: -# name: igor_mukhin.bash_aliases -# version: v1.1.0 -# vars: -# bash_aliases: -# - { -# alias: 'setup_tmux', -# command: 'tmux new-session -d -s "evilginx"' -# } -# - { -# alias: 'start_evilginx2', -# command: 'docker run -it -p 80:80 -p 443:443 -v /root/.evilginx:/root/.evilginx -v /opt/evilginx2/phishlets/:/app/phishlets evilginx2' -# } +- name: Unzip evilginx-{{ evilginx2_platform }}-{{ evilginx2_arch }}.tar.gz + unarchive: + src: "{{ evilginx2_download_destination }}" + dest: "{{ evilginx2_install_destination }}" + remote_src: yes + mode: 0740 + when: not tar.stat.exists -#- name: Run evilginx2 container in tmux session # noqa 305 -# shell: "{{ item }}" -# with_items: -# - tmux new-session -d -s "start_tmux_server" -# - tmux kill-server -# - tmux new-session -d -s "evilginx2" -# - tmux send-keys -t evilginx2.0 start_evilginx2 ENTER -# changed_when: false +- name: Run evilginx2 in tmux session # noqa 305 + shell: "{{ item }}" + with_items: + - tmux new-session -d -s "start_tmux_server" + - tmux kill-server + - tmux new-session -d -s "evilginx2" + - tmux send-keys -t evilginx2.0 'cd {{ evilginx2_install_destination }}/evilginx' ENTER + - tmux send-keys -t evilginx2.0 'sudo ./evilginx' ENTER + changed_when: false diff --git a/vars/main.yml b/vars/main.yml index f696d81..68885b5 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,5 +1,5 @@ --- # vars file for evilginx2 -evilginx2_url: "https://github.com/kgretzky/evilginx2/releases/v{{ evilginx2_version }}/evilginx2-{{ evilginx2_version }}-{{ evilginx2_platform }}-{{ evilginx2_arch }}.zip" +evilginx2_url: "https://github.com/kgretzky/evilginx2/releases/download/{{ evilginx2_version }}/evilginx-{{ evilginx2_platform }}-{{ evilginx2_arch }}.tar.gz" evilginx2_packages: - tmux \ No newline at end of file