Skip to content

Commit 4742258

Browse files
committed
lession
1 parent 9aa7b49 commit 4742258

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Tool/Unidbg/A02/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,23 @@ Unidbg提供了`两种`方法打Patch,简单的需求可以调用Unicorn对虚
121121
});
122122
}
123123
```
124-
124+
125+
```java
126+
public void hookonegetstring() {
127+
emulator.attach().addBreakPoint(module.base + 0x51e51, new BreakPointCallback() {
128+
@Override
129+
public boolean onHit(Emulator<?> emulator, long address) {
130+
String input = "d7b7d042-d4f2-4012-be60-d97ff2429c17";
131+
MemoryBlock replaceBlock = emulator.getMemory().malloc(input.length(), true);
132+
replaceBlock.getPointer().write(input.getBytes(StandardCharsets.UTF_8));
133+
// 修改r0为指向新字符串的新指针
134+
emulator.getBackend().reg_write(ArmConst.UC_ARM_REG_R0, replaceBlock.getPointer().peer);
135+
emulator.getBackend().reg_write(ArmConst.UC_ARM_REG_PC, address + 3);
136+
return true;
137+
}
138+
});
139+
}
140+
```
125141

126142
### 0x02. Hook
127143

0 commit comments

Comments
 (0)