diff --git a/defaults/main.yml b/defaults/main.yml index 59f462e..c113b30 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 }}.tar.gz" +evilginx2_install_destination: /opt \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml index f75f981..8e61374 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -48,26 +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 - - 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' - } + version: 1.5.0 \ No newline at end of file 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..5f8699b --- /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_install_destination }} directory exists" + file: + path: "{{ evilginx2_install_destination }}" + state: directory + owner: root + group: root + mode: "0750" diff --git a/tasks/evilginx2.yml b/tasks/evilginx2.yml new file mode 100644 index 0000000..eefc376 --- /dev/null +++ b/tasks/evilginx2.yml @@ -0,0 +1,31 @@ +--- +- name: Check if we already downloaded the zip. + stat: + path: "{{ evilginx2_download_destination }}" + register: tar + +- name: "Downloading evilginx-{{ evilginx2_platform }}-{{ evilginx2_arch }}.tar.gz" + get_url: + validate_certs: True + url: "{{ evilginx2_url }}" + checksum: "{{ evilginx2_sha256 }}" + dest: "{{ evilginx2_download_destination }}" + when: not tar.stat.exists + +- 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 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/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..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/download/{{ evilginx2_version }}/evilginx-{{ evilginx2_platform }}-{{ evilginx2_arch }}.tar.gz" evilginx2_packages: - - git - tmux \ No newline at end of file