formatutils

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedFormats = Formatter{
	consts.FormatExecutable: {
		Extension: ".exe", Desc: "executable format", Converter: func(data []byte) []byte { return data },
	},
	consts.FormatRaw: {
		Extension: ".bin", Desc: "raw binary format", Converter: func(data []byte) []byte { return data },
	},
	consts.FormatC: {
		Extension: ".c", Desc: "C language format", Converter: toC,
	},
	consts.FormatCSharp: {
		Extension: ".cs", Desc: "C# language format", Converter: toCSharp,
	},
	consts.FormatJava: {
		Extension: ".java", Desc: "Java language format", Converter: toJava,
	},
	consts.FormatGolang: {
		Extension: ".go", Desc: "Go language format", Converter: toGo,
	},
	consts.FormatPython: {
		Extension: ".py", Desc: "Python language format", Converter: toPython,
	},
	consts.FormatPerl: {
		Extension: ".pl", Desc: "Perl language format", Converter: toPerl,
	},
	consts.FormatRuby: {
		Extension: ".rb", Desc: "Ruby language format", Converter: toRuby,
	},
	consts.FormatBash: {
		Extension: ".sh", Desc: "Bash script format", Converter: toBash,
	},
	consts.FormatPowerShell: {
		Extension: ".ps1", Desc: "PowerShell script format", Converter: toPowerShell,
	},
	consts.FormatHexOneLine: {
		Extension: ".hex", Desc: "hexadecimal oneline format", Converter: toHexOneLine,
	},
	consts.FormatHexMultiLine: {
		Extension: ".hex", Desc: "hexadecimal multiline format", Converter: toHexMultiLine,
	},
	consts.FormatNum: {
		Extension: ".txt", Desc: "numeric format", Converter: toNum,
	},
	consts.FormatDword: {
		Extension: ".txt", Desc: "dword format", Converter: toDword,
	},
	consts.FormatJavaScriptBE: {
		Extension: ".js", Desc: "JavaScript big-endian format", Converter: func(data []byte) []byte { return toJavaScript(data, true) },
	},
	consts.FormatJavaScriptLE: {
		Extension: ".js", Desc: "JavaScript little-endian format", Converter: func(data []byte) []byte { return toJavaScript(data, false) },
	},
	consts.FormatVBScript: {
		Extension: ".vbs", Desc: "VBScript format", Converter: toVBScript,
	},
	consts.FormatVBApplication: {
		Extension: ".vba", Desc: "VBA application format", Converter: toVBApplication,
	},
	consts.FormatPowerShellRemote: {
		Extension: ".ps1", Desc: "Execute ShellCode By PowerShell",
		SupportRemote: true,
		Converter:     toPowershellRemote,
		Usage:         PowershellRemoteUsage,
	},
	consts.FormatCurlRemote: {
		Extension: ".bash", Desc: "Execute ELF by curl",
		SupportRemote: true,
		Converter:     toShRemote,
		Usage:         CurlRemoteUsage,
	},
	consts.FormatWgetRemote: {
		Extension: ".bash", Desc: "Execute ELF by wget",
		SupportRemote: true,
		Converter:     toShRemote,
		Usage:         WgetRemoteUsage,
	},
}

Functions

func CurlRemoteUsage

func CurlRemoteUsage(url string) string

func Decode added in v0.1.2

func Decode(encode string) (string, error)

func Encode added in v0.1.2

func Encode(s string) string

func EncodeFormat added in v0.1.2

func EncodeFormat(name, format string) string

func GetFormatsWithDescriptions added in v0.1.2

func GetFormatsWithDescriptions() map[string]string

GetFormatsWithDescriptions returns a map of format names to descriptions

func IsSupportedRemote added in v0.1.2

func IsSupportedRemote(format string) bool

func PowershellRemoteUsage

func PowershellRemoteUsage(powershellURL string) string

func WgetRemoteUsage added in v0.1.2

func WgetRemoteUsage(url string) string

Types

type FormatInfo

type FormatInfo struct {
	Extension     string
	Desc          string
	Converter     func([]byte) []byte
	SupportRemote bool
	Usage         func(string) string
}

type FormatResult

type FormatResult struct {
	Data      []byte
	Extension string
}

func Convert added in v0.1.2

func Convert(data []byte, format string) (*FormatResult, error)

type Formatter

type Formatter map[string]*FormatInfo

func (Formatter) Convert

func (formatter Formatter) Convert(data []byte, format string) (*FormatResult, error)

Convert converts raw shellcode bytes to the specified format

Jump to

Keyboard shortcuts

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