From b877098a01cb78ccf3f329d39426a1cdc0b74f31 Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Thu, 19 Sep 2024 06:49:59 +0530 Subject: [PATCH] Added: Cyberchef --- cyberchef/files/nginx.conf.j2 | 19 ++++++++++++++++++ cyberchef/playbook.yml | 12 ++++++++++++ cyberchef/readme.md | 7 +++++++ cyberchef/roles/cyberchef/tasks/main.yaml | 16 +++++++++++++++ cyberchef/roles/nginx/handlers/main.yaml | 6 ++++++ cyberchef/roles/nginx/tasks/main.yaml | 24 +++++++++++++++++++++++ cyberchef/vars/default.yml | 8 ++++++++ 7 files changed, 92 insertions(+) create mode 100644 cyberchef/files/nginx.conf.j2 create mode 100755 cyberchef/playbook.yml create mode 100644 cyberchef/readme.md create mode 100644 cyberchef/roles/cyberchef/tasks/main.yaml create mode 100644 cyberchef/roles/nginx/handlers/main.yaml create mode 100644 cyberchef/roles/nginx/tasks/main.yaml create mode 100644 cyberchef/vars/default.yml diff --git a/cyberchef/files/nginx.conf.j2 b/cyberchef/files/nginx.conf.j2 new file mode 100644 index 0000000..01ba91f --- /dev/null +++ b/cyberchef/files/nginx.conf.j2 @@ -0,0 +1,19 @@ +server { + + listen 80; + server_name {{ http_host }}; + + # Allow large attachments + client_max_body_size 525M; + + location / { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_pass http://localhost:{{ host_port }};; + } + +} + diff --git a/cyberchef/playbook.yml b/cyberchef/playbook.yml new file mode 100755 index 0000000..affd143 --- /dev/null +++ b/cyberchef/playbook.yml @@ -0,0 +1,12 @@ +################################################# +# Bitwarden Playbook +################################################# +--- +- hosts: gondor + become: true + vars_files: + - vars/default.yml + + roles: + - cyberchef + - nginx diff --git a/cyberchef/readme.md b/cyberchef/readme.md new file mode 100644 index 0000000..b1b0760 --- /dev/null +++ b/cyberchef/readme.md @@ -0,0 +1,7 @@ +*The Cyber Swiss Army Knife* + +CyberChef is a simple, intuitive web app for carrying out all manner of "cyber" operations within a web browser. These operations include simple encoding like XOR and Base64, more complex encryption like AES, DES and Blowfish, creating binary and hexdumps, compression and decompression of data, calculating hashes and checksums, IPv6 and X.509 parsing, changing character encodings, and much more. + +The tool is designed to enable both technical and non-technical analysts to manipulate data in complex ways without having to deal with complex tools or algorithms. It was conceived, designed, built and incrementally improved by an analyst in their 10% innovation time over several years. + +https://github.com/gchq/CyberChef \ No newline at end of file diff --git a/cyberchef/roles/cyberchef/tasks/main.yaml b/cyberchef/roles/cyberchef/tasks/main.yaml new file mode 100644 index 0000000..ef65ccd --- /dev/null +++ b/cyberchef/roles/cyberchef/tasks/main.yaml @@ -0,0 +1,16 @@ +--- +# Tasks for CyberChef role +- name: Pull CyberChef image + docker_image: + name: "{{ image }}" + source: pull + force_source: yes + +- name: Create CyberChef container + docker_container: + name: "{{ container }}" + image: "{{ image }}" + state: started + restart_policy: "unless-stopped" + published_ports: + - "127.0.0.1:{{ host_port }}:80" diff --git a/cyberchef/roles/nginx/handlers/main.yaml b/cyberchef/roles/nginx/handlers/main.yaml new file mode 100644 index 0000000..622fd36 --- /dev/null +++ b/cyberchef/roles/nginx/handlers/main.yaml @@ -0,0 +1,6 @@ +--- +# Handlers for Nginx role +- name: Reload Nginx + service: + name: nginx + state: reloaded diff --git a/cyberchef/roles/nginx/tasks/main.yaml b/cyberchef/roles/nginx/tasks/main.yaml new file mode 100644 index 0000000..4441fe7 --- /dev/null +++ b/cyberchef/roles/nginx/tasks/main.yaml @@ -0,0 +1,24 @@ +--- +# Tasks for Nginx role +- name: Check if Nginx conf file exists + stat: + path: "/etc/nginx/sites-available/{{ http_conf }}" + register: status + +- name: No need to reload Nginx + debug: + msg: "No need to reload Nginx as sites-available entries have already been created" + +- name: Set Nginx conf file + when: status.stat.exists == false + template: + src: "files/nginx.conf.j2" + dest: "/etc/nginx/sites-available/{{ http_conf }}" + +- name: Enable new site + when: status.stat.exists == false + file: + src: "/etc/nginx/sites-available/{{ http_conf }}" + dest: "/etc/nginx/sites-enabled/{{ http_conf }}" + state: link + notify: Reload Nginx diff --git a/cyberchef/vars/default.yml b/cyberchef/vars/default.yml new file mode 100644 index 0000000..7b9b278 --- /dev/null +++ b/cyberchef/vars/default.yml @@ -0,0 +1,8 @@ +--- +http_host: "cyberchef.tanshu.com" +http_conf: "cyberchef.tanshu.com.conf" + +container: cyberchef +image: ghcr.io/gchq/cyberchef:latest + +host_port: 8003 \ No newline at end of file