Foremost e File di testo

Installazione, configurazione e uso di programmi e strumenti.
Scrivi risposta
funesto
Prode Principiante
Messaggi: 17
Iscrizione: mercoledì 21 gennaio 2015, 13:51
Distribuzione: Xubuntu

Foremost e File di testo

Messaggio da funesto »

Ciao!
Mi sto "divertendo" con Foremost e con hard disk vecchi di 20 anni. Pensavo di fare qualcosa di piacevolmente nostalgico e invece sono saltate fuori foto in cui avevo ancora i capelli e ora sono depresso.

A partre questo ... c'è un modo per recuperare file di testo? Che siano di estensione txt o magari log?

Grazie per le eventuali risposte!

G.
Avatar utente
GjMan78
Rampante Reduce
Rampante Reduce
Messaggi: 5394
Iscrizione: mercoledì 22 novembre 2006, 19:15
Desktop: KdePlasma
Distribuzione: EndeavourOS
Sesso: Maschile
Località: ~/Italia/Lazio/Viterbo/

Re: Foremost e File di testo

Messaggio da GjMan78 »

Foremost è configurabile.
Di default lavora già con i tipi di file più comuni ma all'occorrenza si può modificare il file foremost.conf per istruire il software a riconoscere nuove tipologie.

Un'ottima guida (in inglese) la trovi qui https://linuxconfig.org/how-to-recover- ... t-on-linux
MacBook Pro - Intel i5-3210 - 16 Gbyte Ram DDR3 - SSD 500 Gbyte x 2
»»» 𝗙𝗮𝗶 𝗶𝗹 𝗕𝗮𝗰𝗸𝘂𝗽! ¯\_(ツ)_/¯
funesto
Prode Principiante
Messaggi: 17
Iscrizione: mercoledì 21 gennaio 2015, 13:51
Distribuzione: Xubuntu

Re: Foremost e File di testo

Messaggio da funesto »

Grazie per la risposta! Ho visto che è possibile inserire gli "header" di uno specifico file per recuperarlo ... tuttavia che header ha un file di testo? Ho provato ad editarne uno e naturalmente ha gli esadecimali del testo stesso!!

P.s.
Con i log dovrebbe andar bene dato che hanno le stesse "parole introduttive" :-) Grazie di nuovo, ora sperimento!
Avatar utente
GjMan78
Rampante Reduce
Rampante Reduce
Messaggi: 5394
Iscrizione: mercoledì 22 novembre 2006, 19:15
Desktop: KdePlasma
Distribuzione: EndeavourOS
Sesso: Maschile
Località: ~/Italia/Lazio/Viterbo/

Re: Foremost e File di testo

Messaggio da GjMan78 »

funesto ha scritto:
martedì 31 gennaio 2023, 17:35
Grazie per la risposta! Ho visto che è possibile inserire gli "header" di uno specifico file per recuperarlo ... tuttavia che header ha un file di testo? Ho provato ad editarne uno e naturalmente ha gli esadecimali del testo stesso!!
Hai ragione. I file txt sono plain text, quindi non hanno header o footer. I'm sorry...
MacBook Pro - Intel i5-3210 - 16 Gbyte Ram DDR3 - SSD 500 Gbyte x 2
»»» 𝗙𝗮𝗶 𝗶𝗹 𝗕𝗮𝗰𝗸𝘂𝗽! ¯\_(ツ)_/¯
funesto
Prode Principiante
Messaggi: 17
Iscrizione: mercoledì 21 gennaio 2015, 13:51
Distribuzione: Xubuntu

Re: Foremost e File di testo

Messaggio da funesto »

GjMan78 ha scritto:
martedì 31 gennaio 2023, 17:54
funesto ha scritto:
martedì 31 gennaio 2023, 17:35
Grazie per la risposta! Ho visto che è possibile inserire gli "header" di uno specifico file per recuperarlo ... tuttavia che header ha un file di testo? Ho provato ad editarne uno e naturalmente ha gli esadecimali del testo stesso!!
Hai ragione. I file txt sono plain text, quindi non hanno header o footer. I'm sorry...
Non essere Sorry! :-) Anzi! Grazie per avermi dato la dritta del file di config! Ho inserito l' "header" di un tipico file di LOG di mio interesse. L'unica cosa che con -t log (pur avendolo chiamato così nel .config) non parte. Mi ritrovo con il piccolo "Help" di Foremost che spiega le impostazioni. Naturalmente nel config ho inserito la linea senza #

Proverò con -t all, sperando che peschi anche il "log" ma dal file audit non sembra
Avatar utente
GjMan78
Rampante Reduce
Rampante Reduce
Messaggi: 5394
Iscrizione: mercoledì 22 novembre 2006, 19:15
Desktop: KdePlasma
Distribuzione: EndeavourOS
Sesso: Maschile
Località: ~/Italia/Lazio/Viterbo/

Re: Foremost e File di testo

Messaggio da GjMan78 »

Prova a postare qui il contenuto del file .conf, magari 4 occhi sono meglio di 2.
MacBook Pro - Intel i5-3210 - 16 Gbyte Ram DDR3 - SSD 500 Gbyte x 2
»»» 𝗙𝗮𝗶 𝗶𝗹 𝗕𝗮𝗰𝗸𝘂𝗽! ¯\_(ツ)_/¯
funesto
Prode Principiante
Messaggi: 17
Iscrizione: mercoledì 21 gennaio 2015, 13:51
Distribuzione: Xubuntu

Re: Foremost e File di testo

Messaggio da funesto »

Ho lasciato tutto intonso ... tranne nell'ultima riga!

Codice: Seleziona tutto

#
# Foremost configuration file
#-------------------------------------------------------------------------
# Note the foremost configuration file is provided to support formats which
# don't have built-in extraction functions.  If the format is built-in to foremost
# simply run foremost with -t <suffix> and provide the format you wish to extract. 
#
# The configuration file is used to control what types of files foremost
# searches for. A sample configuration file, foremost.conf, is included with
# this distribution. For each file type, the configuration file describes
# the file's extension, whether the header and footer are case sensitive,
# the maximum file size, and the header and footer for the file. The footer
# field is optional, but header, size, case sensitivity, and extension are
# not!
#
# Any line that begins with a '#' is considered a comment and ignored. Thus,
# to skip a file type just put a '#' at the beginning of that line
#

# Headers and footers are decoded before use. To specify a value in
# hexadecimal use \x[0-f][0-f], and for octal use \[0-3][0-7][0-7].  Spaces
# can be represented by \s. Example: "\x4F\123\I\sCCI" decodes to "OSI CCI".
#
# To match any single character (aka a wildcard) use a '?'. If you need to
# search for the '?' character, you will need to change the 'wildcard' line
# *and* every occurrence of the old wildcard character in the configuration
# file. Don't forget those hex and octal values! '?' is equal to 0x3f and
# \063.
#
# If you would like to extract files without an extension enter the value
# "NONE" in the extension column (note: you can change the value of this
# "no suffix" flag by setting the variable FOREMOST_NOEXTENSION_SUFFIX
# in foremost.h and recompiling).
#
# The ASCII option will extract all ASCII printable characters before and after 
# the keyword provided.
#
# The NEXT keyword after a footer instructs foremost to search forwards for data 
# that starts with the header provided and terminates or is followed by data in 
# the footer -- the footer data is not included in the output.  The data in the 
# footer, when used with the NEXT keyword effectively allows you to search for 
# data that you know for sure should not be in the output file.  This method for 
# example, lets you search for two 'starting' headers in a document that doesn't 
# have a good ending footer and you can't say exactly what the footer is, but 
# you know if you see another header, that should end the search and an output
# file should be written.

