吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2261|回复: 11
收起左侧

[Scripts] Obsidium Olly Scripts v3

  [复制链接]
风吹屁屁凉 发表于 2025-5-12 15:22
By CodeCracker

Attached new script for Obsidium, fixed ObsidiumIAT for dlls files;
Finding OEP for dll files is different: I've break hardware on execute to Rva 1000 - that address was called from OEP; I've returned from that until I found the real OEP.
Obsidium CodeDecrypt.txt - Olly script for decrypting code section.

ObsidiumIAT_v3.txt
[Asm] 纯文本查看 复制代码
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/*
=============================================================================
 Obsidium IAT fixer by CodeExplorer
=============================================================================
 When you use this Olly script you should be at OEP
=============================================================================
*/
 
 
var addr
var pointer
var thunk
var temp
var ImportTableAddress
var ImportTableEnd
var ImportSize
var CurrentPos
var OLD_EIP
var OLD_ESP
var varEax
var varEbx
var varEcx
var varEdx
var varEsi
var varEdi
var varEsp
var varEbp
var varEip
var WhereAre
var MainModule
var CodeBase
var PossibleApi
var SearchWhat
var BufferKeep
var CurrentFailedCount
var FailedOn
var AdrsTest
var CurrentPosBak
var KernelBase
 
mov OLD_EIP,eip  // backup EIP
mov OLD_ESP,esp  // backup ESP
mov varEax,eax
mov varEbx,ebx
mov varEcx,ecx
mov varEdx,edx
mov varEsi,esi
mov varEdi,edi
mov varEsp,esp
mov varEbp,ebp
 
GMA "KERNEL32", MODULEBASE
mov KernelBase, $RESULT
 
mov CurrentFailedCount, 0
alloc 30
mov BufferKeep, $RESULT
 
GMI eip, MODULEBASE
cmp $RESULT,0
je SCRIPT_FINISHED
 
mov addr,$RESULT // 401000  // code base
mov MainModule,$RESULT
GMEMI addr, MEMORYSIZE
add addr,$RESULT
mov CodeBase, addr
 
LABEL_01:
find addr,#FF??????4000#     // call/jmp dword [...]
cmp $RESULT,0
jne FoundSomething
find addr,#FF15#     // call dword [...]
cmp $RESULT,0
jne FoundSomething
find addr,#FF25#     // jmp dword [...]
cmp $RESULT,0
jne FoundSomething
 
jmp SCRIPT_FINISHED
 
FoundSomething:
mov addr,$RESULT
 
cmp [addr+1], 15, 1  // call dword [...]
je IS_OK
 
cmp [addr+1], 25, 1  // jmp dword [...]
je IS_OK
jmp NextAddress
 
IS_OK:
mov addr,$RESULT
mov pointer,$RESULT
add pointer,2
mov pointer,[pointer]
mov thunk,[pointer]
 
GMI thunk, MODULEBASE // After this $RESULT is the address to the codebase of the module to which eip belongs
cmp $RESULT, 0
jz GetImportTable
 
NextAddress:
add addr,6
jmp LABEL_01
 
GetImportTable:
mov ImportTableAddress, pointer
BigLoop:
cmp [ImportTableAddress-8], 0, 4
jnz CheckNextOneIT
 
cmp [ImportTableAddress-4], 0, 4
jz FoundProperAddress
 
CheckNextOneIT:
sub ImportTableAddress, 4
jmp BigLoop
 
FoundProperAddress:
log ImportTableAddress
mov ImportTableEnd, ImportTableAddress
 
IAT_END_LOOP:
cmp [ImportTableEnd+4], 0, 4
jnz CheckNextIAT_END
 
cmp [ImportTableEnd+8], 0, 4
jz FoundIatEND
 
GMI [ImportTableEnd+8], MODULEBASE // After this $RESULT is the address to the codebase of the module to which eip belongs
cmp $RESULT, 0  // may be some import address after belonging to a module this means we didn't reached the end
jz CheckNextIAT_END  // if address after don't belong to a module we didn't reached the end
 
cmp $RESULT, MainModule // 400000  // if address belong to main module we reached the end
jz FoundIatEND
 
CheckNextIAT_END:
add ImportTableEnd, 4
jmp IAT_END_LOOP
 
FoundIatEND:
add ImportTableEnd, 4
log ImportTableEnd
mov ImportSize, ImportTableEnd
sub ImportSize, ImportTableAddress
log ImportSize
 
mov CurrentPos, ImportTableAddress
 
ThunkSearchLoop:
cmp [CurrentPos], 0
jz NextThunkAddress
 
GMI [CurrentPos], MODULEBASE // After this $RESULT is the address to the codebase of the module to which eip belongs
cmp $RESULT, 0  // if the thunk already belong to a module
jnz NextThunkAddress
 
//log CurrentPos
mov [BufferKeep], CurrentPos
Readstr [BufferKeep], 4
mov SearchWhat, $RESULT
buf SearchWhat
//log $RESULT
find CodeBase,$RESULT
//log $RESULT
cmp $RESULT, 0  // if no reference to that dword
jz TryResolveStrangeThunk
 
mov CurrentFailedCount, 0
call TraceAndFixApi
 
NextThunkAddress:
add CurrentPos, 4
cmp CurrentPos, ImportTableEnd
jnz ThunkSearchLoop
jmp SCRIPT_FINISHED
 
TryResolveStrangeThunk:
mov PreviousValue, CurrentPos
sub PreviousValue, 4
mov PreviousValue, [PreviousValue]
 
mov NextValue, CurrentPos
add NextValue, 4
 
cmp PreviousValue, 0
jz NextThunkAddress
GMI PreviousValue, MODULEBASE
cmp $RESULT, 0  // if the thunk don't belong to a module
jz NextThunkAddress
mov CModuleBase, $RESULT
cmp CModuleBase,KernelBase
jnz NextThunkAddress
 
// Now try to resolve next thunk:
mov CurrentPosBak, CurrentPos
add CurrentPos, 4
cmp [CurrentPos], 0
jz NextThunkAddress
 
GMI [CurrentPos], MODULEBASE // After this $RESULT is the address to the codebase of the module to which eip belongs
cmp $RESULT, 0  // if the thunk already belong to a module
jnz NextThunkAddress
 
//log CurrentPos
mov [BufferKeep], CurrentPos
Readstr [BufferKeep], 4
mov SearchWhat, $RESULT
buf SearchWhat
//log $RESULT
find CodeBase,$RESULT
//log $RESULT
cmp $RESULT, 0  // if no reference to that dword
jz NextThunkAddress
 
mov CurrentFailedCount, 0
call TraceAndFixApi
 
mov NextValue, [NextValue]
cmp NextValue, 0
jz NextThunkAddress
GMI NextValue, MODULEBASE
cmp $RESULT, 0  // if the thunk don't belong to a module
jz NextThunkAddress
cmp CModuleBase, $RESULT
jnz NextThunkAddress
 
log "We have something here!"
mov CurrentPos, CurrentPosBak
mov CurrentFailedCount, 0
call TraceAndFixApi
jmp NextThunkAddress
 
//jmp NextThunkAddress
//FailedOnThatThunk:
//inc CurrentFailedCount
//mov FailedOn,CurrentPos
//log FailedOn
 
 
TraceAndFixApi:  // input CurrentPos - resolved import will be writed at [CurrentPos]
mov eip,[CurrentPos]
OK_01:
sti  // step in
 
cmp [eip],93FF, 2         // FF93 94000000   CALL    DWORD PTR DS:[EBX+0x94]
jz FinnalyOK
 
mov temp,[eip]
and temp,0FFFFFF
cmp temp,0476FF         // FF7604  PUSH    DWORD PTR DS:[ESI+0x4]
jnz OK_01
 
OK_02:
sto  // step over
 
cmp [eip],93FF, 2         // FF93 94000000   CALL    DWORD PTR DS:[EBX+0x94]
jz FinnalyOK
 
mov temp,[eip]
and temp,0FFFFFF
cmp temp,0476FF         // FF7604  PUSH    DWORD PTR DS:[ESI+0x4]
jnz OK_02
 
OK_03:
sto  // step over
cmp [eip],93FF, 2         // FF93 94000000   CALL    DWORD PTR DS:[EBX+0x94]
jnz OK_03
 
FinnalyOK:
mov PossibleApi, [esp], 4
GMI PossibleApi, MODULEBASE
cmp $RESULT,0  // if has no module base step over
jz PossibleStepOver
cmp $RESULT,MainModule  // if module is main module step over
jz PossibleStepOver
cmp $RESULT,PossibleApi  // if a module base step over
jz PossibleStepOver
mov eax, PossibleApi ; api address is on stack - dword ptr [esp]
jmp SetApiAddress
 
PossibleStepOver:
cmp PossibleApi,0  // if dword ptr [esp] is 0
jz OK_01  // jump back to search
 
log PossibleApi
sto  // step over
mov PossibleApi,eax
 
SetApiAddress:
mov WhereAre,eip
log WhereAre
log CurrentPos
 
mov [CurrentPos],PossibleApi
//log eax
 
ret
 
SCRIPT_FINISHED:
mov eax,varEax
mov ebx,varEbx
mov ecx,varEcx
mov edx,varEdx
mov esi,varEsi
mov edi,varEdi
mov esp,varEsp
mov ebp,varEbp
 
