encoder

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaveSliceParser added in v0.1.1

func CaveSliceParser(filePath string, caveSlice []caveStruct)

Print and return all found codecaves as CSV file in format: filename,size,start,end

func CreateHiddenData

func CreateHiddenData(patternArrayToMatch []byte, message []byte) []byte

func DecodeMessage

func DecodeMessage(fileLocation string, maximumCodeCaveSize int, byteLengthToHash int, verbose bool)

func EncodeMessage

func EncodeMessage(inputFile string, outputFile string, inputMessage string, byteLengthToHash int, verbose bool, tryOut bool)

func ExtractBytesFromFile

func ExtractBytesFromFile(filePath string, bytesToRead int, startByte int) []byte

Read x amount of bytes starting from byte y and return bytearray

func FindCaves

func FindCaves(filePath string, minCaveSize int) []caveStruct

Look for consecutive zeros

func FindMatchingPattern

func FindMatchingPattern(filePath string, matchingBytePattern []byte, readFromByte int) (int, int, int)

findMatchingPattern scans a file for a matching pattern

It returns bytes where matching pattern starts and ends Once pattern start and end is found it stops.

To find a second matching pattern the function is run again but starts reading at the byte number of the end of the last matching pattern. Returns the index of where the pattern starts and ends and how many bytes were read

func GunzipData

func GunzipData(inputData []byte) (uncompressedData []byte, err error)

Unzip an incoming byte array

func GzipData

func GzipData(inputData []byte) (compressedData []byte, err error)

Gzip an incoming byte array

func InsertCode

func InsertCode(filePath string, hiddenMessage []byte, startByte int) []byte

Open file, load data to an array, at cave.start insert data

func Md5HashBytesReturnXBytes

func Md5HashBytesReturnXBytes(inputByteArray []byte, returnBytes int) []byte

func Md5HashBytesToString

func Md5HashBytesToString(inputByteArray []byte) string

func ReadBytesFromFile

func ReadBytesFromFile(filePath string, byteLengthToHash int) []byte

Read defined amount (length) of bytes from file

func ReverseBytes

func ReverseBytes(inputArray []byte) []byte

Reads a bytearray and returns a reversed version of it

func WriteFile

func WriteFile(filePath string, fileArray []byte)

Types

type MessageStruct

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

func FindAllMatchingPatterns

func FindAllMatchingPatterns(filePath string, matchingBytePattern []byte, maxCaveSize int) MessageStruct

findAllMatchingPatterns looks for the matching byte pattern in the file It scans for the first instance of the matching pattern, notes where it starts and ends Then continues scanning until it finds the second matching pattern and notes where that starts and ends

It then returns the bytearray inbetween the matching patterns.

Jump to

Keyboard shortcuts

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