# To redefine the wildcard character, change the setting below and all
# occurances in the formost.conf file.
#
#wildcard  ?
#
#		case	size	header			footer
#extension   sensitive	
#
#---------------------------------------------------------------------
# EXAMPLE WITH NO SUFFIX
#---------------------------------------------------------------------
#
# Here is an example of how to use the no extension option. Any files 
# containing the string "FOREMOST" would be extracted to a file without 
# an extension (eg: 00000000,00000001)
#      NONE     y      1000     FOREMOST
#
#---------------------------------------------------------------------
# GRAPHICS FILES
#---------------------------------------------------------------------	
#
#
# AOL ART files
#	art	y	150000	\x4a\x47\x04\x0e	\xcf\xc7\xcb
#  	art	y 	150000	\x4a\x47\x03\x0e	\xd0\xcb\x00\x00
#
# GIF and JPG files (very common)
#	(NOTE THESE FORMATS HAVE BUILTIN EXTRACTION FUNCTION)
#	gif	y	155000000	\x47\x49\x46\x38\x37\x61	\x00\x3b
#  	gif	y 	155000000	\x47\x49\x46\x38\x39\x61	\x00\x00\x3b
#  	jpg	y	20000000	\xff\xd8\xff\xe0\x00\x10	\xff\xd9
#  	jpg	y	20000000	\xff\xd8\xff\xe1 \xff\xd9 
#  	jpg	y	20000000	\xff\xd8	\xff\xd9
#
# PNG   (used in web pages)
#	(NOTE THIS FORMAT HAS A BUILTIN EXTRACTION FUNCTION)
#  	png	y	200000	\x50\x4e\x47?	\xff\xfc\xfd\xfe
#
#
# BMP 	
#	(NOTE THIS FORMAT HAS A BUILTIN EXTRACTION FUNCTION)
#	bmp	y	100000	BM??\x00\x00\x00
#
# TIF
#  	tif	y	200000000	\x49\x49\x2a\x00
#
#---------------------------------------------------------------------	
# ANIMATION FILES
#---------------------------------------------------------------------	
#
# AVI (Windows animation and DiVX/MPEG-4 movies)
#	(NOTE THIS FORMAT HAS A BUILTIN EXTRACTION FUNCTION)
#  	avi	y	4000000 RIFF????AVI
#
# Apple Quicktime
#	(NOTE THIS FORMAT HAS A BUILTIN EXTRACTION FUNCTION)
#	mov	y	4000000	????????\x6d\x6f\x6f\x76
#	mov	y	4000000	????????\x6d\x64\x61\x74
#
# MPEG Video
#	mpg	y	4000000	mpg	eof
#	mpg	y	20000000 \x00\x00\x01\xba      \x00\x00\x01\xb9
#	mpg     y 	20000000 \x00\x00\x01\xb3 	\x00\x00\x01\xb7
#
# Macromedia Flash
#	fws	y	4000000	FWS
#
#---------------------------------------------------------------------	
# MICROSOFT OFFICE 
#---------------------------------------------------------------------	
#
# Word documents
#	(NOTE THIS FORMAT HAS A BUILTIN EXTRACTION FUNCTION)
#	doc	y	12500000  \xd0\xcf\x11\xe0\xa1\xb1
#
# Outlook files
#	pst	y	400000000 \x21\x42\x4e\xa5\x6f\xb5\xa6
#	ost	y	400000000 \x21\x42\x44\x4e
#
# Outlook Express
#	dbx	y	4000000	\xcf\xad\x12\xfe\xc5\xfd\x74\x6f
#	idx	y	4000000	\x4a\x4d\x46\x39
#	mbx	y	4000000	\x4a\x4d\x46\x36
#
#---------------------------------------------------------------------	
# WORDPERFECT
#---------------------------------------------------------------------
#
#	wpc	y	100000	?WPC
#
#---------------------------------------------------------------------	
# HTML		(NOTE THIS FORMAT HAS A BUILTIN EXTRACTION FUNCTION)
#---------------------------------------------------------------------	
#
#	htm	n	50000   <html			</html>
#
#---------------------------------------------------------------------	
# ADOBE PDF	(NOTE THIS FORMAT HAS A BUILTIN EXTRACTION FUNCTION)
#---------------------------------------------------------------------	
#
#	pdf	y	5000000	%PDF-  %EOF 
#
#
#---------------------------------------------------------------------	
# AOL (AMERICA ONLINE)
#---------------------------------------------------------------------	
#
# AOL Mailbox
#	mail	y	500000	 \x41\x4f\x4c\x56\x4d
#
#
#	
#---------------------------------------------------------------------	
# PGP (PRETTY GOOD PRIVACY)
#---------------------------------------------------------------------	
#
# PGP Disk Files
#	pgd	y	500000	\x50\x47\x50\x64\x4d\x41\x49\x4e\x60\x01
#
# Public Key Ring
#	pgp	y	100000	\x99\x00
# Security Ring
#	pgp	y	100000	\x95\x01
#	pgp	y	100000	\x95\x00
# Encrypted Data or ASCII armored keys
#	pgp	y	100000	\xa6\x00
# (there should be a trailer for this...)
#	txt	y	100000	-----BEGIN\040PGP
#
#
#---------------------------------------------------------------------	
# RPM (Linux package format)
#---------------------------------------------------------------------	
#	rpm	y	1000000	\xed\xab
#
#
#---------------------------------------------------------------------	
# SOUND FILES
#---------------------------------------------------------------------	
#	(NOTE THIS FORMAT HAS A BUILTIN EXTRACTION FUNCTION)
#	wav     y	200000	RIFF????WAVE
#
# Real Audio Files
#	ra	y	1000000	\x2e\x72\x61\xfd
#	ra	y	1000000	.RMF
#
#	asf     y       8000000	 \x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C
#
#	wmv     y       20000000 \x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C
#
#	wma     y       8000000  \x30\x26\xB2\x75    \x00\x00\x00\xFF
#
#	wma     y       8000000  \x30\x26\xB2\x75    \x52\x9A\x12\x46
#
#	mp3     y    	8000000 \xFF\xFB??\x44\x00\x00
#	mp3     y    	8000000 \x57\x41\x56\45            \x00\x00\xFF\
#	mp3     y    	8000000 \xFF\xFB\xD0\            \xD1\x35\x51\xCC\
#	mp3     y    	8000000 \x49\x44\x33\
#	mp3     y    	8000000 \x4C\x41\x4D\x45\
#---------------------------------------------------------------------	
# WINDOWS REGISTRY FILES
#---------------------------------------------------------------------	
# 
# Windows NT registry
#	dat	y	4000000	regf
# Windows 95 registry
#	dat	y	4000000	CREG
#
#    	lnk     y    	5000	\x4C\x00\x00\x00\x01\x14\x02\x00\x00\x00\x00\x00\xC0\x00\x00
#    	chm     y    	100000	\x49\x54\x53\x46\x03\x00\x00\x00\x60\x00\x00\x00\x01\x00\x00
#    	cookie  n    	4096    id=
#    	rdp     y    	4096	\xFF\xFE\x73\x00\x63\x00\x72\x00\x65\x00\x65\x00\x6E\x00\x20\x00\x6D
#
#---------------------------------------------------------------------	
# MISCELLANEOUS
#---------------------------------------------------------------------	
#	(NOTE THIS FORMAT HAS BUILTIN EXTRACTION FUNCTION)
#	zip	y	10000000	PK\x03\x04	\x3c\xac
#	(NOTE THIS FORMAT HAS BUILTIN EXTRACTION FUNCTION)
#	rar	y	10000000	Rar!
#
#	java	y	1000000	\xca\xfe\xba\xbe
#
#	cpp	y	20000	#include	#include	ASCII
#---------------------------------------------------------------------	
# ScanSoft PaperPort "Max" files
#---------------------------------------------------------------------	
#      max   y     1000000    \x56\x69\x47\x46\x6b\x1a\x00\x00\x00\x00   \x00\x00\x05\x80\x00\x00 
#---------------------------------------------------------------------	
# PINs Password Manager program
#---------------------------------------------------------------------	
#      pins  y     8000     \x50\x49\x4e\x53\x20\x34\x2e\x32\x30\x0d

