| 1 | + | // Code generated by 'go generate'; DO NOT EDIT. |
| 2 | + | |
| 3 | + | package main |
| 4 | + | |
| 5 | + | import ( |
| 6 | + | "fmt" |
| 7 | + | "unsafe" |
| 8 | + | |
| 9 | + | bananaphone "github.com/C-Sto/BananaPhone/pkg/BananaPhone" |
| 10 | + | ) |
| 11 | + | |
| 12 | + | var _ unsafe.Pointer |
| 13 | + | |
| 14 | + | var ( |
| 15 | + | bpGlobal, bperr = bananaphone.NewBananaPhone(bananaphone.AutoBananaPhoneMode) |
| 16 | + | ) |
| 17 | + | |
| 18 | + | func NtWriteVirtualMemory(hProcess uintptr, lpBaseAddress uintptr, lpBuffer *byte, nSize uintptr, lpNumberOfBytesWritten *uintptr) (err error) { |
| 19 | + | if bpGlobal == nil { |
| 20 | + | err = fmt.Errorf("BananaPhone uninitialised: %s", bperr.Error()) |
| 21 | + | return |
| 22 | + | } |
| 23 | + | |
| 24 | + | sysid, e := bpGlobal.GetSysID("NtWriteVirtualMemory") |
| 25 | + | if e != nil { |
| 26 | + | err = e |
| 27 | + | return |
| 28 | + | } |
| 29 | + | r1, _ := bananaphone.Syscall(sysid, uintptr(hProcess), uintptr(lpBaseAddress), uintptr(unsafe.Pointer(lpBuffer)), uintptr(nSize), uintptr(unsafe.Pointer(lpNumberOfBytesWritten))) |
| 30 | + | if r1 != 0 { |
| 31 | + | err = fmt.Errorf("error code: %x", r1) |
| 32 | + | } |
| 33 | + | print("SYSCALL: NtWriteVirtualMemory(", "hProcess=", hProcess, ", ", "lpBaseAddress=", lpBaseAddress, ", ", "lpBuffer=", lpBuffer, ", ", "nSize=", nSize, ", ", "lpNumberOfBytesWritten=", lpNumberOfBytesWritten, ") (", "err=", err, ")\n") |
| 34 | + | return |
| 35 | + | } |
| 36 | + | |
| 37 | + | func NtAllocateVirtualMemory(hProcess uintptr, lpAddress *uintptr, zerobits uintptr, dwSize *uint32, flAllocationType uint32, flProtect uint32) (err error) { |
| 38 | + | if bpGlobal == nil { |
| 39 | + | err = fmt.Errorf("BananaPhone uninitialised: %s", bperr.Error()) |
| 40 | + | return |
| 41 | + | } |
| 42 | + | |
| 43 | + | sysid, e := bpGlobal.GetSysID("NtAllocateVirtualMemory") |
| 44 | + | if e != nil { |
| 45 | + | err = e |
| 46 | + | return |
| 47 | + | } |
| 48 | + | r1, _ := bananaphone.Syscall(sysid, uintptr(hProcess), uintptr(unsafe.Pointer(lpAddress)), uintptr(zerobits), uintptr(unsafe.Pointer(dwSize)), uintptr(flAllocationType), uintptr(flProtect)) |
| 49 | + | if r1 != 0 { |
| 50 | + | err = fmt.Errorf("error code: %x", r1) |
| 51 | + | } |
| 52 | + | print("SYSCALL: NtAllocateVirtualMemory(", "hProcess=", hProcess, ", ", "lpAddress=", lpAddress, ", ", "zerobits=", zerobits, ", ", "dwSize=", dwSize, ", ", "flAllocationType=", flAllocationType, ", ", "flProtect=", flProtect, ") (", "err=", err, ")\n") |
| 53 | + | return |
| 54 | + | } |
| 55 | + | |
| 56 | + | func NtProtectVirtualMemory(hProcess uintptr, lpAddress *uintptr, dwSize *uintptr, flNewProtect uint32, lpflOldProtect *uint32) (err error) { |
| 57 | + | if bpGlobal == nil { |
| 58 | + | err = fmt.Errorf("BananaPhone uninitialised: %s", bperr.Error()) |
| 59 | + | return |
| 60 | + | } |
| 61 | + | |
| 62 | + | sysid, e := bpGlobal.GetSysID("NtProtectVirtualMemory") |
| 63 | + | if e != nil { |
| 64 | + | err = e |
| 65 | + | return |
| 66 | + | } |
| 67 | + | r1, _ := bananaphone.Syscall(sysid, uintptr(hProcess), uintptr(unsafe.Pointer(lpAddress)), uintptr(unsafe.Pointer(dwSize)), uintptr(flNewProtect), uintptr(unsafe.Pointer(lpflOldProtect))) |
| 68 | + | if r1 != 0 { |
| 69 | + | err = fmt.Errorf("error code: %x", r1) |
| 70 | + | } |
| 71 | + | print("SYSCALL: NtProtectVirtualMemory(", "hProcess=", hProcess, ", ", "lpAddress=", lpAddress, ", ", "dwSize=", dwSize, ", ", "flNewProtect=", flNewProtect, ", ", "lpflOldProtect=", lpflOldProtect, ") (", "err=", err, ")\n") |
| 72 | + | return |
| 73 | + | } |
| 74 | + | |
| 75 | + | func NtCreateThreadEx(hThread *uintptr, desiredaccess uintptr, objattrib uintptr, processhandle uintptr, lpstartaddr uintptr, lpparam uintptr, createsuspended uintptr, zerobits uintptr, sizeofstack uintptr, sizeofstackreserve uintptr, lpbytesbuffer uintptr) (err error) { |
| 76 | + | if bpGlobal == nil { |
| 77 | + | err = fmt.Errorf("BananaPhone uninitialised: %s", bperr.Error()) |
| 78 | + | return |
| 79 | + | } |
| 80 | + | |
| 81 | + | sysid, e := bpGlobal.GetSysID("NtCreateThreadEx") |
| 82 | + | if e != nil { |
| 83 | + | err = e |
| 84 | + | return |
| 85 | + | } |
| 86 | + | r1, _ := bananaphone.Syscall(sysid, uintptr(unsafe.Pointer(hThread)), uintptr(desiredaccess), uintptr(objattrib), uintptr(processhandle), uintptr(lpstartaddr), uintptr(lpparam), uintptr(createsuspended), uintptr(zerobits), uintptr(sizeofstack), uintptr(sizeofstackreserve), uintptr(lpbytesbuffer)) |
| 87 | + | if r1 != 0 { |
| 88 | + | err = fmt.Errorf("error code: %x", r1) |
| 89 | + | } |
| 90 | + | print("SYSCALL: NtCreateThreadEx(", "hThread=", hThread, ", ", "desiredaccess=", desiredaccess, ", ", "objattrib=", objattrib, ", ", "processhandle=", processhandle, ", ", "lpstartaddr=", lpstartaddr, ", ", "lpparam=", lpparam, ", ", "createsuspended=", createsuspended, ", ", "zerobits=", zerobits, ", ", "sizeofstack=", sizeofstack, ", ", "sizeofstackreserve=", sizeofstackreserve, ", ", "lpbytesbuffer=", lpbytesbuffer, ") (", "err=", err, ")\n") |
| 91 | + | return |
| 92 | + | } |
| 93 | + | |