zipbomb

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Deflate uint16 = 8  // DEFLATE compressed
	BZip2   uint16 = 12 // BZip2 compressed
)

Compression methods. see APPNOTE.TXT 4.4.5

View Source
const (
	IFMT   = 0xf000
	IFSOCK = 0xc000
	IFLNK  = 0xa000
	IFREG  = 0x8000
	IFBLK  = 0x6000
	IFDIR  = 0x4000
	IFCHR  = 0x2000
	IFIFO  = 0x1000
	ISUID  = 0x800
	ISGID  = 0x400
	ISVTX  = 0x200
)

Variables

This section is empty.

Functions

func CompressKernel

func CompressKernel(data []byte, method uint16, level int) ([]byte, error)

Types

type OnFileCreateHookFunc

type OnFileCreateHookFunc = func(name string)

type Options

type Options struct {
	EOCDComment string
}

type OverlapOptions added in v0.0.6

type OverlapOptions struct {
	FilenameGen      filename.Generator
	OnFileCreateHook OnFileCreateHookFunc
	Method           uint16
	CompressionLevel int // Deflate [-2,9]
	ExtraTag         uint16
}

type ZipBomb

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

func New

func New(w io.Writer, optFns ...func(o *Options)) (*ZipBomb, error)

New returns a new zip bomb.

func (*ZipBomb) AddEscapedOverlap

func (zb *ZipBomb) AddEscapedOverlap(kernelBytes []byte, numFiles int, optFns ...func(o *OverlapOptions)) error

func (*ZipBomb) AddNoOverlap

func (zb *ZipBomb) AddNoOverlap(kernelBytes []byte, numFiles int, optFns ...func(o *OverlapOptions)) error

func (*ZipBomb) AddZipSlip added in v0.0.6

func (zb *ZipBomb) AddZipSlip(kernelBytes []byte, filename string, optFns ...func(o *ZipSlipOptions)) error

func (*ZipBomb) Close

func (zb *ZipBomb) Close() error

func (*ZipBomb) IsZip64

func (zb *ZipBomb) IsZip64() bool

func (*ZipBomb) UncompressedSize

func (zb *ZipBomb) UncompressedSize() int64

type ZipSlipOptions added in v0.0.6

type ZipSlipOptions struct {
	Method           uint16
	CompressionLevel int // Deflate [-2,9]
	FileMode         fs.FileMode
}

Jump to

Keyboard shortcuts

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