evasion

package
v0.0.0-...-02d0221 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HookCheck = []byte{0x4c, 0x8b, 0xd1, 0xb8} // Define hooked bytes to look for

Functions

func AutoCheck

func AutoCheck() (bool, error)

func BlockDLLs

func BlockDLLs() error

block non Microsoft-signed DLLs to inject in current process

func CheckBytes

func CheckBytes(b []byte) (uint16, error)

func CheckCpu

func CheckCpu() bool

func CheckDisk

func CheckDisk() (bool, error)

func CheckDrivers

func CheckDrivers() bool

func CheckHostname

func CheckHostname() (bool, error)

func CheckInternet

func CheckInternet() bool

func CheckMemory

func CheckMemory() (bool, error)

func CheckProcess

func CheckProcess() (bool, error)

func CheckUsername

func CheckUsername() (bool, error)

func ClassicUnhook

func ClassicUnhook(funcnames []string, dllpath string) error

This function unhooks given functions of especified dll

func CreateProcessBlockDLLs

func CreateProcessBlockDLLs(cmd string) error

launch a program (C:\Windows\System32\notepad.exe) with BlockDLLs enabled

func DetectHooks

func DetectHooks() ([]string, error)

func DumpLsass

func DumpLsass(output_file string) error

func ElevateProcessToken

func ElevateProcessToken() error

Enable SeDebugPrivilege

func EnableACG

func EnableACG() error

func FullUnhook

func FullUnhook(dlls_to_unhook []string) error

Load fresh DLL copy in memory

func GetEventLogPid

func GetEventLogPid() (int, error)

func GetFuncPtr

func GetFuncPtr(hash string, dll string, hashing_function func(str string) string) (*windows.LazyProc, string, error)

Receive a hash, the full path to DLL and the hashing function used to encode the function, then you use the pointer like GetCurrentProccess.Call()

func GetNtdllStart

func GetNtdllStart() (start uintptr, size uintptr)

func GetSysId

func GetSysId(funcname string) (uint16, error)

