Created
August 29, 2019 10:05
-
-
Save monsterxx03/f7a06db323023886495b6ff3a90c4d95 to your computer and use it in GitHub Desktop.
This file contains 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