log    y       30000000    \x0d\x0a\x53\x65\x73\x73\x69\x6f/x6e/x20/x53/x74/x61/x72/x74/x3a
Avatar utente
GjMan78
Rampante Reduce
Rampante Reduce
Messaggi: 5394
Iscrizione: mercoledì 22 novembre 2006, 19:15
Desktop: KdePlasma
Distribuzione: EndeavourOS
Sesso: Maschile
Località: ~/Italia/Lazio/Viterbo/

Re: Foremost e File di testo

Messaggio da GjMan78 »

\x0d\x0a\x53\x65\x73\x73\x69\x6f/x6e/x20/x53/x74/x61/x72/x74/x3a
sicuro che queste slash / siano corrette?

Puoi postare il risultato di hexdump -C di uno di questi logfile?
Ultima modifica di GjMan78 il martedì 31 gennaio 2023, 19:05, modificato 1 volta in totale.
MacBook Pro - Intel i5-3210 - 16 Gbyte Ram DDR3 - SSD 500 Gbyte x 2
»»» 𝗙𝗮𝗶 𝗶𝗹 𝗕𝗮𝗰𝗸𝘂𝗽! ¯\_(ツ)_/¯
funesto
Prode Principiante
Messaggi: 17
Iscrizione: mercoledì 21 gennaio 2015, 13:51
Distribuzione: Xubuntu

