Documentation ¶
Index ¶
- Constants
- Variables
- func AdvApi32Hooks(emu *WinEmulator)
- func ComctlHooks(emu *WinEmulator)
- func Comdlg32Hooks(emu *WinEmulator)
- func EvntprovHooks(emu *WinEmulator)
- func FileapiHooks(emu *WinEmulator)
- func GetLocale(id int) map[int]string
- func GetModuleHandle(emu *WinEmulator, in *Instruction, wide bool) uint64
- func HeapapiHooks(emu *WinEmulator)
- func HookCode(emu *WinEmulator) func(mu uc.Unicorn, addr uint64, size uint32)
- func HookInterupt(emu *WinEmulator) func(mu uc.Unicorn, intnum uint32)
- func HookInvalid(emu *WinEmulator) func(mu uc.Unicorn, access int, addr uint64, size int, value int64) bool
- func KernelbaseHooks(emu *WinEmulator)
- func LibloaderapiHooks(emu *WinEmulator)
- func MemoryApiHooks(emu *WinEmulator)
- func MmapiHooks(emu *WinEmulator)
- func NtdllHooks(emu *WinEmulator)
- func Objbase(emu *WinEmulator)
- func Ole2Hooks(emu *WinEmulator)
- func OleHooks(emu *WinEmulator)
- func Oleaut32Hooks(emu *WinEmulator)
- func OledlgHooks(emu *WinEmulator)
- func PowrProf(emu *WinEmulator)
- func ProcessthreadsapiHooks(emu *WinEmulator)
- func ShellapiHooks(emu *WinEmulator)
- func ShlobjCoreHooks(emu *WinEmulator)
- func SkipFunctionCdecl(set_return bool, ret uint64) func(emu *WinEmulator, instruction *Instruction) bool
- func SkipFunctionStdCall(set_return bool, ret uint64) func(emu *WinEmulator, instruction *Instruction) bool
- func SyncapiHooks(emu *WinEmulator)
- func Sysinfoapi(emu *WinEmulator)
- func UcrtBase32Hooks(emu *WinEmulator)
- func User32Hooks(emu *WinEmulator)
- func UtilapiHooks(emu *WinEmulator)
- func VcRuntimeHooks(emu *WinEmulator)
- func WdmHooks(emu *WinEmulator)
- func WinbaseHooks(emu *WinEmulator)
- func WinnlsHooks(emu *WinEmulator)
- func WinregHooks(emu *WinEmulator)
- func WinuserHooks(emu *WinEmulator)
- func Wow64apisetHooks(emu *WinEmulator)
- type ClientID
- type Env
- type Handle
- type Hook
- type Instruction
- func (self *Instruction) Address() string
- func (self *Instruction) Disassemble() string
- func (self *Instruction) FmtToParameters(fmts []string)
- func (i *Instruction) Log() *InstructionLog
- func (i *Instruction) MarshalJSON() ([]byte, error)
- func (self *Instruction) ParseValues()
- func (i *Instruction) String() string
- func (i *Instruction) StringHook() string
- type InstructionLog
- type MemRegions
- type ModuleList
- type ModulePair
- type OpenFileName32
- type PebLdrData32
- type PebLdrData64
- type PebLdrDataTableEntry32
- type PebLdrDataTableEntry64
- type ProcessEnvironmentBlock32
- type ProcessEnvironmentBlock64
- type Reg
- type RegKey
- type Registry
- type RtlUserProcessParameters32
- type ScheduleManager
- func (self *ScheduleManager) CurThreadId() int
- func (self *ScheduleManager) DelThread(threadId int)
- func (self *ScheduleManager) DoSchedule()
- func (self *ScheduleManager) NewThread(eip uint64, stack uint64, parameter uint64, creationFlag uint64) *Handle
- func (self *ScheduleManager) ThreadEnded(threadId int) uint64
- type ServiceTableEntry
- type StartupInfo
- type Thread
- type ThreadInformationBlock32
- type ThreadInformationBlock64
- type UnicodeString32
- type UnicodeString64
- type UserProcessParameters32
- type WinEmulator
- func (emu *WinEmulator) AddHook(lib string, fname string, hook *Hook)
- func (emu *WinEmulator) BuildInstruction(addr uint64, size uint32) *Instruction
- func (emu *WinEmulator) CaptureParameters(n int) []uint64
- func (emu *WinEmulator) GetHook(addr uint64) (string, string, *Hook)
- func (emu *WinEmulator) LoadHooks()
- func (emu *WinEmulator) OpenFile(path string, access int32) (*Handle, error)
- func (emu *WinEmulator) SetupHooks() error
- func (emu *WinEmulator) Start() error
- type WinEmulatorOptions
- type WinOptions
Constants ¶
const ( GENERIC_ALL = 0x10000000 GENERIC_EXECUTE = 0x20000000 GENERIC_WRITE = 0x40000000 GENERIC_READ = 0x80000000 CREATE_NEW = 0x1 CREATE_ALWAYS = 0x2 CREATE_SUSPENDED = 0x4 // ERROR_SUCCESS = 0x0 ERROR_FILE_NOT_FOUND = 0x2 ERROR_INVALID_HANDLE = 0x6 ERROR_MORE_DATA = 0xea ERROR_NO_MORE_ITEMS = 0x103 // REG_NONE = 0x0 REG_SZ = 0x1 REG_EXPAND_SZ = 0x2 REG_BINARY = 0x3 REG_DWORD = 0x4 REG_LINK = 0x6 REG_MULTI_SZ = 0x7 REG_QWORD = 0xb // STACK_SIZE_PARAM_IS_A_RESERVATION = 0x00010000 // STATUS_SUCCESS = 0x0 STATUS_WAIT_0 = 0x0 STATUS_WAIT_1 = 0x1 STATUS_WAIT_2 = 0x2 STATUS_WAIT_3 = 0x3 STATUS_WAIT_63 = 0x3f STATUS_ABANDONED = 0x80 )
const ( F_GRANULARITY = 0x8 F_PROT_32 = 0x4 F_LONG = 0x2 PRESENT = 0x80 PRIV_3 = 0x60 PRIV_2 = 0x40 PRIV_1 = 0x20 PRIV_0 = 0x0 CODE = 0x10 DATA = 0x10 TSS = 0x0 GATE = 0x00 EXEC = 0x8 DATA_WRITEABLE = 0x2 CODE_READABLE = 0x2 DIR_CON_BIT = 0x4 S_GDT = 0x0 S_PRIV_3 = 0x3 S_PRIV_2 = 0x2 S_PRIV_1 = 0x1 S_PRIV_0 = 0x0 )
const ( LogTypeStdout = iota LogTypeJSON LogTypeSlice )
defines the basic log types available in winemulator, avaialble to be set via command line flags
Variables ¶
var EN_LOCALE = map[int]string{
0x1004: "utf-8",
0x1005: "\x00",
0x1009: "1",
0x14: "$",
0x19: "2",
0x1b: "0",
0x1c: "0",
0x1d: "/",
0x1e: ":",
0x1f: "%m/%d/%y",
0x20: "%B %d, %Y",
0x23: "0",
0x25: "0",
0x28: "am",
0x29: "pm",
0x2a: "Monday",
0x2b: "Tuesday",
0x2c: "Wednesday",
0x2d: "Thursday",
0x2e: "Friday",
0x2f: "Saturday",
0x30: "Sunday",
0x31: "Mon",
0x32: "Tue",
0x33: "Wed",
0x34: "Thu",
0x35: "Fri",
0x36: "Sat",
0x37: "Sun",
0x38: "January",
0x39: "February",
0x3a: "March",
0x3b: "April",
0x3c: "May",
0x3d: "June",
0x3e: "July",
0x3f: "August",
0x40: "September",
0x41: "October",
0x42: "November",
0x43: "December",
0x44: "Jan",
0x45: "Feb",
0x46: "Mar",
0x47: "Apr",
0x48: "May",
0x49: "Jun",
0x4a: "Jul",
0x4b: "Aug",
0x4c: "Sep",
0x4d: "Oct",
0x4e: "Nov",
0x4f: "Dec",
0xc: "'",
0xe: ".",
0xf: ",",
}
Functions ¶
func AdvApi32Hooks ¶
func AdvApi32Hooks(emu *WinEmulator)
func ComctlHooks ¶
func ComctlHooks(emu *WinEmulator)
func Comdlg32Hooks ¶
func Comdlg32Hooks(emu *WinEmulator)
func EvntprovHooks ¶
func EvntprovHooks(emu *WinEmulator)
func FileapiHooks ¶
func FileapiHooks(emu *WinEmulator)
func GetModuleHandle ¶
func GetModuleHandle(emu *WinEmulator, in *Instruction, wide bool) uint64
func HeapapiHooks ¶
func HeapapiHooks(emu *WinEmulator)
func HookInterupt ¶
func HookInterupt(emu *WinEmulator) func(mu uc.Unicorn, intnum uint32)
func HookInvalid ¶
func KernelbaseHooks ¶
func KernelbaseHooks(emu *WinEmulator)
func LibloaderapiHooks ¶
func LibloaderapiHooks(emu *WinEmulator)
func MemoryApiHooks ¶
func MemoryApiHooks(emu *WinEmulator)
func MmapiHooks ¶
func MmapiHooks(emu *WinEmulator)
func NtdllHooks ¶
func NtdllHooks(emu *WinEmulator)
func Objbase ¶
func Objbase(emu *WinEmulator)
func Ole2Hooks ¶
func Ole2Hooks(emu *WinEmulator)
func OleHooks ¶
func OleHooks(emu *WinEmulator)
func Oleaut32Hooks ¶
func Oleaut32Hooks(emu *WinEmulator)
func OledlgHooks ¶
func OledlgHooks(emu *WinEmulator)
func PowrProf ¶
func PowrProf(emu *WinEmulator)
func ProcessthreadsapiHooks ¶
func ProcessthreadsapiHooks(emu *WinEmulator)
func ShellapiHooks ¶
func ShellapiHooks(emu *WinEmulator)
func ShlobjCoreHooks ¶
func ShlobjCoreHooks(emu *WinEmulator)
func SkipFunctionCdecl ¶
func SkipFunctionCdecl(set_return bool, ret uint64) func(emu *WinEmulator, instruction *Instruction) bool
SkipFunctionAdj will step over a function by adjusting the stack accordingly. The set_return and ret parameters will set the RAX/EAX values if nessesary, and the stackadj will adjust the stack properly. Stackadj is used in the appropriate calling convention.
func SkipFunctionStdCall ¶
func SkipFunctionStdCall(set_return bool, ret uint64) func(emu *WinEmulator, instruction *Instruction) bool
func SyncapiHooks ¶
func SyncapiHooks(emu *WinEmulator)
func Sysinfoapi ¶
func Sysinfoapi(emu *WinEmulator)
func UcrtBase32Hooks ¶
func UcrtBase32Hooks(emu *WinEmulator)
func User32Hooks ¶
func User32Hooks(emu *WinEmulator)
func UtilapiHooks ¶
func UtilapiHooks(emu *WinEmulator)
func VcRuntimeHooks ¶
func VcRuntimeHooks(emu *WinEmulator)
func WdmHooks ¶
func WdmHooks(emu *WinEmulator)
func WinbaseHooks ¶
func WinbaseHooks(emu *WinEmulator)
func WinnlsHooks ¶
func WinnlsHooks(emu *WinEmulator)
func WinregHooks ¶
func WinregHooks(emu *WinEmulator)
func WinuserHooks ¶
func WinuserHooks(emu *WinEmulator)
func Wow64apisetHooks ¶
func Wow64apisetHooks(emu *WinEmulator)
Types ¶
type Handle ¶
type Hook ¶
type Hook struct { Name string Parameters []string Fn func(*WinEmulator, *Instruction) bool Implemented bool Values []interface{} Return uint64 HookStatus string Lib string }
type Instruction ¶
type Instruction struct { Addr uint64 Size uint32 Args []uint64 Stack []byte Hook *Hook ThreadID int // contains filtered or unexported fields }
func (*Instruction) Address ¶
func (self *Instruction) Address() string
func (*Instruction) Disassemble ¶
func (self *Instruction) Disassemble() string
func (*Instruction) FmtToParameters ¶
func (self *Instruction) FmtToParameters(fmts []string)
FmtToParameters will take formatters and append to self.Hook.Parameters
func (*Instruction) Log ¶
func (i *Instruction) Log() *InstructionLog
Log will output a anonymous struct that represents the instruction JSON form
func (*Instruction) MarshalJSON ¶
func (i *Instruction) MarshalJSON() ([]byte, error)
func (*Instruction) ParseValues ¶
func (self *Instruction) ParseValues()
func (*Instruction) String ¶
func (i *Instruction) String() string
StringInstruction will print the instructino disassembly of the current EIP position
func (*Instruction) StringHook ¶
func (i *Instruction) StringHook() string
StringHook will print the hook string value if a hook is implemented, otherwise empty string
type InstructionLog ¶
type InstructionLog struct { Tid int `json:"tid"` Addr uint64 `json:"addr"` Size uint32 `json:"size"` Opcode string `json:"opcode"` Lib string `json:"lib,omitempty"` Fn string `json:"fn,omitempty"` Parameters []string `json:"parameters,omitempty"` Values []interface{} `json:"values,omitempty"` Return uint64 `json:"return,omitempty"` }
InstructionLog is the exported struct detailing a single instruction. Useful for programmatic access to the emulated output
type MemRegions ¶
type MemRegions struct { ProcInfoSize uint64 TibSize uint64 GdtSize uint64 StackSize uint64 HeapSize uint64 LibSize uint64 ImageSize uint64 ProcInfoAddress uint64 TibAddress uint64 GdtAddress uint64 StackAddress uint64 HeapAddress uint64 LibAddress uint64 ImageAddress uint64 PebAddress uint64 TebAddress uint64 }
type ModuleList ¶
type ModuleList []ModulePair
func CreateModuleList ¶
func CreateModuleList(keyvalue map[string]uint64) ModuleList
func (ModuleList) Len ¶
func (m ModuleList) Len() int
func (ModuleList) Populate ¶
func (m ModuleList) Populate(keyvalue map[string]uint64)
func (ModuleList) Sort ¶
func (m ModuleList) Sort()
func (ModuleList) Swap ¶
func (m ModuleList) Swap(i, j int)
type ModulePair ¶
ModulePair is used to keep track of the emulator address of a loaded module. Used to lookup a certain module in the emulator based on its address in memory.
type OpenFileName32 ¶
type OpenFileName32 struct { StructSize uint32 Owner uint32 Instance uint32 Filter uint32 CustomFilter uint32 MaxCustFilter uint32 FilterIndex uint32 File uint32 MaxFile uint32 FileTitle uint32 MaxFileTitle uint32 InitialDir uint32 Title uint32 Flags uint32 FileOffset uint16 FileExtension uint16 DefExit uint32 CustData uint32 Hook uint32 TemplateName uint32 EditInfo uint32 Prompt uint32 Reserved uint32 Reserved2 uint32 FlagsEx uint32 }
type PebLdrData32 ¶
type PebLdrData32 struct { Length uint32 Initialized uint32 //boolean SsHandle uint32 InLoadOrderModuleList [8]byte InMemoryOrderModuleList [8]byte InInitializationOrderModuleList [8]byte EntryInProgress uint32 ShutdownInProgress uint32 //boolean ShutdownThreadId uint32 }
https://www.geoffchappell.com/studies/windows/win32/ntdll/structs/peb_ldr_data.htm
type PebLdrData64 ¶
type PebLdrDataTableEntry32 ¶
type PebLdrDataTableEntry32 struct { InOrderLinks [8]byte InMemoryOrderLinks [8]byte InInitializationOrderLinks [8]byte DllBase uint32 EntryPoint uint32 SizeOfImage uint32 FullDllName UnicodeString32 BaseDllName UnicodeString32 Flags uint32 LoadCount uint16 // named ObseleteLoadCount OS6.2+ TlsIndex uint16 HashLinks [8]byte // increase by PVOID+ULONG if <OS6.2 }
https://www.geoffchappell.com/studies/windows/win32/ntdll/structs/ldr_data_table_entry.htm
type PebLdrDataTableEntry64 ¶
type PebLdrDataTableEntry64 struct { InOrderLinks [16]byte InMemoryOrderLinks [16]byte InInitializationOrderLinks [16]byte DllBase uint64 EntryPoint uint64 SizeOfImage uint64 FullDllName UnicodeString64 BaseDllName UnicodeString64 Flags uint32 LoadCount uint16 // named ObseleteLoadCount OS6.2+ TlsIndex uint16 HashLinks [16]byte // increase by PVOID+ULONG if <OS6.2 }
type ProcessEnvironmentBlock32 ¶
type ProcessEnvironmentBlock32 struct { InheritedAddressSpace byte ReadImageFileExecOptions byte BeingDebugged byte SpareBool byte Mutant uint32 ImageBaseAddress uint32 Ldr uint32 ProcessParameters uint32 SubSystemData uint32 ProcessHeap uint32 FastPebLock uint32 FastPebLockRoutine uint32 FastPebUnlockRoutine uint32 EnvironmentUpdateCount uint32 KernelCallbackTable uint32 SystemReserved [1]uint32 ExecuteOptionsSpareBits uint32 FreeList uint32 TLSExpansionCounter uint32 TLSBitmap uint32 TLSBitmapBits [2]uint32 ReadOnlyStaticServerData uint32 AnsiCodePageData uint32 OemCodePageData uint32 UnicodeCaseTableData uint32 NumberOfProcessors uint32 NtlGlobalFlag uint32 CriticalSectionTimeout uint64 HeapSegmentReserve uint32 HeapSegmentCommit uint32 HeapDeCommitTotalFreeThreshold uint32 HeapDeCommitFreeBlockThreshold uint32 NumberOfHeaps uint32 MaximumNumberOfHeaps uint32 ProcessHeaps uint32 ProcessStarterHelper uint32 GdiDCAttributeList uint32 LoaderLock uint32 OsMajorVersion int32 OsMinorVersion int32 OsBuildNumber uint16 OsCSDVersion uint16 OSPlatformID uint32 ImageSubsystem uint32 ImageSubsystemMajorVersion uint32 ImageSubsystemMinorVersion uint32 ImageProcessAffinityMask uint32 GdiHandleBuffer [34]uint32 PostProcessInitRoutine uint32 TLSExpansionBitmap uint32 TLSExpansionBitmapBits [32]uint32 SessionID uint32 AppCompatFlags uint64 AppCompatFlagsUser uint64 ShimData uint32 AppCompatInfo uint32 CSDVersion uint64 ActivationContextData uint32 ProcessAssemblyStorageMap uint32 SystemDefaultActivationContextData uint32 SystemAssemblyStorageMap uint32 MinimumStackCommit uint32 FlsCallback uint32 FlsListHead uint64 FlsBitmap uint32 FlsBitmapBits [4]uint32 FlsHighIndex uint32 WerRegistrationData uint32 WerShipAssertPtr uint32 TppWorkerListLock uint32 TppWorkerpList uint64 WaitOnAddressHashTable [0x80]uint32 TelemetryCoverageHeader uint32 CloudFileFlags uint32 // contains filtered or unexported fields }
type ProcessEnvironmentBlock64 ¶
type ProcessEnvironmentBlock64 struct { InheritedAddressSpace byte ReadImageFileExecOptions byte BeingDebugged byte SpareBool byte Mutant uint64 ImageBaseAddress uint64 Ldr uint64 ProcessParameters uint64 SubSystemData uint64 ProcessHeap uint64 FastPebLock uint64 FastPebLockRoutine uint64 FastPebUnlockRoutine uint64 EnvironmentUpdateCount uint32 KernelCallbackTable uint64 SystemReserved [1]uint32 ExecuteOptionsSpareBits uint32 FreeList uint64 TLSExpansionCounter uint32 TLSBitmap uint64 TLSBitmapBits [2]uint32 ReadOnlyStaticServerData uint64 AnsiCodePageData uint64 OemCodePageData uint64 UnicodeCaseTableData uint64 NumberOfProcessors uint32 NtlGlobalFlag uint32 CriticalSectionTimeout uint64 HeapSegmentReserve uint64 HeapSegmentCommit uint64 HeapDeCommitTotalFreeThreshold uint64 HeapDeCommitFreeBlockThreshold uint64 NumberOfHeaps uint32 MaximumNumberOfHeaps uint32 ProcessHeaps uint64 ProcessStarterHelper uint64 GdiDCAttributeList uint32 LoaderLock uint64 OsMajorVersion int32 OsMinorVersion int32 OsBuildNumber uint16 OsCSDVersion uint16 OSPlatformID uint32 ImageSubsystem uint32 ImageSubsystemMajorVersion uint32 ImageSubsystemMinorVersion uint32 ImageProcessAffinityMask uint32 GdiHandleBuffer [60]uint32 PostProcessInitRoutine uint64 TLSExpansionBitmap uint64 TLSExpansionBitmapBits [32]uint32 SessionID uint32 AppCompatFlags uint64 AppCompatFlagsUser uint64 ShimData uint64 AppCompatInfo uint64 CSDVersion [16]byte ActivationContextData uint64 ProcessAssemblyStorageMap uint64 SystemDefaultActivationContextData uint64 SystemAssemblyStorageMap uint64 MinimumStackCommit uint64 FlsCallback uint64 FlsListHead [16]byte FlsBitmap uint64 FlsBitmapBits [4]uint32 FlsHighIndex uint64 WerRegistrationData uint64 WerShipAssertPtr uint64 TppWorkerListLock uint64 TppWorkerpList [16]byte WaitOnAddressHashTable [0x80]uint64 TelemetryCoverageHeader uint64 CloudFileFlags uint64 // contains filtered or unexported fields }
type Reg ¶
Reg is the type of each value in the registry, values can be actual values or "folders" within the registry
type Registry ¶
type Registry struct { Size int // contains filtered or unexported fields }
Registry is the primary struct representing the mock registry system
func NewRegistry ¶
NewRegistry creates a new registry hive with soje default values
func (*Registry) Enum ¶
Enum is used with MSDN's reg enum, will allow for enumerating a registry key
type RtlUserProcessParameters32 ¶
type RtlUserProcessParameters32 struct { Reserved1 [16]byte Reserved2 [10]uint32 ImagePathName UnicodeString32 CommandLine UnicodeString32 }
type ScheduleManager ¶
type ScheduleManager struct {
// contains filtered or unexported fields
}
func NewScheduleManager ¶
func NewScheduleManager(emu *WinEmulator) *ScheduleManager
func (*ScheduleManager) CurThreadId ¶
func (self *ScheduleManager) CurThreadId() int
func (*ScheduleManager) DelThread ¶
func (self *ScheduleManager) DelThread(threadId int)
func (*ScheduleManager) DoSchedule ¶
func (self *ScheduleManager) DoSchedule()
func (*ScheduleManager) ThreadEnded ¶
func (self *ScheduleManager) ThreadEnded(threadId int) uint64
type ServiceTableEntry ¶
type StartupInfo ¶
type ThreadInformationBlock32 ¶
type ThreadInformationBlock32 struct { CurentSEH uint32 //0x00 StackBaseHigh uint32 //0x04 StackLimit uint32 //0x08 SubSystemTib uint32 //0x0c FiberData uint32 //0x10 ArbitraryDataSlock uint32 //0x14 LinearAddressOfTEB uint32 //0x18 EnvPtr uint32 //0x1c ProcessId uint32 //0x20 CurrentThreadId uint32 //0x24 ActiveRPCHandle uint32 //0x28 AddressOfThreadLocalStorage uint32 //0x2c AddressOfPEB uint32 //0x30 LastErrorNumber uint32 //0x34 CountOwnedCriticalSections uint32 //0x38 AddressOfCSRClientThread uint32 //0x3c Win32ThreadInformation uint32 //0x40 CurrentLocale uint32 //0xc4 TLSSlots [64]uint32 // contains filtered or unexported fields }
NOP out large chunks of this structure (padding) until needed
type ThreadInformationBlock64 ¶
type ThreadInformationBlock64 struct { CurentSEH uint64 //0x00 StackBaseHigh uint64 //0x08 StackLimit uint64 //0x10 SubSystemTib uint64 //0x18 FiberData uint64 //0x20 ArbitraryDataSlock uint64 //0x28 LinearAddressOfTEB uint64 //0x30 EnvPtr uint64 //0x38 ProcessId uint64 //0x40 CurrentThreadId uint64 //0x48 ActiveRPCHandle uint64 //0x50 AddressOfThreadLocalStorage uint64 //0x58 AddressOfPEB uint64 //0x60 LastErrorNumber uint32 //0x68 CountOwnedCriticalSections uint32 //0x6c AddressOfCSRClientThread uint64 //0x70 Win32ThreadInformation uint64 //0x78 CurrentLocale uint32 //0x108 TLSSlots [64]uint64 // contains filtered or unexported fields }
type UnicodeString32 ¶
type UnicodeString64 ¶
type UnicodeString64 struct { Length uint16 MaximumLength uint16 Buffer uint64 // contains filtered or unexported fields }
https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/why-thunking-is-necessary padding needed to align to 8-byte boundary
type UserProcessParameters32 ¶
type WinEmulator ¶
type WinEmulator struct { UcMode int UcArch int PtrSize uint64 Uc uc.Unicorn Timestamp int64 Ticks uint64 InstructionLog []*InstructionLog Binary string Verbosity int ShowDll bool Args []string Argc uint64 Argv uint64 SearchPath []string Seed int EntryPoint uint64 NextLibAddress uint64 MemRegions *MemRegions Handles map[uint64]*Handle LoadedModules map[string]uint64 Heap *core.HeapManager Registry *Registry CPU *core.CpuManager Scheduler *ScheduleManager Fls [64]uint64 Opts WinOptions // these commands are used to keep state during single step mode LastCommand string Breakpoints map[uint64]uint64 AutoContinue bool // contains filtered or unexported fields }
WinEmulator type should be a emulator type the eventually will support the Emulator interface. This particular emulator is generic to x86 32/64 bit.
func Load ¶
func Load(path string, args []string, options *WinEmulatorOptions) (*WinEmulator, error)
Load is the entry point for loading a PE file in the emulated environment
func LoadMem ¶
func LoadMem(pe *pefile.PeFile, path string, args []string, options *WinEmulatorOptions) (*WinEmulator, error)
LoadMem will load a pefile from an already initiated object
func (*WinEmulator) AddHook ¶
func (emu *WinEmulator) AddHook(lib string, fname string, hook *Hook)
AddHook makes a new function hook available to the emulated process
func (*WinEmulator) BuildInstruction ¶
func (emu *WinEmulator) BuildInstruction(addr uint64, size uint32) *Instruction
func (*WinEmulator) CaptureParameters ¶
func (emu *WinEmulator) CaptureParameters(n int) []uint64
func (*WinEmulator) GetHook ¶
func (emu *WinEmulator) GetHook(addr uint64) (string, string, *Hook)
GetHook will get a hook from the list of available hooks, returning the dll, function name and hook object
func (*WinEmulator) LoadHooks ¶
func (emu *WinEmulator) LoadHooks()
func (*WinEmulator) OpenFile ¶
func (emu *WinEmulator) OpenFile(path string, access int32) (*Handle, error)
func (*WinEmulator) SetupHooks ¶
func (emu *WinEmulator) SetupHooks() error
func (*WinEmulator) Start ¶
func (emu *WinEmulator) Start() error
Start will begin emulation at the entry point and continue until error or until the end of execution.
type WinEmulatorOptions ¶
type WinEmulatorOptions struct { RootFolder string RunDLLMain bool ConfigPath string VerboseLevel int ShowDLL bool MaxTicks int64 LogType int }
WinEmulatorOptions will get passed into the WinEmulator
func InitWinEmulatorOptions ¶
func InitWinEmulatorOptions() *WinEmulatorOptions
InitWinEmulatorOptions will build a default option struct to pass into WinEmulator
type WinOptions ¶
type WinOptions struct { CodePageIdentifier int `yaml:"code_page_identifier"` ComputerName string `yaml:"computer_name"` CurrentLocale int `yaml:"current_locale"` DllLoadReason int `yaml:"dll_load_reason"` Env []Env `yaml:"environment"` KeyboardType int `yaml:"keyboard_type"` KeyboardSubType int `yaml:"keyboard_subtype"` KeyboardFuncKeys int `yaml:"keyboard_funckeys"` OsMajorVersion int `yaml:"os_major_version"` OsMinorVersion int `yaml:"os_minor_version"` ProcessorsCount int `yaml:"processors_count"` ProcessorType int `yaml:"processsor_type"` ProcessorLevel int `yaml:"processor_level"` ProcessorRevision int `yaml:"processor_revision"` TempRegistry map[string]string `yaml:"registry"` MockRegistry []Reg Root string `yaml:"root"` LocaleSortOrder int `yaml:"locale_sort_order"` SystemTime struct { Year int `yaml:"year"` Month int `yaml:"month"` DayOfWeek int `yaml:"day_of_week"` Day int `yaml:"day"` Hour int `yaml:"hour"` Minute int `yaml:"minute"` Second int `yaml:"second"` Millisecond int `yaml:"millisecond"` } `yaml:"system_time"` User string `yaml:"user"` }
WinOptions struct contains all the yaml definitions for various supported configuration settings. These can be passed to emulation via the `-c` flag. If this yaml is passed in, it will be parsed and override ALL the default settings
Source Files ¶
- advapi32.go
- comctl.go
- comdlg32.go
- constants.go
- evntprov.go
- fileapi.go
- handles.go
- heapapi.go
- hooks.go
- kernel32.go
- libloaderapi.go
- loader.go
- memoryapi.go
- mmapi.go
- ntdll.go
- objbase.go
- ole.go
- ole2.go
- oleaut32.go
- oledlg.go
- powrprof.go
- processthreadsapi.go
- registry.go
- scheduler.go
- shellapi.go
- shlobjcore.go
- synchapi.go
- sysinfoapi.go
- ucrtbase.go
- user32.go
- utilapi.go
- vcruntime.go
- wdm.go
- winbase.go
- winemulator.go
- winnls.go
- winreg.go
- winuser.go
- wow64apiset.go