home *** CD-ROM | disk | FTP | other *** search
/ KeyGen Studio 2002 / KeyGen_Studio_2002.iso / Tutorials / Code Inside / Tut7.txt < prev    next >
Encoding:
Text File  |  2001-09-21  |  17.9 KB  |  303 lines

  1. ***************************************************************************************************************************************************************************************************
  2.                    Quintessential CD V1.27
  3. ***************************************************************************************************************************************************************************************************
  4.  
  5. Author:        Quinnware
  6. Protection:    Name / Serial
  7. URL:        http://www.quinnware.com/downloads/qcd_127.exe
  8. Tools:        SoftICE 4.05
  9.  
  10.  
  11. --->    Intro...
  12.  
  13. Welcome to my next tutorial about "Quintessential CD V1.27".
  14. I'll show you now how to Sniff the Serial :)
  15.  
  16.  
  17. --->    Let's Begin...
  18.  
  19. Open the program and right click on top of the program, then select "QCD Info..." and then select the tab "Register".
  20. Fill in your Name and a Serial I've used:
  21.  
  22. Name:        CoDe_InSiDe
  23. Serial:        1234567890
  24.  
  25. As you'll notice now the button "Register Now!" isn't enabled hmm...
  26. So it will only be enabled when we enter the right Serial, let's try some breakpoints.
  27. Get into SoftICE (CTRL+D) and type "bpx GetDlgItemTextA" and press enter, then get out of SoftICE
  28. (CTRL+D) and type one more Character in the Serial box and SoftICE will popup.
  29. Ok, now type "BC *" to disable the breakpoint and press (F11) or (F12) to get to the program code.
  30. Now you'll see this:
  31.  
  32. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  33.  
  34. :00412D02 8D4C240C                lea ecx, dword ptr [esp+0C]        <--- HERE WE LAND AFTER THE BREAK !!!
  35. :00412D06 6A0A                    push 0000000A                <--- Push maximum string length to copy from the entered Serial
  36. :00412D08 51                      push ecx
  37.  
  38. * Possible Reference to Dialog: DialogID_00B3, CONTROL_ID:044D, ""
  39.                                   |
  40. :00412D09 684D040000              push 0000044D
  41. :00412D0E 56                      push esi
  42. :00412D0F FFD7                    call edi                <--- Call GetDlgItemTextA
  43. :00412D11 8D542418                lea edx, dword ptr [esp+18]        <--- Point EDX to our Name
  44. :00412D15 52                      push edx
  45. :00412D16 E815C1FFFF              call 0040EE30                <--- And here's the Algo !!!
  46. :00412D1B 83C404                  add esp, 00000004
  47. :00412D1E 8BF8                    mov edi, eax
  48. :00412D20 8D44240C                lea eax, dword ptr [esp+0C]        <--- Point EAX to our "Fake" Serial
  49. :00412D24 50                      push eax
  50. :00412D25 E846BDFFFF              call 0040EA70                <--- Here it makes our "Fake" Serial in "Unreadable Characters", i'll get to this later
  51.  
  52. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  53.  
  54. Ok, so let's get into the CALL 0040EE30 to see the Algo :)
  55. And first you'll see this:
  56.  
  57. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  58.  
  59. :0040EE30 8B542404                mov edx, dword ptr [esp+04]        <--- Move the offset for our Name in EDX
  60. :0040EE34 53                      push ebx
  61. :0040EE35 56                      push esi
  62. :0040EE36 57                      push edi
  63. :0040EE37 85D2                    test edx, edx                <--- Test if EDX is 00
  64. :0040EE39 7470                    je 0040EEAB                <--- If equal we jump to the end, else continue
  65. :0040EE3B 8BFA                    mov edi, edx                <--- Move EDX to EDI
  66. :0040EE3D 83C9FF                  or ecx, FFFFFFFF            <--- Prepare ECX for counting
  67. :0040EE40 33C0                    xor eax, eax                <--- XOR EAX which is now 00
  68. :0040EE42 F2AE                    repnz    scasb                <--- Let the count begin :)
  69. :0040EE44 F7D1                    not ecx                <--- NOT ECX (Kind of like reverse the value)
  70. :0040EE46 49                      dec ecx                <--- ECX -1 (to make the length correct)
  71. :0040EE47 83F906                  cmp ecx, 00000006            <--- CMP ECX with 00000006
  72. :0040EE4A 725F                    jb 0040EEAB                <--- If below jump to the end, else continue
  73.  
  74. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  75.  
  76. So in here it looks if the length of your entered Name is more then 5 Characters, because it checks for 00000006 if below we jump to the end and fail, if its equal or more we continue.
  77. Let's see what's next:
  78.  
  79. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  80.  
  81. :0040EE4C 8A0A                    mov cl, byte ptr [edx]        <--- Move first Char in CL
  82. :0040EE4E 33F6                    xor esi, esi                <--- XOR ESI which is now 00
  83. :0040EE50 33FF                    xor edi, edi                <--- XOR EDI which is now 00
  84. :0040EE52 B801000000              mov eax, 00000001            <--- Move 00000001 in EAX
  85. :0040EE57 84C9                    test cl, cl                <--- Test if CL is 00 (Are we at the end of our Name ?)
  86. :0040EE59 7424                    je 0040EE7F                <--- If so we jump and get to the next stuff, else we continue to make the Serial
  87.  
  88. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  89. |:0040EE7D(C)
  90. |
  91. :0040EE5B 85D2                    test edx, edx                <--- Test if EDX is 00
  92. :0040EE5D 7420                    je 0040EE7F                <--- If so we jump and get to the next stuff, else we continue to make the Serial
  93. :0040EE5F 8A0A                    mov cl, byte ptr [edx]        <--- Move first Char in CL
  94. :0040EE61 80F920                  cmp cl, 20                <--- Compare CL with 20 (Space)
  95. :0040EE64 7411                    je 0040EE77                <--- If its equal jump and take the next Char, else continue
  96. :0040EE66 0FBEC9                  movsx ecx, cl                <--- Move CL in ECX
  97. :0040EE69 8BD8                    mov ebx, eax                <--- Move EAX to EBX
  98. :0040EE6B 8D0440                  lea eax, dword ptr [eax+2*eax]    <--- Move EAX+2*EAX in EAX (in the beginning EAX is 00000001, so it will then be 1+2*1 = 3 in EAX)
  99. :0040EE6E 0FAFD9                  imul ebx, ecx                <--- Multiply ECX with EBX
  100. :0040EE71 03DE                    add ebx, esi                <--- ADD ESI in EBX
  101. :0040EE73 03FB                    add edi, ebx                <--- ADD EBX in EDI
  102. :0040EE75 03F1                    add esi, ecx                <--- ADD ECX in ESI
  103.  
  104. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  105. |:0040EE64(C)
  106. |
  107. :0040EE77 8A4A01                  mov cl, byte ptr [edx+01]        <--- Put the next Char in CL
  108. :0040EE7A 42                      inc edx                <--- EDX +1
  109. :0040EE7B 84C9                    test cl, cl                <--- Test if CL is 00 (Are we at the end of our Name ?)
  110. :0040EE7D 75DC                    jne 0040EE5B                <--- If not we repeat the loop, if equal we continue
  111.  
  112. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  113.  
  114. So this is the Algo, not very big :)
  115. Ok, it goes like this:
  116.  
  117. My Name "CoDe_InSiDe"
  118. Move first Char in CL                    <--- Which is "C" (Hex = 43)
  119. Compare CL (43) with 20 (Space)
  120. If equal, jump and take the next char, else continue
  121. Move EAX to EBX                        <--- EBX now holds 00000001
  122. Move EAX+2*EAX in EAX                    <--- In the beginning EAX holds 00000001, so now it'll have 1+2*1 = 00000003 in EAX
  123. Multiply ECX with EBX                    <--- 43 * 1 = 43
  124. ADD ESI in EBX                        <--- ESI holds 00 so nothing changes in the beginning
  125. ADD EBX in EDI                        <--- EDI now holds 00000043
  126. ADD ECX in ESI                        <--- ESI now holds 00000043
  127. Move second Char in CL                    <--- Which is "o" (Hex = 6F)
  128. Increase EDX                        <--- EDX +1
  129. Test if CL is 00                    <--- Are we at the end of our Name ?
  130. If so we continue, if not we repeat this loop
  131. And so on...
  132.  
  133. i hope you get this its not very hard :) Let's see the final part:
  134.  
  135. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  136.  
  137. * Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
  138. |:0040EE59(C), :0040EE5D(C)
  139. |
  140. :0040EE7F 33D2                    xor edx, edx                <--- XOR EDX which is now 00
  141. :0040EE81 B9FFFF0000              mov ecx, 0000FFFF            <--- Move 0000FFFF in ECX
  142. :0040EE86 F7F1                    div ecx                <--- Divide ECX
  143. :0040EE88 8BC7                    mov eax, edi                <--- Move EDI in EAX
  144. :0040EE8A BFFFFF0000              mov edi, 0000FFFF            <--- Move 0000FFFF in EDI
  145. :0040EE8F 8BCA                    mov ecx, edx                <--- Move EDX in ECX
  146. :0040EE91 99                      cdq                    <--- If the value in EAX is equal to or less then 7FFFFFFF, the value in EDX will be set to 00000000, otherwise to FFFFFFFF
  147. :0040EE92 F7FF                    idiv edi                <--- Divide EDI
  148. :0040EE94 8BC6                    mov eax, esi                <--- Move ESI in EAX
  149. :0040EE96 BEFF000000              mov esi, 000000FF            <--- Move 000000FF in ESI
  150. :0040EE9B C1E210                  shl edx, 10                <--- Shift EDX left with 10
  151. :0040EE9E 0BCA                    or ecx, edx                <--- OR EDX with ECX
  152. :0040EEA0 99                      cdq                    <--- If the value in EAX is equal to or less then 7FFFFFFF, the value in EDX will be set to 00000000, otherwise to FFFFFFFF
  153. :0040EEA1 F7FE                    idiv esi                <--- Divide ESI
  154. :0040EEA3 0BCA                    or ecx, edx                <--- OR EDX with ECX
  155. :0040EEA5 8BC1                    mov eax, ecx                <--- Move ECX in EAX
  156. :0040EEA7 5F                      pop edi
  157. :0040EEA8 5E                      pop esi
  158. :0040EEA9 5B                      pop ebx
  159. :0040EEAA C3                      ret
  160.  
  161. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  162.  
  163. This is harder to explain, hehe :)
  164. But its actually also pretty easy if you trace through it, so im not going to explain this :)
  165. But we have the Serial now so let's see what comes next when were going over this ret and return to the main code.
  166. Remember where i said "Here it makes our "Fake" Serial "Unreadable", i'll get to this later" <--- Step in the CALL 0040EA70 and you'll see this:
  167.  
  168. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  169.  
  170. :0040EA70 53                      push ebx
  171. :0040EA71 56                      push esi
  172. :0040EA72 8B74240C                mov esi, dword ptr [esp+0C]        <--- Move the offset of our "Fake" Serial in ESI
  173. :0040EA76 57                      push edi
  174. :0040EA77 85F6                    test esi, esi                <--- Test if ESI is 00
  175. :0040EA79 746B                    je 0040EAE6                <--- If so we jump to the end and fail, else continue
  176. :0040EA7B 6A08                    push 00000008
  177.  
  178. * Possible StringData Ref from Data Obj ->"ffffffff"
  179.                                   |
  180. :0040EA7D 6820014300              push 00430120
  181. :0040EA82 56                      push esi
  182. :0040EA83 E828D40100              call 0042BEB0                <--- In here it Compares "ffffffff" with our "Fake" Serial, if its the same it XORs EAX and we fail, if not we continue
  183. :0040EA88 83C40C                  add esp, 0000000C
  184. :0040EA8B 85C0                    test eax, eax                <--- Test if EAX is 00 (If your "Fake" Serial was "ffffffff")
  185. :0040EA8D 7457                    je 0040EAE6                <--- If equal we jump and we fail, else continue
  186.  
  187. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  188.  
  189. Ok, so in here it checks if we entered "ffffffff" as our Serial, if so it XORs EAX and we fail, if not we continue.
  190. Let's see what's next:
  191.  
  192. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  193.  
  194. :0040EA8F 56                      push esi
  195. :0040EA90 E89BD20100              call 0042BD30                <--- In here it makes all LETTERS (if we entered letters) lowercase and makes it 8 Characters.
  196. :0040EA95 8BFE                    mov edi, esi                <--- Move ESI in EDI
  197. :0040EA97 83C9FF                  or ecx, FFFFFFFF            <--- Prepare ECX for counting
  198. :0040EA9A 33C0                    xor eax, eax                <--- XOR EAX which is now 00
  199. :0040EA9C 83C404                  add esp, 00000004
  200. :0040EA9F F2AE                    repnz scasb                <--- Let the count begin :)
  201. :0040EAA1 F7D1                    not ecx                <--- NOT ECX (kind of reverse the value)
  202. :0040EAA3 49                      dec ecx                <--- ECX -1 (to make the length correct)
  203. :0040EAA4 85C9                    test ecx, ecx                <--- Test if ECX is 00
  204. :0040EAA6 7E40                    jle 0040EAE8                <--- If equal or lower we jump and fail, else continue
  205.  
  206. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  207.  
  208. Well, in the CALL 0042BD30 it makes the letters (if we entered them) lowercase and makes it 8 Characters, and then it checks if we indeed entered something as our Serial :)
  209. Let's see what's next:
  210.  
  211. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  212.  
  213. :0040EAA8 8BF9                    mov edi, ecx                <--- Move ECX in EDI
  214. :0040EAAA 8BD9                    mov ebx, ecx                <--- Move ECX in EBX
  215.  
  216. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  217. |:0040EAE0(C)
  218. |
  219. :0040EAAC 8D57FF                  lea edx, dword ptr [edi-01]
  220. :0040EAAF B901000000              mov ecx, 00000001            <--- Move 00000001 in ECX
  221. :0040EAB4 85D2                    test edx, edx                <--- Test if EDX is 00
  222. :0040EAB6 7E06                    jle 0040EABE                <--- if equal or lower we jump, else continue
  223.  
  224. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  225. |:0040EABC(C)
  226. |
  227. :0040EAB8 C1E104                  shl ecx, 04                <--- Shift ECX to the left with 04
  228. :0040EABB 4A                      dec edx                <--- EDX -1
  229. :0040EABC 75FA                    jne 0040EAB8                <--- if EDX is 00 we continue, else we repeat this little loop
  230.  
  231. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  232. |:0040EAB6(C)
  233. |
  234. :0040EABE 8A16                    mov dl, byte ptr [esi]        <--- Move first Char of our "Fake" Serial in DL
  235. :0040EAC0 80FA61                  cmp dl, 61                <--- Compare DL with 61 (a)
  236. :0040EAC3 7C08                    jl 0040EACD                <--- Jump if lower, else continue
  237. :0040EAC5 0FBED2                  movsx edx, dl                <--- Move DL in EDX
  238. :0040EAC8 83EA57                  sub edx, 00000057            <--- EDX -57
  239. :0040EACB EB0B                    jmp 0040EAD8                <--- Jump and skip 4 instructions
  240.  
  241. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  242. |:0040EAC3(C)
  243. |
  244. :0040EACD 80FA30                  cmp dl, 30                <--- Compare DL with 30 (0)
  245. :0040EAD0 7C0B                    jl 0040EADD                <--- Jump if lower, else continue
  246. :0040EAD2 0FBED2                  movsx edx, dl                <--- Mov DL in EDX
  247. :0040EAD5 83EA30                  sub edx, 00000030            <--- EDX -30
  248.  
  249. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  250. |:0040EACB(U)
  251. |
  252. :0040EAD8 0FAFD1                  imul edx, ecx                <--- Multiply ECX with EDX
  253. :0040EADB 03C2                    add eax, edx                <--- ADD EDX in EAX
  254.  
  255. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  256. |:0040EAD0(C)
  257. |
  258. :0040EADD 46                      inc esi                <--- ESI +1
  259. :0040EADE 4F                      dec edi                <--- EDI -1
  260. :0040EADF 4B                      dec ebx                <--- EBX -1
  261. :0040EAE0 75CA                    jne 0040EAAC                <--- Repeat the whole loop if EBX isn't 00, else continue
  262. :0040EAE2 5F                      pop edi
  263. :0040EAE3 5E                      pop esi
  264. :0040EAE4 5B                      pop ebx
  265. :0040EAE5 C3                      ret
  266.  
  267. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  268.  
  269. Ok, so what it actually does here is it puts the "Fake" Serial we entered (The Serial was cut to 8 Chars) into the Register EAX <--- That's what i meant by Unreadable Characters :)
  270. So now our "Fake" Serial is within the Register EAX, now when you get over the "ret" we return to the main code and you'll see this piece:
  271.  
  272. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  273.  
  274. :00412D2A 83C404                  add esp, 00000004
  275. :00412D2D 3BF8                    cmp edi, eax                <--- CMP EAX with EDI
  276. :00412D2F 750D                    jne 00412D3E                <--- If not equal we jump and fail, if equal we continue and get the Good Guy message
  277.  
  278. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  279.  
  280. And here it just Compares EAX (our "Fake" Serial put in the Register) with EDI (our "Real" Serial).
  281. That's it, now for my Name it was:
  282.  
  283. Name:        CoDe_InSiDe
  284. Serial:        739AB3FD
  285.  
  286. This was very easy now you can make a KeyGen if you want and if you can do that :)
  287. Mail me if you got any questions or just something to say :)
  288.  
  289. Email:    code.inside@home.nl
  290.  
  291.  
  292. --->    Greetings...
  293.  
  294. Everybody at TrickSoft        (www.TrickSoft.net)
  295. Everybody at Cracking4Newbies    (www.Cracking4Newbies.com)
  296. And You...
  297.  
  298.             Don't trust the outside, trust the InSiDe !!!
  299.  
  300.                      Cya...
  301.  
  302.                       CoDe_InSiDe
  303.