Return syscall from memory, if it fails it tries to get syscall from disk (using halo's gate technique)

func GetSysIdHash

func GetSysIdHash(hash string, dll string, hashing_func func(str string) string) (uint16, string, error)

retrieve syscall using hashing to use it later like Syscall(sysid, ...)

func GetSysIdHashHalos

func GetSysIdHashHalos(hash string, hashing_func func(str string) string) (uint16, string, error)

retrieve syscall using hashing and Hell's Gate + Halo's Gate technique like GetSysId() function

func IsHooked

func IsHooked(funcname string) (bool, error)

func PatchAmsi

func PatchAmsi() error

func PatchAmsi2

func PatchAmsi2() error

func PatchEtw

func PatchEtw() error

func PatchEtw2

func PatchEtw2() error

func PerunsUnhook

func PerunsUnhook() error

Get a clean copy of ntdll from a suspended process (e.g. notepad.exe) and copy it to current process

func Phant0m

func Phant0m(eventlog_pid int) error

Main function

func Sha1

func Sha1(str string) string

func Sleep

func Sleep()

func Syscall

func Syscall(callid uint16, argh ...uintptr) (errcode uint32, err error)

Types

type CLIENT_ID

type CLIENT_ID struct {
	UniqueProcess uintptr
	UniqueThread  uintptr
}

type Export

type Export struct {
	Ordinal        uint32
	Name           string
	VirtualAddress uint32
	Forward        string
}

type ExportDirectory

type ExportDirectory struct {
	ExportFlags       uint32 // reserved, must be zero
	TimeDateStamp     uint32
	MajorVersion      uint16
	MinorVersion      uint16
	NameRVA           uint32 // pointer to the name of the DLL
	OrdinalBase       uint32
	NumberOfFunctions uint32
	NumberOfNames     uint32 // also Ordinal Table Len
	AddressTableAddr  uint32 // RVA of EAT, relative to image base
	NameTableAddr     uint32 // RVA of export name pointer table, relative to image base
	OrdinalTableAddr  uint32 // address of the ordinal table, relative to iamge base

	DllName string
}

type Handle

type Handle uintptr

type IMAGE_DATA_DIRECTORY

type IMAGE_DATA_DIRECTORY struct {
	VirtualAddress uint32
	Size           uint32
}

type IMAGE_DOS_HEADER

type IMAGE_DOS_HEADER struct {
	E_magic    uint16     // Magic number
	E_cblp     uint16     // Bytes on last page of file
	E_cp       uint16     // Pages in file
	E_crlc     uint16     // Relocations
	E_cparhdr  uint16     // Size of header in paragraphs
	E_minalloc uint16     // Minimum extra paragraphs needed
	E_maxalloc uint16     // Maximum extra paragraphs needed
	E_ss       uint16     // Initial (relative) SS value
	E_sp       uint16     // Initial SP value
	E_csum     uint16     // Checksum
	E_ip       uint16     // Initial IP value
	E_cs       uint16     // Initial (relative) CS value
	E_lfarlc   uint16     // File address of relocation table
	E_ovno     uint16     // Overlay number
	E_res      [4]uint16  // Reserved words
	E_oemid    uint16     // OEM identifier (for E_oeminfo)
	E_oeminfo  uint16     // OEM information; E_oemid specific
	E_res2     [10]uint16 // Reserved words
	E_lfanew   uint16     // File address of new exe header
}

type IMAGE_FILE_HEADER

type IMAGE_FILE_HEADER struct {
	Machine              uint16
	NumberOfSections     uint16
	TimeDateStamp        uint32
	PointerToSymbolTable uint32
	NumberOfSymbols      uint32
	SizeOfOptionalHeader uint16
	Characteristics      uint16
}

type IMAGE_NT_HEADER

type IMAGE_NT_HEADER struct {
	Signature      uint32
	FileHeader     IMAGE_FILE_HEADER
	OptionalHeader IMAGE_OPTIONAL_HEADER
}

type IMAGE_OPTIONAL_HEADER

type IMAGE_OPTIONAL_HEADER struct {
	Magic                       uint16
	MajorLinkerVersion          uint8
	MinorLinkerVersion          uint8
	SizeOfCode                  uint32
	SizeOfInitializedData       uint32
	SizeOfUninitializedData     uint32
	AddressOfEntryPoint         uint32
	BaseOfCode                  uint32
	ImageBase                   uint64
	SectionAlignment            uint32
	FileAlignment               uint32
	MajorOperatingSystemVersion uint16
	MinorOperatingSystemVersion uint16
	MajorImageVersion           uint16
	MinorImageVersion           uint16
	MajorSubsystemVersion       uint16
	MinorSubsystemVersion       uint16
	Win32VersionValue           uint32
	SizeOfImage                 uint32
	SizeOfHeaders               uint32
	CheckSum                    uint32
	Subsystem                   uint16
	DllCharacteristics          uint16
	SizeOfStackReserve          uint64
	SizeOfStackCommit           uint64
	SizeOfHeapReserve           uint64
	SizeOfHeapCommit            uint64
	LoaderFlags                 uint32
	NumberOfRvaAndSizes         uint32
	DataDirectory               [16]IMAGE_DATA_DIRECTORY
}

type IMAGE_OPTIONAL_HEADER32

type IMAGE_OPTIONAL_HEADER32 struct {
	Magic                       uint16
	MajorLinkerVersion          byte
	MinorLinkerVersion          byte
	SizeOfCode                  uint32
	SizeOfInitializedData       uint32
	SizeOfUninitializedData     uint32
	AddressOfEntryPoint         uint32
	BaseOfCode                  uint32
	BaseOfData                  uint32 // Different from 64 bit header
	ImageBase                   uint64
	SectionAlignment            uint32
	FileAlignment               uint32
	MajorOperatingSystemVersion uint16
	MinorOperatingSystemVersion uint16
	MajorImageVersion           uint16
	MinorImageVersion           uint16
	MajorSubsystemVersion       uint16
	MinorSubsystemVersion       uint16
	Win32VersionValue           uint32
	SizeOfImage                 uint32
	SizeOfHeaders               uint32
	CheckSum                    uint32
	Subsystem                   uint16
	DllCharacteristics          uint16
	SizeOfStackReserve          uint64
	SizeOfStackCommit           uint64
	SizeOfHeapReserve           uint64
	SizeOfHeapCommit            uint64
	LoaderFlags                 uint32
	NumberOfRvaAndSizes         uint32
	DataDirectory               uintptr
}

type IMAGE_OPTIONAL_HEADER64

type IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER

type MayBeHookedError

type MayBeHookedError struct {
	Foundbytes []byte
}

func (MayBeHookedError) Error

func (e MayBeHookedError) Error() string

type PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY

type PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY struct {
	Flags uint32
}

type PROCESS_MITIGATION_DYNAMIC_CODE_POLICY

type PROCESS_MITIGATION_DYNAMIC_CODE_POLICY struct {
	ProhibitDynamicCode uint32
}

type PROC_THREAD_ATTRIBUTE_ENTRY

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

type PROC_THREAD_ATTRIBUTE_LIST

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

type PTHREAD_BASIC_INFORMATION

type PTHREAD_BASIC_INFORMATION struct {
	AffinityMask uintptr
	Priority     int
	BasePriority int
	// contains filtered or unexported fields
}

type ProcessInformation

type ProcessInformation struct {
	Process   Handle
	Thread    Handle
	ProcessId uint32
	ThreadId  uint32
}

type SC_SERVICE_TAG_QUERY

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

type StartupInfoEx

type StartupInfoEx struct {
	windows.StartupInfo
	AttributeList *PROC_THREAD_ATTRIBUTE_LIST
}

Jump to

Keyboard shortcuts

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