#!/bin/bash set -uo pipefail ZARYA_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" STATE_DIR="${ZARYA_DIR}/state" SNAPSHOTS_DIR="${STATE_DIR}/snapshots" TARGET="${1:-all}" MODULES=( "00_workstation.sh" "01_pve.sh" "02_vps.sh" "03_vyos.sh" "04_tier0.sh" "05_k8s.sh" ) mkdir -p "${SNAPSHOTS_DIR}" generate_header() { local mod_name="$1" local timestamp branch short_hash commit_msg timestamp=$(date -u +"%Y-%m-%d %H:%M:%S UTC") branch=$(git -C "${ATLAS_DIR:-$HOME/Projects/atlas}" branch --show-current 2>/dev/null || echo "unknown") short_hash=$(git -C "${ATLAS_DIR:-$HOME/Projects/atlas}" rev-parse --short HEAD 2>/dev/null || echo "none") commit_msg=$(git -C "${ATLAS_DIR:-$HOME/Projects/atlas}" log -1 --format='%s' 2>/dev/null || echo "none") cat < Сбор модуля: ${mod_name}..." generate_header "${mod_name}" > "${tmp_file}" if [[ -x "${script}" ]]; then "${script}" >> "${tmp_file}" 2>&1 else bash "${script}" >> "${tmp_file}" 2>&1 fi mv "${tmp_file}" "${out_file}" } if [[ "${TARGET}" == "all" ]]; then echo "==> Сбор полного аудита Sovereign C2 в ${SNAPSHOTS_DIR}..." for mod in "${MODULES[@]}"; do run_single_module "${mod}" done echo "✔ Все модули телеметрии успешно сохранены." else case "${TARGET}" in 00_workstation|workstation|host) run_single_module "00_workstation.sh" ;; 01_pve|pve) run_single_module "01_pve.sh" ;; 02_vps|vps) run_single_module "02_vps.sh" ;; 03_vyos|vyos|net) run_single_module "03_vyos.sh" ;; 04_tier0|tier0) run_single_module "04_tier0.sh" ;; 05_k8s|k8s|talos) run_single_module "05_k8s.sh" ;; *) echo "Неизвестный модуль: ${TARGET}" exit 1 ;; esac fi