Cuando intentas “crear archivos corruptos” para faltar a clase y terminas dañando tu tarea de verdad 🤡📁💀
def create_corrupted_file(filename, size): try: with open(filename, 'wb') as file: for _ in range(size): file.write(random.randint(0, 255).to_bytes(1, 'big')) print(f"Corrupted file {filename} created.") except Exception as e: print(f"An error occurred: {e}") crear archivos corruptos
🧪 ¿Necesitas crear archivos corruptos para pruebas? Abre un archivo .txt, escribe basura al azar, cámbiale la extensión a .docx o .jpg. ¡Corrupto al instante! Cuando intentas “crear archivos corruptos” para faltar a
dd if=/dev/urandom of=mi_archivo.docx bs=1 count=100 seek=50 conv=notrunc size): try: with open(filename
Para una corrupción más agresiva y aleatoria.
One simple way to corrupt a file is to append or modify its content in a way that the file becomes unreadable or causes errors when processed.