From 56cb24a779126cd98fa391b0dcf15ad5461b0a76 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 24 Jun 2020 11:56:44 +0300 Subject: [PATCH 1/5] add: covenant installation script --- config/install.sh | 0 redbaron/data/playbooks/.gitignore | 0 redbaron/data/playbooks/git-clone2.yml | 19 ------------------- .../data/playbooks/git_clone_some_stuff.yml | 13 ------------- .../playbooks/{playbook1.yml => playbook.yml} | 2 +- redbaron/data/scripts/tools/covenant.sh | 9 +++++++++ redbaron/modules/aws/dns-c2/security_group.tf | 6 ++++++ .../modules/aws/http-c2/security_group.tf | 6 ++++++ .../modules/digitalocean/dns-c2/firewall.tf | 5 +++++ .../modules/digitalocean/http-c2/firewall.tf | 5 +++++ 10 files changed, 32 insertions(+), 33 deletions(-) mode change 100755 => 100644 config/install.sh create mode 100644 redbaron/data/playbooks/.gitignore delete mode 100644 redbaron/data/playbooks/git-clone2.yml delete mode 100644 redbaron/data/playbooks/git_clone_some_stuff.yml rename redbaron/data/playbooks/{playbook1.yml => playbook.yml} (86%) create mode 100644 redbaron/data/scripts/tools/covenant.sh diff --git a/config/install.sh b/config/install.sh old mode 100755 new mode 100644 diff --git a/redbaron/data/playbooks/.gitignore b/redbaron/data/playbooks/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/redbaron/data/playbooks/git-clone2.yml b/redbaron/data/playbooks/git-clone2.yml deleted file mode 100644 index bc72aae..0000000 --- a/redbaron/data/playbooks/git-clone2.yml +++ /dev/null @@ -1,19 +0,0 @@ -#Works on localhost ok -- hosts: localhost - gather_facts: True - check_mode: no - tasks: - - name: Add a public IP address to the in-memory inventory - add_host: - name: "{{ host }}" - groups: all - - - local_action: wait_for port=22 host="{{ host }}" search_regex=OpenSSH delay=10 - - name: git clone Impacket - git: - repo: https://github.com/CoreSecurity/impacket.git - dest: /tmp/impacket - - name: git clone CME - git: - repo: https://github.com/byt3bl33d3r/CrackMapExec - dest: /tmp/cme \ No newline at end of file diff --git a/redbaron/data/playbooks/git_clone_some_stuff.yml b/redbaron/data/playbooks/git_clone_some_stuff.yml deleted file mode 100644 index 0e54c40..0000000 --- a/redbaron/data/playbooks/git_clone_some_stuff.yml +++ /dev/null @@ -1,13 +0,0 @@ -- hosts: all - gather_facts: False - check_mode: no - become: True - tasks: - - name: git clone Impacket - git: - repo: https://github.com/CoreSecurity/impacket.git - dest: /root/git/impacket - - name: git clone CME - git: - repo: https://github.com/byt3bl33d3r/CrackMapExec - dest: /root/git/cme \ No newline at end of file diff --git a/redbaron/data/playbooks/playbook1.yml b/redbaron/data/playbooks/playbook.yml similarity index 86% rename from redbaron/data/playbooks/playbook1.yml rename to redbaron/data/playbooks/playbook.yml index a59d31d..19c43fc 100644 --- a/redbaron/data/playbooks/playbook1.yml +++ b/redbaron/data/playbooks/playbook.yml @@ -1,4 +1,4 @@ -- name: Network Getting Started First Playbook +- name: Download Impacket gather_facts: false hosts: all tasks: diff --git a/redbaron/data/scripts/tools/covenant.sh b/redbaron/data/scripts/tools/covenant.sh new file mode 100644 index 0000000..f10102d --- /dev/null +++ b/redbaron/data/scripts/tools/covenant.sh @@ -0,0 +1,9 @@ +sudo wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb +#replace https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb with the correct distreo package (debian package tested on DO ubuntu and it works) +sudo apt install -y apt-transport-https +sudo dpkg -i packages-microsoft-prod.deb +sudo apt-get update +sudo apt-get install -y dotnet-sdk-3.1 +git clone --recurse-submodules https://github.com/cobbr/Covenant +cd Covenant/Covenant +dotnet build \ No newline at end of file diff --git a/redbaron/modules/aws/dns-c2/security_group.tf b/redbaron/modules/aws/dns-c2/security_group.tf index d40c65a..433e0f2 100644 --- a/redbaron/modules/aws/dns-c2/security_group.tf +++ b/redbaron/modules/aws/dns-c2/security_group.tf @@ -15,6 +15,12 @@ resource "aws_security_group" "dns-c2" { protocol = "tcp" cidr_blocks = ["${data.external.get_public_ip.result["ip"]}/32"] } + ingress { # rule for covenant admin panel + from_port = 7443 + to_port = 7443 + protocol = "tcp" + cidr_blocks = ["${data.external.get_public_ip.result["ip"]}/32"] + } ingress { from_port = 53 to_port = 53 diff --git a/redbaron/modules/aws/http-c2/security_group.tf b/redbaron/modules/aws/http-c2/security_group.tf index bb4e796..1d9744d 100644 --- a/redbaron/modules/aws/http-c2/security_group.tf +++ b/redbaron/modules/aws/http-c2/security_group.tf @@ -15,6 +15,12 @@ resource "aws_security_group" "http-c2" { protocol = "tcp" cidr_blocks = ["${data.external.get_public_ip.result["ip"]}/32"] } + ingress { # rule for covenant admin panel + from_port = 7443 + to_port = 7443 + protocol = "tcp" + cidr_blocks = ["${data.external.get_public_ip.result["ip"]}/32"] + } ingress { from_port = 80 to_port = 80 diff --git a/redbaron/modules/digitalocean/dns-c2/firewall.tf b/redbaron/modules/digitalocean/dns-c2/firewall.tf index acc006c..3aef1d6 100644 --- a/redbaron/modules/digitalocean/dns-c2/firewall.tf +++ b/redbaron/modules/digitalocean/dns-c2/firewall.tf @@ -26,6 +26,11 @@ resource "digitalocean_firewall" "web" { port_range = "22" source_addresses = ["${data.external.get_public_ip.result["ip"]}/32"] } + inbound_rule { # Rule for covenant admin panel + protocol = "tcp" + port_range = "7443" + source_addresses = ["${data.external.get_public_ip.result["ip"]}/32"] + } inbound_rule { protocol = "udp" port_range = "60000-61000" diff --git a/redbaron/modules/digitalocean/http-c2/firewall.tf b/redbaron/modules/digitalocean/http-c2/firewall.tf index 560faf1..fecf46a 100644 --- a/redbaron/modules/digitalocean/http-c2/firewall.tf +++ b/redbaron/modules/digitalocean/http-c2/firewall.tf @@ -26,6 +26,11 @@ resource "digitalocean_firewall" "web" { port_range = "22" source_addresses = ["${data.external.get_public_ip.result["ip"]}/32"] } + inbound_rule { # Rule for covenant admin panel + protocol = "tcp" + port_range = "7443" + source_addresses = ["${data.external.get_public_ip.result["ip"]}/32"] + } inbound_rule { protocol = "udp" port_range = "60000-61000" From 6a872b0a2b7208bacebc29e50643ae2ae5bbb79e Mon Sep 17 00:00:00 2001 From: tes Date: Mon, 29 Jun 2020 00:27:53 -0700 Subject: [PATCH 2/5] fix: bug on ansible redirectors --- modules/ansible.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ansible.py b/modules/ansible.py index 6e2f74c..0725d8c 100644 --- a/modules/ansible.py +++ b/modules/ansible.py @@ -71,7 +71,7 @@ def __init__(self): # Create list with modules id modules_ids=[] for c in campaign_list: - if c["module"] != "dns_record" and c["module"] != "letsencrypt" and c["module"] != "godaddy" and c["module"] != "ansible": + if c["module"] != "dns_record" and c["module"] != "letsencrypt" and c["module"] != "godaddy" and c["module"] != "ansible" and c["module"] != "redirector" and c["module"] != "mail": modules_ids.insert(len(modules_ids),(c["id"]+"/"+c["module"])) if c["module"] != "redirector": for i in range(c["redirectors"]): From 18bcd5a83a58b823cbc58b6754463eff4dce8243 Mon Sep 17 00:00:00 2001 From: tes Date: Mon, 29 Jun 2020 03:59:56 -0700 Subject: [PATCH 3/5] fix: ubuntu distro DO when redirectors 0 --- modules/providers/digitalocean.py | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/providers/digitalocean.py b/modules/providers/digitalocean.py index e1a80e9..96c6fb9 100644 --- a/modules/providers/digitalocean.py +++ b/modules/providers/digitalocean.py @@ -82,6 +82,7 @@ def c2(c): module "c2_{c["id"]}" {{ source = "../../redbaron/modules/{c["provider"]}/{c["type"]}-c2" install = [{scripts}] + distro = "{linux_distro}" size = "{c["size"]}" regions = ["{c["region"]}"] }} From 18d4486d3a7700f24c38ac94b31ee6d8738dd82c Mon Sep 17 00:00:00 2001 From: tes Date: Mon, 29 Jun 2020 05:34:18 -0700 Subject: [PATCH 4/5] update: new iRedMail version --- redbaron/data/scripts/iredmail.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redbaron/data/scripts/iredmail.sh b/redbaron/data/scripts/iredmail.sh index 8806224..2c7bee1 100644 --- a/redbaron/data/scripts/iredmail.sh +++ b/redbaron/data/scripts/iredmail.sh @@ -1,10 +1,10 @@ #bin/bash -wget https://github.com/iredmail/iRedMail/archive/1.2.1.tar.gz +wget https://github.com/iredmail/iRedMail/archive/1.3.tar.gz -tar -xf 1.2.1.tar.gz +tar -xf 1.3.tar.gz -cd iRedMail-1.2.1 +cd iRedMail-1.3 echo -e "AUTO_USE_EXISTING_CONFIG_FILE=y \ \nAUTO_INSTALL_WITHOUT_CONFIRM=y \ From 4ae99505c34230b07fc556a9f1d1852b9d81aaf8 Mon Sep 17 00:00:00 2001 From: tes Date: Fri, 3 Jul 2020 00:12:06 -0700 Subject: [PATCH 5/5] fix: Gophish password autogenerated issue --- modules/providers/aws.py | 6 ++++++ modules/providers/digitalocean.py | 6 ++++++ redbaron/data/scripts/gophish.sh | 8 ++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/providers/aws.py b/modules/providers/aws.py index cdea593..c9a3696 100644 --- a/modules/providers/aws.py +++ b/modules/providers/aws.py @@ -183,6 +183,9 @@ def gophish(c): value = "${{module.gophish_rdir_{c["id"]}.ips}}" }} +output "Admin_Password_{c["id"]}" {{ + value = "You can find the auto-generated Gophish admin password at: /opt/goapps/src/github.com/gophish/password.txt" +}} """ else: output = f""" @@ -197,6 +200,9 @@ def gophish(c): value = "${{module.gophish_{c["id"]}.ips}}" }} +output "Admin_Password_{c["id"]}" {{ + value = "You can find the auto-generated Gophish admin password at: /opt/goapps/src/github.com/gophish/password.txt" +}} """ return output diff --git a/modules/providers/digitalocean.py b/modules/providers/digitalocean.py index 96c6fb9..811571e 100644 --- a/modules/providers/digitalocean.py +++ b/modules/providers/digitalocean.py @@ -157,6 +157,9 @@ def gophish(c): value = "${{module.gophish_rdir_{c["id"]}.ips}}" }} +output "Admin_Password_{c["id"]}" {{ + value = "You can find the auto-generated Gophish admin password at: /opt/goapps/src/github.com/gophish/password.txt" +}} """ else: output = f""" @@ -170,6 +173,9 @@ def gophish(c): value = "${{module.gophish_{c["id"]}.ips}}" }} +output "Admin_Password_{c["id"]}" {{ + value = "You can find the auto-generated Gophish admin password at: /opt/goapps/src/github.com/gophish/password.txt" +}} """ return output diff --git a/redbaron/data/scripts/gophish.sh b/redbaron/data/scripts/gophish.sh index a7eba28..76e2da1 100644 --- a/redbaron/data/scripts/gophish.sh +++ b/redbaron/data/scripts/gophish.sh @@ -29,5 +29,9 @@ echo "export PATH=$GOPATH/bin:$GOROOT/bin:$PATH" >> /root/.profile source /root/.profile #create readme file -echo "systemctl start gophish.service (start the service)" >> /root/README.txt -echo "systemctl stop gophish.service (stop the service)" >> /root/README.txt \ No newline at end of file +echo "systemctl start gophish.service (start the service)" >> /opt/goapps/src/github.com/gophish/README.txt +echo "systemctl stop gophish.service (stop the service)" >> /opt/goapps/src/github.com/gophish/README.txt + +sleep 30s + +cat /var/log/gophish.err | grep 'Please login with the username admin and the password' > /opt/goapps/src/github.com/gophish/password.txt \ No newline at end of file