Re: Foremost e File di testo

Messaggio da funesto »

Oh Cacch..... ho invertito gli (o le?) slash!

Codice: Seleziona tutto

00000000  0d 0a 53 65 73 73 69 6f  6e 20 53 74 61 72 74 3a  |..Session Start:|
00000010  20 54 75 65 20 4a 75 6c  20 30 32 20 30 30 3a 30  | Tue Jul 02 00:0|
00000020  36 3a 34 37 20 32 30 30  32 0d 0a 03 39 3c 03 30  |6:47 2002...
sudo foremost -t log -v -q -i /dev/sdb1 -o /home/ciava/Scrivania/hard_disk

Questo è il comando che do, ma mi restituisce la schermata d'aiuto!
Ultima modifica di funesto il martedì 31 gennaio 2023, 19:05, modificato 1 volta in totale.
Avatar utente
GjMan78
Rampante Reduce
Rampante Reduce
Messaggi: 5394
Iscrizione: mercoledì 22 novembre 2006, 19:15
Desktop: KdePlasma
Distribuzione: EndeavourOS
Sesso: Maschile
Località: ~/Italia/Lazio/Viterbo/

Re: Foremost e File di testo

Messaggio da GjMan78 »

funesto ha scritto:
martedì 31 gennaio 2023, 19:01
Oh Cacch..... ho invertito gli (o le?) slash!

Codice: Seleziona tutto

00000000  0d 0a 53 65 73 73 69 6f  6e 20 53 74 61 72 74 3a  |..Session Start:|
00000010  20 54 75 65 20 4a 75 6c  20 30 32 20 30 30 3a 30  | Tue Jul 02 00:0|
00000020  36 3a 34 37 20 32 30 30  32 0d 0a 03 39 3c 03 30  |6:47 2002...
Direi di si.

Sositutuisci le slash / con le backslash \ e dovrebbe funzionare.
MacBook Pro - Intel i5-3210 - 16 Gbyte Ram DDR3 - SSD 500 Gbyte x 2
»»» 𝗙𝗮𝗶 𝗶𝗹 𝗕𝗮𝗰𝗸𝘂𝗽! ¯\_(ツ)_/¯
funesto
Prode Principiante
Messaggi: 17
Iscrizione: mercoledì 21 gennaio 2015, 13:51
Distribuzione: Xubuntu

Re: Foremost e File di testo

Messaggio da funesto »

Niente!

Codice: Seleziona tutto

ciava@Linux:~/Scrivania$ sudo foremost -t log -v -q -i /dev/sdb1 -o /home/ciava/Scrivania/hard_disk
foremost version 1.5.7 by Jesse Kornblum, Kris Kendall, and Nick Mikus.
$ foremost [-v|-V|-h|-T|-Q|-q|-a|-w-d] [-t <type>] [-s <blocks>] [-k <size>] 
        [-b <size>] [-c <file>] [-o <dir>] [-i <file] 

-V  - display copyright information and exit
-t  - specify file type.  (-t jpeg,pdf ...) 
-d  - turn on indirect block detection (for UNIX file-systems) 
-i  - specify input file (default is stdin) 
-a  - Write all headers, perform no error detection (corrupted files) 
-w  - Only write the audit file, do not write any detected files to the disk 
-o  - set output directory (defaults to output)
-c  - set configuration file to use (defaults to foremost.conf)
-q  - enables quick mode. Search are performed on 512 byte boundaries.
-Q  - enables quiet mode. Suppress output messages. 
-v  - verbose mode. Logs all messages to screen
ciava@Linux:~/Scrivania$ 
Avatar utente
GjMan78
Rampante Reduce
Rampante Reduce
Messaggi: 5394
Iscrizione: mercoledì 22 novembre 2006, 19:15
Desktop: KdePlasma
Distribuzione: EndeavourOS
Sesso: Maschile
Località: ~/Italia/Lazio/Viterbo/

Re: Foremost e File di testo

Messaggio da GjMan78 »

Riguardo all'opzione -o, hard_disk è una directory?

Dove hai messo il file .conf? prova a specificare il path completo con l'opzione -c
MacBook Pro - Intel i5-3210 - 16 Gbyte Ram DDR3 - SSD 500 Gbyte x 2
»»» 𝗙𝗮𝗶 𝗶𝗹 𝗕𝗮𝗰𝗸𝘂𝗽! ¯\_(ツ)_/¯
funesto
Prode Principiante
Messaggi: 17
Iscrizione: mercoledì 21 gennaio 2015, 13:51
Distribuzione: Xubuntu

Re: Foremost e File di testo

Messaggio da funesto »

Si è una directory! Il file .conf è in /etc/ e ... ora provo l'opzione -c ! :-) Grazie


Edit: Niente!

sudo foremost -t log -v -q -i /dev/sdb1 -o /home/ciava/Scrivania/hard_disk -c /etc/foremost.conf
Avatar utente
GjMan78
Rampante Reduce
Rampante Reduce
Messaggi: 5394
Iscrizione: mercoledì 22 novembre 2006, 19:15
Desktop: KdePlasma
Distribuzione: EndeavourOS
Sesso: Maschile
Località: ~/Italia/Lazio/Viterbo/

Re: Foremost e File di testo

Messaggio da GjMan78 »

Se togli l'opzione -t il comando lo esegue?
MacBook Pro - Intel i5-3210 - 16 Gbyte Ram DDR3 - SSD 500 Gbyte x 2
»»» 𝗙𝗮𝗶 𝗶𝗹 𝗕𝗮𝗰𝗸𝘂𝗽! ¯\_(ツ)_/¯
funesto
Prode Principiante
Messaggi: 17
Iscrizione: mercoledì 21 gennaio 2015, 13:51
Distribuzione: Xubuntu

Re: Foremost e File di testo

Messaggio da funesto »

Azz! Stranamente SI ... e mi ha trovato dei file LOG .... domattina testo meglio. Non vorrei che ora cercasse solo quelli! Ad ogni modo, grazie mille per il tuo aiuto!
Avatar utente
wilecoyote
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 15349
Iscrizione: giovedì 20 agosto 2009, 16:21
Desktop: Kubuntu et alii
Distribuzione: 9.04 32bit 14/18/20/22.04 LTS 64bit
Sesso: Maschile
Località: Ceranesi - Ge

Re: Foremost e File di testo

Messaggio da wilecoyote »

) Salve, leggere in proposito questa wiki AmministrazioneSistema/RecuperoDati/Estrazione/Foremost, c'è anche il comando per leggere il header di ciascuna estensione file.

:: Ciao
ACER Extensa 5230E 2,2 Ghz cpu Celeron 900 hdd 160 GB Ram 1 GB scheda video Intel GM500
ACER Extensa 5635Z 2,2 Ghz cpu Celeron T3100 hdd 320 GB Ram 4 GB scheda video Intel Mobile 4
Quando una Finestra chiusa incontra un Pinguino la Finestra chiusa è una Finestra aperta.
Scrivi risposta

Ritorna a “Applicazioni”

Chi c’è in linea

Visualizzano questa sezione: 0 utenti iscritti e 11 ospiti