Comando Linux dd (clone forense)

Nelle indagini giudiziarie, sempre più spesso vi sono prove elettroniche, informatiche e tecnologiche. Per un consulente informatico è di fondamentale importanza non modificare ed alterare tutte le prove come harddisk o cellulare.

Con Linux c’è un bel tools dd con cui si possono clonare penne usb, ma con cui in generare si può clonare ogni singola device (che il kernel linux pone nella cartella /dev).

Il comando dd ha un bel help e tante belle opzioni. Copia byte per byte ogni cosa in un device e la invia un’altra periferica.

Se hai 1 disco da clonare, compratene uno delle stesse dimensioni o maggiore. Il clone del disco è facile in modalità forense.

Costruisciti una penna usb con la versione linux che più vi piace (io ho scelto Ubuntu per semplicità).

Segui i seguenti passi per clonare il disco:

  1. Fai boot con chiavetta USB ed iso di Ubuntu (evita di alterare gli originali)
  2. Inserisci i 2 dischi (supponiamo la sorgente /dev/sda ed la destinazione /dev/sdb)
  3. Col tools gdisk o fdisk, verifica l’esatta nomenclatura dei dischi (ti eviterà di fare danni!)
  4. Da terminale esegui il seguente comando:
sudo su -
dd if=/dev/sda of=/dev/sdb conv=noerror,sync status=progress bs=128M

La clonazione si avvierà e potrai controllare lo stato della copia.

Help di dd:

dd --help
Uso: dd [OPERANDO]...
  o: dd OPZIONE
Copy a file, converting and formatting according to the operands.

  bs=BYTES        read and write up to BYTES bytes at a time (default: 512);
                  overrides ibs and obs
  cbs=BYTES       convert BYTES bytes at a time
  conv=CONVS      convert the file as per the comma separated symbol list
  count=N         copy only N input blocks
  ibs=BYTES       read up to BYTES bytes at a time (default: 512)
  if=FILE         read from FILE instead of stdin
  iflag=FLAGS     read as per the comma separated symbol list
  obs=BYTES       write BYTES bytes at a time (default: 512)
  of=FILE         write to FILE instead of stdout
  oflag=FLAGS     write as per the comma separated symbol list
  seek=N          skip N obs-sized blocks at start of output
  skip=N          skip N ibs-sized blocks at start of input
  status=LEVEL    The LEVEL of information to print to stderr;
                  'none' suppresses everything but error messages,
                  'noxfer' suppresses the final transfer statistics,
                  'progress' shows periodic transfer statistics

N and BYTES may be followed by the following multiplicative suffixes:
c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000, M =1024*1024, xM =M,
GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y.

Each CONV symbol may be:

  ascii     from EBCDIC to ASCII
  ebcdic    from ASCII to EBCDIC
  ibm       from ASCII to alternate EBCDIC
  block     pad newline-terminated records with spaces to cbs-size
  unblock   replace trailing spaces in cbs-size records with newline
  lcase     change upper case to lower case
  ucase     change lower case to upper case
  sparse    try to seek rather than write the output for NUL input blocks
  swab      swap every pair of input bytes
  sync      pad every input block with NULs to ibs-size; when used
            with block or unblock, pad with spaces rather than NULs
  excl      fallisce se il file di output già esiste
  nocreat   non crea il file di output
  notrunc   non effettua il troncamento del file di output
  noerror   continua dopo errori di lettura
  fdatasync  scrive fisicamente i dati del file di output prima di finire
  fsync     similmente, ma scrive anche i metadati

Ciascun simbolo FLAG può essere:

  append    modalità append (ha senso solo per l'output; suggerito conv=notrunc)
  direct    utilizza I/O diretto per i dati
  directory  fallisce a meno che non sia una directory
  dsync     utilizza I/O sincronizzato per i dati
  sync      similmente, ma anche per metadati
  fullblock  accumula blocchi pieni di input (solo iflag)
  nonblock  utilizza I/O non bloccante
  noatime   non aggiorna l'orario di accesso
  nocache   Request to drop cache.  See also oflag=sync
  noctty    non assegna il controllo del terminale da file
  nofollow  non segue i collegamenti simbolici
  count_bytes  treat 'count=N' as a byte count (iflag only)
  skip_bytes  treat 'skip=N' as a byte count (iflag only)
  seek_bytes  treat 'seek=N' as a byte count (oflag only)

Sending a USR1 signal to a running 'dd' process makes it
print I/O statistics to standard error and then resume copying.

Options are:

      --help     mostra questo aiuto ed esce
      --version  stampa le informazioni sulla versione ed esce

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report dd translation bugs to <https://translationproject.org/team/>
Full documentation at: <https://www.gnu.org/software/coreutils/dd>
or available locally via: info '(coreutils) dd invocation'

Il comando dd e’ semplice ma molto potente. Usatelo con cura perche’ potrebbe distruggerve hard disk o pennette.

Lascia un commento