不知道为什么报警,是不是什么奇怪的壳?
呵呵,要上课了,晚上考试。抽空在搞。
——————————————————————————————————————————
考完试了,呵呵
关闭卡巴,重新下载分析。脱壳,去自校验。
笔记为:
手动脱壳后(脱该壳很轻松,请断点401019,然后去除断点脱壳即可)
扫描为:MASM32 / TASM32 [Overlay]
包含算法:
BASE64 table :: 0000443A :: 0040443A
CRC32 [poly] :: 00001307 :: 00401307
00401341 /$ 55 PUSH EBP
00401342 |. 8BEC MOV EBP,ESP
00401344 |. 83C4 E4 ADD ESP,-1C
00401347 |. 68 04010000 PUSH 104 ; /BufSize = 104 (260.)
0040134C |. 68 48484000 PUSH Crackme.00404848 ; |PathBuffer = Crackme.00404848
00401351 |. FF35 34484000 PUSH DWORD PTR DS:[404834] ; |hModule = 00400000 (Crackme)
00401357 |. E8 38080000 CALL <JMP.&kernel32.GetModuleFileNameA> ; \GetModuleFileNameA
0040135C |. 6A 00 PUSH 0 ; /hTemplateFile = NULL
0040135E |. 6A 20 PUSH 20 ; |Attributes = ARCHIVE
00401360 |. 6A 03 PUSH 3 ; |Mode = OPEN_EXISTING
00401362 |. 6A 00 PUSH 0 ; |pSecurity = NULL
00401364 |. 6A 01 PUSH 1 ; |ShareMode = FILE_SHARE_READ
00401366 |. 68 00000080 PUSH 80000000 ; |Access = GENERIC_READ
0040136B |. 68 48484000 PUSH Crackme.00404848 ; |FileName = "C:\Documents and Settings\Administrator\桌面\Crackme\Crackme.exe"
00401370 |. E8 07080000 CALL <JMP.&kernel32.CreateFileA> ; \CreateFileA
00401375 |. 8945 FC MOV DWORD PTR SS:[EBP-4],EAX
00401378 |. 837D FC FF CMP DWORD PTR SS:[EBP-4],-1
0040137C |. 0F84 90000000 JE Crackme.00401412
00401382 |. 6A 00 PUSH 0 ; /pFileSizeHigh = NULL
00401384 |. FF75 FC PUSH DWORD PTR SS:[EBP-4] ; |hFile
00401387 |. E8 02080000 CALL <JMP.&kernel32.GetFileSize> ; \GetFileSize
0040138C |. 8945 F8 MOV DWORD PTR SS:[EBP-8],EAX
0040138F |. FF75 F8 PUSH DWORD PTR SS:[EBP-8] ; /MemSize
00401392 |. 6A 42 PUSH 42 ; |Flags = GHND
00401394 |. E8 07080000 CALL <JMP.&kernel32.GlobalAlloc> ; \GlobalAlloc
00401399 |. 8945 F0 MOV DWORD PTR SS:[EBP-10],EAX
0040139C |. FF75 F0 PUSH DWORD PTR SS:[EBP-10] ; /hMem
0040139F |. E8 08080000 CALL <JMP.&kernel32.GlobalLock> ; \GlobalLock
004013A4 |. 8945 EC MOV DWORD PTR SS:[EBP-14],EAX
004013A7 |. 6A 00 PUSH 0 ; /pOverlapped = NULL
004013A9 |. 8D45 F4 LEA EAX,DWORD PTR SS:[EBP-C] ; |
004013AC |. 50 PUSH EAX ; |pBytesRead
004013AD |. FF75 F8 PUSH DWORD PTR SS:[EBP-8] ; |BytesToRead
004013B0 |. FF75 EC PUSH DWORD PTR SS:[EBP-14] ; |Buffer
004013B3 |. FF75 FC PUSH DWORD PTR SS:[EBP-4] ; |hFile
004013B6 |. E8 FD070000 CALL <JMP.&kernel32.ReadFile> ; \ReadFile
004013BB |. FF75 FC PUSH DWORD PTR SS:[EBP-4] ; /hObject
004013BE |. E8 B3070000 CALL <JMP.&kernel32.CloseHandle> ; \CloseHandle
004013C3 |. B9 3C000000 MOV ECX,3C
004013C8 |. 034D EC ADD ECX,DWORD PTR SS:[EBP-14] ; 文件指向第3C字节处
004013CB |. 8B09 MOV ECX,DWORD PTR DS:[ECX] ; ECX=C8
004013CD |. 83C1 4C ADD ECX,4C ; 将文件偏移3C处的双字节+4C ECX= ECX+4C=C8+4C=114
004013D0 |. 034D EC ADD ECX,DWORD PTR SS:[EBP-14] ; 锁定文件偏移114H位置
004013D3 |. 8B01 MOV EAX,DWORD PTR DS:[ECX] ; 该值为:2147B934H (怀疑为CRC32)
004013D5 |. 8945 E8 MOV DWORD PTR SS:[EBP-18],EAX
004013D8 |. A3 044A4000 MOV DWORD PTR DS:[404A04],EAX
004013DD |. C701 00000000 MOV DWORD PTR DS:[ECX],0
004013E3 |. E8 0CFFFFFF CALL Crackme.004012F4 ; CRC32
004013E8 |. 8B5D EC MOV EBX,DWORD PTR SS:[EBP-14]
004013EB |. 8B4D F8 MOV ECX,DWORD PTR SS:[EBP-8]
004013EE |. E8 27FFFFFF CALL Crackme.0040131A ; CRC32值可从EAX见到
004013F3 |. 3945 E8 CMP DWORD PTR SS:[EBP-18],EAX
004013F6 |. A3 084A4000 MOV DWORD PTR DS:[404A08],EAX
004013FB |. 74 05 JE SHORT Crackme.00401402 ; 自校验跳转[必须跳转]
004013FD |. E8 D7FEFFFF CALL Crackme.004012D9
00401402 |> FF75 EC PUSH DWORD PTR SS:[EBP-14] ; /hMem
00401405 |. E8 A8070000 CALL <JMP.&kernel32.GlobalUnlock> ; \GlobalUnlock
0040140A |. FF75 F0 PUSH DWORD PTR SS:[EBP-10] ; /hMem
0040140D |. E8 94070000 CALL <JMP.&kernel32.GlobalFree> ; \GlobalFree
00401412 |> C9 LEAVE
00401413 \. C3 RETN
那么我们就在004013F3断点,获得修改后的CRC32值,然后替换到文件偏移地址:114H处,进行瞒天过海。
断下来后,得到CRC32新值为:BDC9079C
替换即可。
先到这里,发布一下脱壳去自校验版本,这回卡巴不报警了,呵呵。方便大家一起破解该CM。
——————————————————————————————————————————
name:ssssss
sn:NOVRAI-06BA94C7-AAAAAA
名字还真不能随意起,呵呵,耽误了很久。
用VB写这样算法的注册机,真是件头痛的事情。很麻烦...
算法描述如下:
注册码第一部分,可以看做固定:NOVRAI
注册码第三部分,是查表+变形得到的:
Private Function Chabiao(name1 As String) As String
'该函数计算对用户名进行查表变形
Dim changdu As Byte
Dim Pianyi As Byte
Const Mimabiao As String = "bc2adm-qo5pr*g3sn1v&m6xz7uy@4we9lkj0tf8i"
For changdu = 1 To Len(name1)
Pianyi = Asc(Mid(name1, changdu, 1)) * 7 Mod 40 + 1
Chabiao = Chabiao & Mid(Mimabiao, Pianyi, 1)
Next changdu
End Function
Private Function Bianxing(Name2 As String) As String
'该函数计算注册码第三部分,要求计算出来的结果不能包含复杂字符;Name2为通过Chabiao变形后的用户名
Dim changdu As Byte
For changdu = 1 To Len(Name2)
Bianxing = Bianxing & Chr((Asc(Mid(Name2, changdu, 1)) - 12) Xor 32)
Next changdu
End Function
注册码第二部分:
是结合用户名与查表后用户名进行逐位异或+当前位数-1累加在一起,再与一些常数或运算、异或运算,循环左移、加减等等
关于正弦函数计算的可以忽略,因为始终乘以一个“1”,都是小数点后面很多位的值,忽略。
倒推,最后异或一个“12345678H”即可。
Private Function SecondSn(Name3 As String) As String
'该函数计算注册码第二部分,Name3为原始用户名
On Error GoTo Guoda
Dim changdu As Byte
Dim Name4 As String
'Name4 为查表变形后的结果
Dim LeiJiaHe As Double
'累加和寄存器
Name4 = Chabiao(Name3)
For changdu = 1 To Len(Name3)
LeiJiaHe = LeiJiaHe + changdu - 1 + (Asc(Mid(Name3, changdu, 1)) Xor Asc(Mid(Name4, changdu, 1))) * 8
Next changdu
LeiJiaHe = Val("&H" & (ROL(Hex(LeiJiaHe * 9), 8))) Or 1079186709
SecondSn = Guizheng(Hex(LeiJiaHe), 8)
SecondSn = Mid(SecondSn, 3, 2) & Left(SecondSn, 2) & Right(SecondSn, 2) & Mid(SecondSn, 5, 2)
LeiJiaHe = ((Val("&H" & ROL(SecondSn, 18)) Xor 1079186709) - 5462) Xor 305419896
SecondSn = Guizheng(Hex(LeiJiaHe), 8)
Exit Function
Guoda:
SecondSn = "Too Big!"
End Function
Private Function ROL(strA1 As String, Wei1 As Long) As String
'针对十六进制进行左移
Dim Xunhuan1 As Long
ROL = ToBin(strA1)
For Xunhuan1 = 1 To Wei1
ROL = Right(ROL, 31) & Left(ROL, 1)
Next Xunhuan1
ROL = ToHEX(ROL)
End Function
其中循环左移函数是我自己写的,具体涉及的细节就不交代了。思路是将8位十六进制转换为32位二进制,进行左移响应的位数,然后重新转换为16进制。
还有一些细节我没仔细看,请大家将就着用下,呵呵
找到个很好的注册码:
name: kkkkkk
sn:NOVRAI-053A84C7-KKKKKK
上传的附件: