-
-
Save WolvenSpirit/e5131b77494321f3e88e0c14e3563629 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "strconv" | |
| "syscall" | |
| "unsafe" | |
| ) | |
| // #include <sys/uio.h> | |
| import "C" | |
| const SYS_PROCESS_VM_READV = 310 | |
| func main() { | |
| target := os.Args[1] | |
| pid, err := strconv.Atoi(target) | |
| if err != nil { | |
| panic(err) | |
| } | |
| local := new(C.struct_iovec) | |
| buf := make([]byte, 100) | |
| local.iov_base = unsafe.Pointer(&buf) | |
| local.iov_len = 100 | |
| remote := new(C.struct_iovec) | |
| remote.iov_base = unsafe.Pointer(uintptr(0x20000)) | |
| remote.iov_len = 100 | |
| a, b, c := syscall.Syscall6(SYS_PROCESS_VM_READV, uintptr(pid), uintptr(unsafe.Pointer(local)), 1, uintptr(unsafe.Pointer(remote)), 1, 0) | |
| fmt.Printf("%v, %v, %v\n", a, b, c) | |
| fmt.Printf("%#v, %#v\n", local, remote) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment