-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBatch_11_Extraer_Info_Mac_Shell.sh
More file actions
63 lines (51 loc) · 1.76 KB
/
Copy pathBatch_11_Extraer_Info_Mac_Shell.sh
File metadata and controls
63 lines (51 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Crear carpeta con nombre dinámico
HOSTNAME=$(hostname)
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
OUTPUT_DIR="Info_Mac_${HOSTNAME}_${TIMESTAMP}"
mkdir -p "$OUTPUT_DIR"
# Función para guardar comandos
function save() {
local name=$1
local cmd=$2
echo "[+] Guardando $name..."
echo "### $cmd" > "$OUTPUT_DIR/$name.txt"
eval "$cmd" >> "$OUTPUT_DIR/$name.txt" 2>/dev/null
}
# Información general del sistema
save "sistema" "system_profiler SPSoftwareDataType"
save "hardware" "system_profiler SPHardwareDataType"
save "almacenamiento" "system_profiler SPStorageDataType"
save "discos" "diskutil list"
save "smart_status" "diskutil info disk0"
# Red
save "interfaces_de_red" "ifconfig"
save "ip_rutas" "netstat -rn"
save "dns" "scutil --dns"
save "puertos_abiertos" "lsof -nP -iTCP -sTCP:LISTEN"
# CPU y RAM
save "cpu" "sysctl -n machdep.cpu.brand_string"
save "ram" "sysctl hw.memsize"
# Usuarios y grupos
save "usuarios" "dscl . list /Users"
save "grupos" "dscl . list /Groups"
save "usuarios_logueados" "who"
save "permisos_sudo" "cat /etc/sudoers"
# Procesos y servicios
save "procesos" "ps aux"
save "servicios" "launchctl list"
# Aplicaciones instaladas
save "aplicaciones" "ls /Applications"
save "paquetes_brew" "brew list" # Solo si tienes Homebrew
save "paquetes_mas" "mas list" # Solo si tienes mas-cli
# Variables de entorno
save "entorno" "printenv"
# Dispositivos conectados
save "usb" "system_profiler SPUSBDataType"
save "thunderbolt" "system_profiler SPThunderboltDataType"
save "bluetooth" "system_profiler SPBluetoothDataType"
# Logs recientes
save "log_sistema" "log show --predicate 'eventMessage contains \"error\"' --last 1h"
save "dmesg" "dmesg | tail -n 100"
echo ""
echo "✅ Toda la información fue guardada en la carpeta: $OUTPUT_DIR"