-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfileNuke.sh
More file actions
33 lines (26 loc) · 897 Bytes
/
fileNuke.sh
File metadata and controls
33 lines (26 loc) · 897 Bytes
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
#!/bin/bash
# Author: Francisco Senén Gómez Méndez
# Función para imprimir un mensaje de ayuda
print_usage() {
echo "Uso: $0 <archivo1> <archivo2> ... <archivo>"
exit 1
}
# Verificar si se proporciona al menos un archivo como argumento
if [ $# -eq 0 ]; then
echo "Se requiere al menos un archivo como argumento."
print_usage
fi
# Iterar sobre todos los archivos pasados como argumento
for file in "$@"; do
# Verificar si el archivo existe
if [ ! -e "$file" ]; then
echo "[-] El archivo '$file' no existe."
continue
fi
# Obtener el tamaño del archivo
file_size=$(stat -c %s "$file")
# Sobrescribir el archivo con datos aleatorios
echo "Sobrescribiendo '$file' con datos aleatorios..."
dd if=/dev/urandom of="$file" bs=$file_size count=1 status=progress
echo "[+] ¡Operación completada con éxito para '$file'!"
done