File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments