Documentation ¶
Index ¶
- Constants
- func CheckInstall(version string) error
- func CheckVersion(db *sql.DB, version string) (bool, string, error)
- func ChecksumNSRL(nsrldbfile string)
- func ConnectFileTroveDB(dbpath string) (*sql.DB, error)
- func ConnectNSRL(nsrldbfile string) (*bbolt.DB, error)
- func CreateFileList(rootDir string) ([]string, []string, error)
- func CreateFileTroveDB(dbpath string, version string, initdate string) error
- func CreateNSRLBoltDB(nsrlsourcefile string, nsrldbfile string) error
- func CreateUUID() (string, error)
- func Entropy(path string) (entropy float64, err error)
- func ExportSessionDCTSV(sessionuuid string) error
- func ExportSessionDirectoriesTSV(sessionuuid string) error
- func ExportSessionEXIFTSV(sessionuuid string) error
- func ExportSessionFilesTSV(sessionuuid string) error
- func ExportSessionSessionTSV(sessionuuid string) ([]string, error)
- func GetImageFiles(db *sql.DB, sessionuuid string) (map[string]string, error)
- func GetNSRL() error
- func GetSiegfriedDB() error
- func GetValueNSRL(db *bbolt.DB, sha1hash []byte) (bool, error)
- func Hashit(inFile string, hashalg string) ([]byte, error)
- func InsertDC(db *sql.DB, sessionuuid string, dcuuid string, dc DublinCore) error
- func InsertExif(db *sql.DB, exifuuid string, sessionid string, fileuuid string, e ExifParsed) error
- func InsertSession(db *sql.DB, s SessionMD) error
- func InstallFT(installPath string, version string, initdate string) (error, error, error, error, error)
- func ListSessions(db *sql.DB) error
- func PrepInsertDir(db *sql.DB) (*sql.Stmt, error)
- func PrepInsertFile(db *sql.DB) (*sql.Stmt, error)
- func PrintBanner()
- func PrintLicense(version string, build string)
- func ReturnSupportedHashes() [5]string
- type DublinCore
- type ExifParsed
- type FileMD
- type FileTime
- type HashSumsFile
- type ResumeInfo
- type SessionMD
- type SiegfriedType
Constants ¶
const ( // MaxFileSize is the max size file that should be processed. This defaults to 1 GB. MaxFileSize = 1073741824 // MaxEntropyChunk is the max byte size of a chunk read MaxEntropyChunk = 256000 )
Variables ¶
This section is empty.
Functions ¶
func CheckInstall ¶
CheckInstall checks if all necessary file are available
func CheckVersion ¶
CheckVersion checks if the filetrove version is compatible to the database Compatible means same version for now. This could change in the future.
func ChecksumNSRL ¶
func ChecksumNSRL(nsrldbfile string)
ChecksumNSRL checks a NSRL BoltDB's checksum that is provided with a sidecar file
func ConnectFileTroveDB ¶
ConnectFileTroveDB creates a connection to an existing sqlite database.
func ConnectNSRL ¶
ConnectNSRL connects to local bbolt NSRL file
func CreateFileList ¶
CreateFileList creates a list of file paths and a directory listing
func CreateFileTroveDB ¶
CreateFileTroveDB creates a new an empty sqlite database for FileTrove. It contains information like configurations, sessions and db versions.
func CreateNSRLBoltDB ¶
func ExportSessionDCTSV ¶
ExportSessionDCTSV exports all exif metadata from a session to a TSV file. Filtering is done by session UUID.
func ExportSessionDirectoriesTSV ¶
ExportSessionDirectoriesTSV exports all directory metadata from a session to a TSV file. Filtering is done by session UUID.
func ExportSessionEXIFTSV ¶
ExportSessionEXIFTSV exports all exif metadata from a session to a TSV file. Filtering is done by session UUID.
func ExportSessionFilesTSV ¶
ExportSessionFilesTSV exports all file metadata from a session to a TSV file. Filtering is done by session UUID.
func ExportSessionSessionTSV ¶
ExportSessionSessionTSV exports all session metadata from a session to a TSV file. Filtering is done by session UUID.
func GetImageFiles ¶
GetImageFiles queries all files that have mime type image from a session
func GetNSRL ¶
func GetNSRL() error
GetNSRL downloads a prepared BoltDB database file from an online storage
func GetValueNSRL ¶
GetValueNSRL reads bbolt database and checks if a given sha1 hash is present in the database
func InsertExif ¶
InsertExif inserts exif metadata into the FileTrove database
func InsertSession ¶
InsertSession adds session metadata to the database
func InstallFT ¶
func InstallFT(installPath string, version string, initdate string) (error, error, error, error, error)
InstallFT creates and downloads necessary directories and databases and copies them to installPath
func ListSessions ¶
ListSessions lists all sessions from the FileTrove database
func PrepInsertDir ¶
PrepInsertDir prepares a statement for the addition of a single directory
func PrepInsertFile ¶
PrepInsertFile prepares a statement for the addition of a single file
func PrintBanner ¶
func PrintBanner()
PrintBanner prints a pre-generated ascii banner with the program name
func PrintLicense ¶
PrintLicense prints a short license text
func ReturnSupportedHashes ¶
func ReturnSupportedHashes() [5]string
ReturnSupportedHashes returns a list of supported hashes
Types ¶
type DublinCore ¶
type DublinCore struct { Title string `json:"title"` Creator string `json:"creator"` Contributor string `json:"contributor"` Publisher string `json:"publisher"` Subject string `json:"subject"` Description string `json:"description"` Date string `json:"date"` Language string `json:"language"` Type string `json:"type"` Format string `json:"format"` Identifier string `json:"identifier"` Source string `json:"source"` Relation string `json:"relation"` Rights string `json:"rights"` Coverage string `json:"coverage"` }
DublinCore is a struct that holds 15 core elements of DC https://datatracker.ietf.org/doc/html/rfc5013
func ReadDC ¶
func ReadDC(dcjson string) (DublinCore, error)
ReadDC reads a json file and unmarshals it into the DublinCore struct
type ExifParsed ¶
type ExifParsed struct { ExifVersion string DateTime string DateTimeOrig string Artist string Copyright string Make string Software string XPTitle string XPComment string XPAuthor string XPKeywords string XPSubject string }
func ExifDecode ¶
func ExifDecode(fileName string) (ExifParsed, error)
type FileMD ¶
type FileMD struct { Filename string Filesize int64 Filemd5 string Filesha1 string Filesha256 string Filesha512 string Fileblake2b string Filesffmt string Filesfmime string Filesfformatname string Filesfformatversion string Filesfidentnote string Filesfidentproof string Filesfregistry string Filectime string Filemtime string Fileatime string Filensrl string Fileentropy float64 }
FileMD holds the metadata for each inspected file and that is written to the table files
type FileTime ¶
FileTime holds all metadata times of a file
func GetFileTimes ¶
GetFileTimes returns a type that holds the access, change and birth time of a file if available.
type HashSumsFile ¶
HashSumsFile contains all hashes for a single file
type ResumeInfo ¶
type ResumeInfo struct { Rowid int LastFile string Mountpoint string ProcessedFiles int NSRLFiles int }
ResumeInfo holds information from the database needed for resuming a session
func ResumeLatestEntry ¶
func ResumeLatestEntry(db *sql.DB, sessionuuid string) (ResumeInfo, error)
ResumeLatestEntry gets the rowid and filepath of the latest entry of a session.
type SessionMD ¶
type SessionMD struct { UUID string Starttime string Endtime string Project string Archivistname string Mountpoint string ExifFlag string Dublincoreflag string }
SessionMD holds the metadata written to table sessionsmd
type SiegfriedType ¶
type SiegfriedType struct { FileName string SizeInByte int64 Registry string FMT string FormatName string FormatVersion string MIMEType string IdentificationNote string IdentificationProof string SiegOutput string }
SiegfriedType is a struct for all the strings siegfried returns
func SiegfriedIdent ¶
func SiegfriedIdent(s *siegfried.Siegfried, inFile string) (SiegfriedType, error)
SiegfiredIdent gets PRONOM metadata and the size of a single file