fs

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNot3k3y = fmt.Errorf("not 3k3y image")
View Source
var ErrNotDirectory = fmt.Errorf("not a directory")

ErrNotDirectory occurs when root path for VirtualISO is not a directory

Functions

func ReadKeyFile added in v0.0.4

func ReadKeyFile(f io.Reader) ([]byte, error)

ReadKeyFile reads key file and decodes hex-encoded key.

func Test3k3yImage added in v0.0.4

func Test3k3yImage(f afero.File) ([]byte, error)

Test3k3yImage performs checks if it is 3k3y image and returns ErrNot3k3y if not. If key is not empty then image is encrypted.

Types

type EncryptedISO added in v0.0.4

type EncryptedISO struct {
	// contains filtered or unexported fields
}

EncryptedISO is a wrapper to decrypt encrypted images on-the-fly. Redump (and 3k3y dump) is not completely encrypted. It's consist from "regions" (one or more sectors). Only odd regions are encrypted. Region map placed in the beginning of the image. Write operations are blocked due to complexity of implementation. See https://www.psdevwiki.com/ps3/Bluray_disc#Encryption for details.

func NewEncryptedISO added in v0.0.4

func NewEncryptedISO(f afero.File, data1 []byte, clearRegions bool) (*EncryptedISO, error)

NewEncryptedISO wraps afero.File to EncryptedISO with provided "data1" key. "clearRegions" defines if regions header should be zeroed during reads, some software can't handle non-clear header.

func (*EncryptedISO) Read added in v0.0.4

func (e *EncryptedISO) Read(b []byte) (int, error)

func (*EncryptedISO) ReadAt added in v0.0.4

func (e *EncryptedISO) ReadAt(b []byte, off int64) (int, error)

func (*EncryptedISO) Seek added in v0.0.4

func (e *EncryptedISO) Seek(offset int64, whence int) (int64, error)

func (*EncryptedISO) Truncate added in v0.0.4

func (*EncryptedISO) Truncate(int64) error

func (*EncryptedISO) Write added in v0.0.4

func (*EncryptedISO) Write([]byte) (int, error)

func (*EncryptedISO) WriteAt added in v0.0.4

func (*EncryptedISO) WriteAt([]byte, int64) (int, error)

func (*EncryptedISO) WriteString added in v0.0.4

func (*EncryptedISO) WriteString(string) (int, error)

type FS

type FS struct {
	afero.Fs
}

func (*FS) Open

func (fsys *FS) Open(path string) (afero.File, error)

func (*FS) OpenFile

func (fsys *FS) OpenFile(path string, flags int, perm fs.FileMode) (afero.File, error)

type ISO3k3y added in v0.0.4

type ISO3k3y struct {
	// contains filtered or unexported fields
}

ISO3k3y is a simple wrapper to remove 3k3y data on-the-fly during reads. Write operations are blocked because here we don't know how to handle them correctly.

func NewISO3k3y added in v0.0.4

func NewISO3k3y(f afero.File) (*ISO3k3y, error)

NewISO3k3y wraps afero.File to ISO3k3y.

func (*ISO3k3y) Read added in v0.0.4

func (iso *ISO3k3y) Read(b []byte) (int, error)

func (*ISO3k3y) ReadAt added in v0.0.4

func (iso *ISO3k3y) ReadAt(b []byte, off int64) (int, error)

func (*ISO3k3y) Seek added in v0.0.4

func (iso *ISO3k3y) Seek(offset int64, whence int) (int64, error)

func (*ISO3k3y) Truncate added in v0.0.4

func (*ISO3k3y) Truncate(int64) error

func (*ISO3k3y) Write added in v0.0.4

func (*ISO3k3y) Write([]byte) (int, error)

func (*ISO3k3y) WriteAt added in v0.0.4

func (*ISO3k3y) WriteAt([]byte, int64) (int, error)

func (*ISO3k3y) WriteString added in v0.0.4

func (*ISO3k3y) WriteString(string) (int, error)

type VirtualISO

type VirtualISO struct {
	// contains filtered or unexported fields
}

VirtualISO is an on-the-fly generated .iso disk image. According to iso9660 spec image consists of: 1) 16 empty sectors (system area, for ps3 game mode 0 and 1 sectors set) 2) volume descriptors (1 per sector) 3) little-endian and big-endian path tables (multiple entries in one sector, table aligned to sector size) 4) directory entries (multiple in one sector) 5) files PS3 requires also Joliet extension. To support it here added: * supplementary volume descriptor (goes second) * duplicated path tables (same as for plain iso9660 but identifiers encoded with utf16-be w/o bom) after iso ones * duplicated directory entries (like for path tables) after iso ones aligned to sector size The main idea is to make binary representation of parts 1-4 in memory (named fsBuf next) and keep files on disk. So to achieve this file address space partitioned like: * 0 - fsBuf size: binary encoded parts 1-4 (kept inmemory) * fsBuf size - file1 start: file 1 (from disk) * file1 end - file2 end: file 2 (from disk) * fileN start - fileN end: file N (from disk) * lastFile end - volume end: padding area (zero bytes) from last file end to volume end To serve file we need to correctly compare address space boundaries and copy data from fsBuf or open and send file from disk. In ps3 game mode we have to parse PARAM.SFO and get TITLE_ID to create sector 1 and write full volume size to sector 0.

func NewVirtualISO

func NewVirtualISO(fs afero.Fs, root string, ps3Mode bool) (*VirtualISO, error)

NewVirtualISO creates a virtual iso object from given root optionally with some data for ps3 games. Root path must be without ..'s.

func (*VirtualISO) Close

func (viso *VirtualISO) Close() error

func (*VirtualISO) Name

func (viso *VirtualISO) Name() string

func (*VirtualISO) Read

func (viso *VirtualISO) Read(p []byte) (int, error)

func (*VirtualISO) ReadAt

func (viso *VirtualISO) ReadAt(p []byte, off int64) (int, error)

func (*VirtualISO) Readdir

func (viso *VirtualISO) Readdir(count int) ([]os.FileInfo, error)

func (*VirtualISO) Readdirnames

func (viso *VirtualISO) Readdirnames(n int) ([]string, error)

func (*VirtualISO) Seek

func (viso *VirtualISO) Seek(offset int64, whence int) (int64, error)

func (*VirtualISO) Stat

func (viso *VirtualISO) Stat() (os.FileInfo, error)

func (*VirtualISO) Sync

func (*VirtualISO) Sync() error

func (*VirtualISO) Truncate

func (*VirtualISO) Truncate(int64) error

func (*VirtualISO) Write

func (*VirtualISO) Write([]byte) (int, error)

func (*VirtualISO) WriteAt

func (*VirtualISO) WriteAt([]byte, int64) (int, error)

func (*VirtualISO) WriteString

func (*VirtualISO) WriteString(string) (int, error)

Jump to

Keyboard shortcuts

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