|
1 | 1 | package com.beaudoin.jmm; |
2 | 2 |
|
3 | | -import com.beaudoin.jmm.process.NativeProcess; |
| 3 | +import com.beaudoin.jmm.misc.Cacheable; |
| 4 | +import com.beaudoin.jmm.misc.MemoryBuffer; |
| 5 | +import com.beaudoin.jmm.natives.mac.mac; |
| 6 | +import com.sun.jna.Pointer; |
| 7 | +import com.sun.jna.ptr.IntByReference; |
4 | 8 |
|
5 | 9 | import java.io.IOException; |
| 10 | +import java.util.Arrays; |
6 | 11 |
|
7 | 12 | /** |
8 | 13 | * Created by Jonathan on 12/22/2015. |
9 | 14 | */ |
10 | 15 | public final class Main { |
11 | 16 |
|
12 | | - public static void main(String[] args) throws IOException { |
13 | | - System.out.println(NativeProcess.byName("csgo_linux").id()); |
14 | | - } |
| 17 | + public static void main(String[] args) throws IOException { |
| 18 | + // System.out.println(NativeProcess.byName("clion").id()); |
| 19 | + |
| 20 | + IntByReference out = new IntByReference(); |
| 21 | + System.out.println(mac.getpid()); |
| 22 | + System.out.println(mac.task_for_pid(mac.mach_task_self(), 3122, out) == 0); |
| 23 | + int taskId = out.getValue(); |
| 24 | + |
| 25 | + |
| 26 | + IntByReference o = new IntByReference(); |
| 27 | + MemoryBuffer buffer = Cacheable.buffer(4); |
| 28 | + |
| 29 | + System.out.println(mac.vm_read(taskId, new Pointer(0x7fff53601b58L), 4, buffer, o)); |
| 30 | + System.out.println(o.getValue()); |
| 31 | + System.out.println(buffer.getInt()); |
| 32 | + System.out.println(Arrays.toString(buffer.array())); |
| 33 | + } |
15 | 34 |
|
16 | 35 | } |
0 commit comments