scan

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Copyright (c) 2025 Stefano Scafiti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverPartitions

func DiscoverPartitions(path string) ([]disk.Partition, error)

func DumpFile

func DumpFile(r io.ReaderAt, outDir string, finfo *format.FileInfo) error

func FormatDurationHMS

func FormatDurationHMS(d time.Duration) string

FormatDurationHMS formats a time.Duration into HH:MM:SS string. It handles durations that might be less than an hour or greater than 24 hours.

func GetMBRPartitions

func GetMBRPartitions(imgFile fs.File, mbr *disk.MBR) ([]disk.Partition, error)

func GetScanID

func GetScanID() string

GetScanID creates a unique file name for a scan session. The format is "scan_YYYYMMDD_HHMMSS".

func Scan

func Scan(filePath string, opts Options) error

func ScanPartition

func ScanPartition(p *disk.Partition, filePath string, opts Options) error

Types

type Options

type Options struct {
	DumpDir        string       // DumpDir is the directory where carved files will be dumped. If empty, files will not be dumped.
	ReportFile     string       // ReportFile is the path to the report file. If empty, a default name will be used.
	MaxScanSize    uint64       // MaxScanSize is the maximum number of bytes to scan. If 0, the entire partition will be scanned.
	ScanBufferSize uint64       // ScanBufferSize is the size of the buffer to use during scanning. If 0, a default size is used.
	BlockSize      uint64       // BlockSize is the size of a block to read from the disk. If 0, the default block size is used.
	MaxFileSize    uint64       // MaxFileSize is the maximum size of a carved file. If 0, no limit is applied.
	DisableLog     bool         // DisableLog disables logging to a file. If true, no log file will be created.
	FileExt        []string     // file extensions to parse, e.g. "jpg,png,txt"
	Plugins        []string     // paths to plugin .so files or directories containing plugins
	LogLevel       logger.Level // LogLevel specifies the minimum log level to write to the log file.
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL