fixed payload sync and motd

This commit is contained in:
n0mad1k
2025-05-01 22:39:02 -04:00
parent 6b60b94768
commit 9e9383eeef
7 changed files with 83 additions and 59 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ C2_PAYLOAD_DIR="/root/Tools/Havoc/payloads"
REDIRECTOR_IP="{{ redirector_ip }}" REDIRECTOR_IP="{{ redirector_ip }}"
REDIRECTOR_USER="root" REDIRECTOR_USER="root"
SSH_KEY_PATH="/root/.ssh/id_ed25519" SSH_KEY_PATH="/root/.ssh/id_ed25519"
REMOTE_PAYLOAD_DIR="/var/www/payloads" REMOTE_PAYLOAD_DIR="/var/www/resources"
ENCRYPTED_TRANSFER=true ENCRYPTED_TRANSFER=true
LOG_FILE="/root/Tools/logs/payload_sync.log" LOG_FILE="/root/Tools/logs/payload_sync.log"
LOG_RETENTION_DAYS=3 LOG_RETENTION_DAYS=3
-54
View File
@@ -1,54 +0,0 @@
#!/bin/bash
# setup_payload_sync.sh - Configure systemd service and timer
# Create systemd service file
cat > /etc/systemd/system/payload-sync.service << EOF
[Unit]
Description=Secure Payload Sync Service
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/root/Tools/secure_payload_sync.sh
User=root
Group=root
# Security hardening
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
# Hide process information
StandardOutput=null
StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
# Create systemd timer with randomized schedule
cat > /etc/systemd/system/payload-sync.timer << EOF
[Unit]
Description=Secure Payload Sync Timer
Requires=payload-sync.service
[Timer]
# Run every 30-60 minutes with randomization
OnBootSec=5min
OnUnitActiveSec=30m
RandomizedDelaySec=30m
Persistent=true
[Install]
WantedBy=timers.target
EOF
# Copy script to proper location
cp secure_payload_sync.sh /root/Tools/
chmod 700 /root/Tools/secure_payload_sync.sh
# Enable and start timer
systemctl daemon-reload
systemctl enable payload-sync.timer
systemctl start payload-sync.timer
echo "Payload sync service installed and timer started"
+46
View File
@@ -6,6 +6,13 @@
apt: apt:
update_cache: yes update_cache: yes
- name: Disable default Kali MOTD
file:
path: "{{ ansible_env.HOME }}/.hushlogin"
state: touch
mode: '0644'
when: ansible_distribution == "Kali GNU/Linux"
- name: Set a custom MOTD - name: Set a custom MOTD
template: template:
src: "../templates/motd.j2" src: "../templates/motd.j2"
@@ -106,6 +113,7 @@
- "../files/secure-exit.sh" - "../files/secure-exit.sh"
- "../files/havoc_installer.sh" - "../files/havoc_installer.sh"
- "../files/havoc_shell_handler.sh" - "../files/havoc_shell_handler.sh"
- "../files/secure_payload_sync.sh"
- name: Copy post-install script - name: Copy post-install script
copy: copy:
@@ -131,6 +139,44 @@
owner: root owner: root
group: root group: root
- name: Set up systemd timer for payload sync
shell: |
cat > /etc/systemd/system/payload-sync.service << 'EOF'
[Unit]
Description=Secure Payload Sync Service
After=network-online.target
[Service]
Type=oneshot
ExecStart=/root/Tools/secure_payload_sync.sh
User=root
Group=root
PrivateTmp=true
StandardOutput=null
[Install]
WantedBy=multi-user.target
EOF
cat > /etc/systemd/system/payload-sync.timer << 'EOF'
[Unit]
Description=Secure Payload Sync Timer
Requires=payload-sync.service
[Timer]
OnBootSec=5min
OnUnitActiveSec=30m
RandomizedDelaySec=30m
Persistent=true
[Install]
WantedBy=timers.target
EOF
systemctl daemon-reload
systemctl enable payload-sync.timer
systemctl start payload-sync.timer
- name: Install Havoc C2 Framework - name: Install Havoc C2 Framework
shell: "/root/Tools/havoc_installer.sh" shell: "/root/Tools/havoc_installer.sh"
args: args:
+16
View File
@@ -2,6 +2,14 @@
# Common task for configuring redirector with full encryption # Common task for configuring redirector with full encryption
# Shared across all providers # Shared across all providers
- name: Set a custom MOTD
template:
src: "../templates/motd-redirector.j2"
dest: /etc/motd
owner: root
group: root
mode: '0644'
- name: Install required packages for redirector - name: Install required packages for redirector
apt: apt:
name: name:
@@ -111,6 +119,14 @@
group: root group: root
when: zero_logs | bool when: zero_logs | bool
- name: Create payload directory
file:
path: /var/www/resources
state: directory
mode: '0755'
owner: www-data
group: www-data
# Run port randomization if enabled # Run port randomization if enabled
- name: Run port randomization if enabled - name: Run port randomization if enabled
include_tasks: port_randomization.yml include_tasks: port_randomization.yml
+16
View File
@@ -0,0 +1,16 @@
================================================================
C2itall Redirector Post-Installation Instructions
================================================================
To complete your setup with SSL certificates, run:
/root/Tools/post_install_redirector.sh
This script will guide you through:
- Setting up Let's Encrypt certificates
- Starting required services
- Updating NGINX configuration
For enhanced OPSEC, you can also randomize ports:
/root/Tools/randomize_ports.sh
Run these after you've configured your DNS records to point to this server.
@@ -58,8 +58,8 @@ server {
} }
# Secure payload delivery path for synced payloads # Secure payload delivery path for synced payloads
location /payloads/ { location /resources/ {
alias /var/www/payloads/; alias /var/www/resources/;
limit_except GET { deny all; } limit_except GET { deny all; }
add_header X-Content-Type-Options "nosniff" always; add_header X-Content-Type-Options "nosniff" always;
add_header Content-Security-Policy "default-src 'none'" always; add_header Content-Security-Policy "default-src 'none'" always;
+2 -2
View File
@@ -58,8 +58,8 @@ server {
} }
# Secure payload delivery path for synced payloads # Secure payload delivery path for synced payloads
location /payloads/ { location /resources/ {
alias /var/www/payloads/; alias /var/www/resources/;
limit_except GET { deny all; } limit_except GET { deny all; }
add_header X-Content-Type-Options "nosniff" always; add_header X-Content-Type-Options "nosniff" always;
add_header Content-Security-Policy "default-src 'none'" always; add_header Content-Security-Policy "default-src 'none'" always;