mov eip, OLD_EIP // restore eip
mov esp, OLD_ESP  // restore ESP
msg "Script finished!"


Obsidium CodeDecrypt.txt
[Asm] 纯文本查看 复制代码
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
var OLD_EIP
var OLD_ESP
var varEax
var varEbx
var varEcx
var varEdx
var varEsi
var varEdi
var varEsp
var varEbp
var varEip
 
var addr
var CodeBase
var FoundPlace
var ReturnAddress
var SecondPlace
var FoundCount
var ValueKept
 
var oldEsp
var OldEip
mov OLD_EIP,eip  // backup EIP
mov OLD_ESP,esp  // backup ESP
mov varEax,eax
mov varEbx,ebx
mov varEcx,ecx
mov varEdx,edx
mov varEsi,esi
mov varEdi,edi
mov varEsp,esp
mov varEbp,ebp
 
 
GMI eip, MODULEBASE
cmp $RESULT,0
je SCRIPT_FINISHED
 
mov addr,$RESULT // 401000  // code base
mov MainModule,$RESULT
GMEMI addr, MEMORYSIZE
add addr,$RESULT
mov CodeBase, addr
//  6D2B44EE    68 57000000     PUSH 0x57
// 6D2B44F3    FF15 A0E32B6D   CALL NEAR DWORD PTR DS:[0x6D2BE3A0]
 
SearchLoop:
find addr,#68??0000??FF15#
cmp $RESULT,0
je SCRIPT_FINISHED
mov FoundPlace, $RESULT
//bp FoundPlace
mov addr, FoundPlace
inc addr
 
mov ValueKept, FoundPlace
add ValueKept, 07
mov ValueKept, [ValueKept]
mov ValueKept, [ValueKept]
 
GMI ValueKept, MODULEBASE
cmp $RESULT,MainModule
jz SearchLoop
cmp $RESULT,0
jnz SearchLoop
 
mov ReturnAddress, FoundPlace
add ReturnAddress, 0B
 
bphws ReturnAddress, "x"
//BPMC
//bprm ReturnAddress, 1
 
pusha
mov oldEsp, esp
mov OldEip, eip
mov eip, FoundPlace
erun
 
ReturnAddressOk:
bphwc
mov esp, oldEsp
mov eip, OldEip
popa
 
fill FoundPlace, 0B, 90 // NOP 0Bh bytes
 
find addr,#68??0000??FF15#
cmp $RESULT,0
je SCRIPT_FINISHED
mov SecondPlace, $RESULT
 
mov ValueKept, SecondPlace
add ValueKept, 07
mov ValueKept, [ValueKept]
mov ValueKept, [ValueKept]
GMI ValueKept, MODULEBASE
cmp $RESULT,MainModule
jz SearchLoop
cmp $RESULT,0
jnz SearchLoop
 
fill SecondPlace, 0B, 90 // NOP 0Bh bytes
 
mov addr, SecondPlace
inc addr
 
inc FoundCount
 
jmp SearchLoop
 
 
SCRIPT_FINISHED:
mov eax,varEax
mov ebx,varEbx
mov ecx,varEcx
mov edx,varEdx
mov esi,varEsi
mov edi,varEdi
mov esp,varEsp
mov ebp,varEbp
 
mov eip, OLD_EIP // restore eip
mov esp, OLD_ESP  // restore ESP
msg "Script finished!"

ObsidiumIAT_v3.txt

6.75 KB, 下载次数: 13, 下载积分: 吾爱币 -1 CB

Obsidium CodeDecrypt.txt

2.02 KB, 下载次数: 12, 下载积分: 吾爱币 -1 CB

免费评分

参与人数 3吾爱币 +3 热心值 +3 收起 理由
笙若 + 1 + 1 谢谢@Thanks!
唐小样儿 + 1 + 1 我很赞同!
pizazzboy + 1 + 1 热心回复!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

pizazzboy 发表于 2025-5-12 15:42
感谢大佬的精彩分享。
losungjane 发表于 2025-5-12 16:02
may5422 发表于 2025-5-13 08:13
kookook 发表于 2025-5-13 08:53
大佬的帖子一直这样充满神秘感
tf0721 发表于 2025-5-13 09:56

感谢大佬的精彩分享。
yiluoen0502 发表于 2025-5-13 12:34
感谢大佬的精彩分享,学习了
guohuanxian 发表于 2025-5-13 21:34
没有看明白,这是做什么的
bscjc 发表于 2025-5-15 09:26
代码,挺好
123LOLO 发表于 2025-5-15 10:43
感谢分享。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-5-23 18:47

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表