home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Mendoza / flux7.txt < prev    next >
Text File  |  2000-05-25  |  14KB  |  395 lines

  1. Welcome to Flu[X] Cracking tutor #7
  2. In this One ill show you how to make another keygen
  3.  
  4. LEVEL: Simple/Intermediate
  5.  
  6. Tools Needed
  7. -SoftICE
  8. -Brains
  9. -W32Dasm [OPTIONAL]
  10. -DLL Demon v1.0    (http://members.aol.com/progency)
  11.  
  12. OK lets begin. Download the app and install it.
  13. Under the help button there is a button that says register.
  14. Click this and bring the window up...
  15.  
  16. We notice it asks for a Name and a Key and it also generates a
  17. unique Serial# for each user.. 
  18.  
  19. OK Lets begin our trace... Enter Softice and set the Breakpoint
  20. on hmemcpy. Enter in our names and Fake Serial and hit enter.
  21. Softice Should Break.. hit F5 once then we can begin our
  22. trace.. F12 until you get into The process of DLL Demon.
  23. Soon you will come accross this code:
  24.  
  25.  
  26. :00461AC3 8B45F4                  mov eax, dword ptr [ebp-0C]
  27. :00461AC6 8D4DF8                  lea ecx, dword ptr [ebp-08]
  28. :00461AC9 B201                    mov dl, 01
  29. :00461ACB E8FC5B0000              call 004676CC               <-single User Keygeneration call
  30. :00461AD0 8B55F8                  mov edx, dword ptr [ebp-08]
  31. :00461AD3 58                      pop eax
  32. :00461AD4 E8B721FAFF              call 00403C90
  33. :00461AD9 745C                    je 00461B37
  34. :00461ADB 8D55FC                  lea edx, dword ptr [ebp-04]
  35. :00461ADE 8B83F8010000            mov eax, dword ptr [ebx+000001F8]
  36. :00461AE4 E84BEBFBFF              call 00420634
  37. :00461AE9 8B45FC                  mov eax, dword ptr [ebp-04]
  38. :00461AEC 50                      push eax
  39. :00461AED 8D55F4                  lea edx, dword ptr [ebp-0C]
  40. :00461AF0 8B83F4010000            mov eax, dword ptr [ebx+000001F4]
  41. :00461AF6 E839EBFBFF              call 00420634
  42. :00461AFB 8B45F4                  mov eax, dword ptr [ebp-0C]
  43. :00461AFE 8D4DF8                  lea ecx, dword ptr [ebp-08]
  44. :00461B01 33D2                    xor edx, edx
  45. :00461B03 E8C45B0000              call 004676CC               <-Site License Keygen call
  46. :00461B08 8B55F8                  mov edx, dword ptr [ebp-08]
  47.  
  48.  
  49. OK, we notice both calls call the same address.. meaning it
  50. uses that area more than once.
  51.  
  52. Lets trace into the first call..
  53.  
  54.  
  55.   Making a Single USER Key
  56.   ========================
  57.  
  58. Ok soon we come accross this code...
  59.  
  60.  
  61.  
  62. :004676CC 55                      push ebp
  63. :004676CD 8BEC                    mov ebp, esp
  64. :004676CF 83C4BC                  add esp, FFFFFFBC
  65. :004676D2 53                      push ebx
  66. :004676D3 894DF4                  mov dword ptr [ebp-0C], ecx
  67. :004676D6 8855FB                  mov byte ptr [ebp-05], dl
  68. :004676D9 8945FC                  mov dword ptr [ebp-04], eax
  69. :004676DC 8B45FC                  mov eax, dword ptr [ebp-04]
  70. :004676DF E850C6F9FF              call 00403D34
  71. :004676E4 33C0                    xor eax, eax
  72. :004676E6 55                      push ebp
  73. :004676E7 6813784600              push 00467813
  74. :004676EC 64FF30                  push dword ptr fs:[eax]
  75. :004676EF 648920                  mov dword ptr fs:[eax], esp
  76. :004676F2 33DB                    xor ebx, ebx
  77. :004676F4 8B45FC                  mov eax, dword ptr [ebp-04]
  78. :004676F7 E884C4F9FF              call 00403B80
  79. :004676FC 85C0                    test eax, eax
  80. :004676FE 7E13                    jle 00467713
  81. :00467700 BA01000000              mov edx, 00000001
  82.  
  83.  
  84. This Area Sets the Strings Up for some part. We notice that
  85. It appends the Serial # to the end of our Name..
  86.  
  87. Example If this is your values  name:JoeBob     Serial: 122351
  88.  
  89. Then this is the String it passes in:  JoeBob122351
  90.  
  91.  
  92. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  93. |:00467711(C)
  94. |
  95. :00467705 8B4DFC                  mov ecx, dword ptr [ebp-04]
  96. :00467708 0FB64C11FF              movzx ecx, byte ptr [ecx+edx-01] <-get character
  97. :0046770D 03D9                    add ebx, ecx                     <-add ascii to EBX
  98. :0046770F 42                      inc edx                          <-increase position in string
  99. :00467710 48                      dec eax                          <-decrease counter of letters left
  100. :00467711 75F2                    jne 00467705                     <-repeat if more letters left
  101.  
  102.  
  103. The above lines of code are simple .. they add up all
  104. the ascii values of the string passed into it with EBX being
  105. used as the accumulator.
  106.  
  107.  
  108. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  109. |:004676FE(C)
  110. |
  111. :00467713 807DFB00                cmp byte ptr [ebp-05], 00       <-test if generating Sitelicense (is no this time arround)
  112. :00467717 7475                    je 0046778E
  113. :00467719 8B45F4                  mov eax, dword ptr [ebp-0C]
  114. :0046771C 50                      push eax
  115.  
  116. * Possible StringData Ref from Code Obj ->"DSU"
  117.                                   |
  118. :0046771D B828784600              mov eax, 00467828
  119. :00467722 8945BC                  mov dword ptr [ebp-44], eax <-Put "DSU" into "buffer"
  120. :00467725 C645C00B                mov [ebp-40], 0B
  121. :00467729 8BC3                    mov eax, ebx                <-move accumulated ascii into eax
  122. :0046772B B90D000000              mov ecx, 0000000D           <-move Dh (13 decimal) into ecx
  123. :00467730 99                      cdq                         <-Convert Double -> Quad
  124. :00467731 F7F9                    idiv ecx                    <-divide Eax by Ecx (13 decimal)
  125. :00467733 83C259                  add edx, 00000059           <-add 59h to remainder
  126. :00467736 8955C4                  mov dword ptr [ebp-3C], edx <-put Value of EDX into Buffer
  127. :00467739 C645C800                mov [ebp-38], 00
  128. :0046773D C645CC2D                mov [ebp-34], 2D            <-2Dh = "-" letter
  129. :00467741 C645D002                mov [ebp-30], 02
  130. :00467745 895DD4                  mov dword ptr [ebp-2C], ebx <-put Sum of ascii into Buffer 
  131. :00467748 C645D800                mov [ebp-28], 00
  132. :0046774C 8BC3                    mov eax, ebx                <-move accumulated ascii into eax
  133. :0046774E 2503000080              and eax, 80000003           <-Logical AND the ascii by 80000003h
  134. :00467753 7905                    jns 0046775A
  135. :00467755 48                      dec eax
  136. :00467756 83C8FC                  or eax, FFFFFFFC
  137. :00467759 40                      inc eax
  138.  
  139.  
  140. Ok an explanation of this code..
  141.  
  142. We first notice that ALL Single User Serials Start with the letters "DSU"
  143. Next we take a look at the maths part.
  144.  
  145. It uses the sum of all ascii as before explained.
  146. It divides the Sum of the ascii values by 13.  When you use idiv operand
  147. it puts the WHOLE number of divides into EAX and the remainder into EDX.
  148. For example...
  149.  
  150. say EAX was equal to 33 in the above code
  151.  
  152. then after the Idiv  EAX=2(whole divides)  and EDX =7 (remainder)
  153.  
  154. So what the above code does is get all your ascii values
  155. added up and divide it by 13 and take the remainder.
  156. To the remainder it adds 59 HEX  NOT DEcimal!
  157.  
  158. It also Takes your Accumulated ascii and logical AND's it
  159. with 80000003 HEX.
  160.  
  161.  
  162.  
  163.  
  164. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  165. |:00467753(C)
  166. |
  167. :0046775A 8945DC                  mov dword ptr [ebp-24], eax  <-move result of AND into buffer
  168. :0046775D C645E000                mov [ebp-20], 00
  169. :00467761 C645E42D                mov [ebp-1C], 2D             <-add another "-" to String
  170. :00467765 C645E802                mov [ebp-18], 02
  171. :00467769 8BC3                    mov eax, ebx                 <-move accumulated ascii into eax
  172. :0046776B B903000000              mov ecx, 00000003            <-mov 3 into ecx to divide by
  173. :00467770 99                      cdq
  174. :00467771 F7F9                    idiv ecx                     <-divide by 3
  175. :00467773 8945EC                  mov dword ptr [ebp-14], eax  <-move Result into string
  176. :00467776 C645F000                mov [ebp-10], 00
  177. :0046777A 8D55BC                  lea edx, dword ptr [ebp-44]
  178. :0046777D B906000000              mov ecx, 00000006
  179.  
  180.  
  181.  
  182. So we see the BASIC Alogorithm for the Single User Key is:
  183.  
  184. GIVEN
  185. =====
  186. NAME And Serial combined into 1 string
  187. X= Sum of all ascii values of NAme and Serial Combined
  188.  
  189. THEN...
  190.  
  191. Single USER Serial# =  DSU + (remainder(X/Dh)+59h) + "-" + X + X AND 80000003h + "-" + Floor(X/3)
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.     Making a SITE License Key
  199.     =========================
  200.  
  201.  
  202. Ok, trace into the second call you will ciom accross this...
  203.  
  204. This Area Sets the Strings Up for some part. We notice that
  205. It appends the Serial # to the end of our Name..
  206.  
  207. For The Site License it Simply Takes your Name and the 
  208. Serial # Does NOT Matter!
  209.  
  210.  
  211.  
  212. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  213. |:00467711(C)
  214. |
  215. :00467705 8B4DFC                  mov ecx, dword ptr [ebp-04]
  216. :00467708 0FB64C11FF              movzx ecx, byte ptr [ecx+edx-01] <-get character
  217. :0046770D 03D9                    add ebx, ecx                     <-add ascii to EBX
  218. :0046770F 42                      inc edx                          <-increase position in string
  219. :00467710 48                      dec eax                          <-decrease counter of letters left
  220. :00467711 75F2                    jne 00467705                     <-repeat if more letters left
  221.  
  222.  
  223. The above lines of code are simple .. they add up all
  224. the ascii values of the string passed into it with EBX being
  225. used as the accumulator.
  226.  
  227.  
  228. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  229. |:004676FE(C)
  230. |
  231. :00467713 807DFB00                cmp byte ptr [ebp-05], 00       <-test if generating Sitelicense (is YES this time arround)
  232. :00467717 7475                    je 0046778E                     <-This Time it is True so it Jumps to BElow Code
  233.  
  234.  
  235.  
  236.  
  237. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  238. |:00467717(C)
  239.  
  240. :0046778E 8B45F4                  mov eax, dword ptr [ebp-0C]    
  241. :00467791 50                      push eax
  242. :00467792 B84C784600              mov eax, 0046784C
  243. :00467797 8945BC                  mov dword ptr [ebp-44], eax <-Move 'DS' into Buffer
  244. :0046779A C645C00B                mov [ebp-40], 0B
  245. :0046779E 8BC3                    mov eax, ebx                <-Move added Ascii into eax
  246. :004677A0 B909000000              mov ecx, 00000009           <- Get ready to divide by 9
  247. :004677A5 99                      cdq
  248. :004677A6 F7F9                    idiv ecx                    <-Divide by 9
  249. :004677A8 83C243                  add edx, 00000043           <-Add 43h to remainder of divide
  250. :004677AB 8955C4                  mov dword ptr [ebp-3C], edx <-move remainder+43h into buffer
  251. :004677AE C645C800                mov [ebp-38], 00
  252. :004677B2 C645CC2D                mov [ebp-34], 2D            <- put a "-" in the serial
  253. :004677B6 C645D002                mov [ebp-30], 02
  254. :004677BA 895DD4                  mov dword ptr [ebp-2C], ebx <-put Sum of ascii in serial buffer
  255. :004677BD C645D800                mov [ebp-28], 00
  256. :004677C1 8BC3                    mov eax, ebx                <-move sum of ascii into EAX
  257. :004677C3 B905000000              mov ecx, 00000005           <-Get ready to divide by 5
  258. :004677C8 99                      cdq
  259. :004677C9 F7F9                    idiv ecx                    <-Divide by 5
  260. :004677CB 8955DC                  mov dword ptr [ebp-24], edx <-put Remainder int Serial buffer
  261. :004677CE C645E000                mov [ebp-20], 00
  262. :004677D2 C645E42D                mov [ebp-1C], 2D            <-Put another "-" into serial buffer
  263. :004677D6 C645E802                mov [ebp-18], 02
  264. :004677DA 85DB                    test ebx, ebx
  265. :004677DC 7903                    jns 004677E1
  266. :004677DE 83C303                  add ebx, 00000003
  267.  
  268. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  269. |:004677DC(C)
  270. |
  271. :004677E1 C1FB02                  sar ebx, 02                 <-Similar to SHR
  272. :004677E4 895DEC                  mov dword ptr [ebp-14], ebx <-Put result of SAR into Serial Buffer
  273. :004677E7 C645F000                mov [ebp-10], 00
  274. :004677EB 8D55BC                  lea edx, dword ptr [ebp-44]
  275. :004677EE B906000000              mov ecx, 00000006
  276.  
  277.  
  278.  
  279.  
  280. So we see the BASIC Alogorithm for the Site License Key is:
  281.  
  282. GIVEN
  283. =====
  284. X= Sum of all ascii values of Name
  285.  
  286. THEN...
  287.  
  288. Single USER Serial# =  "DS" + (remainder(X/9)+43h) + "-" + X + remainder(X/5) + "-" + X SHR 2
  289.  
  290.  
  291.  
  292.  
  293.  
  294. BElow is MY KEYGEN SOURCE CODE.. Yeah im a shitty PAS programmer but it works!
  295.  
  296. ===Start Code===
  297.  
  298.  
  299.  
  300.  
  301. var
  302.  name:string;
  303.  secondc:integer;
  304.  serialn:string;
  305.  eax,ecx,edx:longint;
  306.  pos:integer;
  307.  
  308. begin
  309.  
  310.  
  311.  writeln('DLL Demon v1.0 Keygen');
  312.  writeln('Flu[X]/PC98');
  313.  writeln('12/21/98');
  314.  writeln(' ');
  315.  write('Enter Name : ');
  316.  readln(name);
  317.  write('Enter Serial Number : ');
  318.  readln(serialn);
  319.  writeln('');
  320.  write('Site License Key: ');
  321.  
  322.   {Generate Site License Key}
  323.  pos:=1;
  324.  ecx:=0;
  325.  while pos <= length(name) do
  326.  begin
  327.   ecx:= ecx+ord(name[pos]);
  328.   pos:=pos+1;
  329.  end;
  330.  eax:=ecx;
  331.  edx:=0;
  332.   while ecx >=9 do
  333.   begin
  334.    ecx:=ecx-9;
  335.   end;
  336.   ecx:=ecx+$43;
  337.   write('DS',ecx,'-',eax);
  338.   ecx:=eax;
  339.   while ecx >=5 do
  340.   begin
  341.    ecx:=ecx-5;
  342.   end;
  343.   write(ecx,'-');
  344.   ecx:=eax;
  345.   ecx:=ecx SHR 2;
  346.   writeln(ecx);
  347.   write('Single User Key : ');
  348.  
  349.  
  350.   {Single User Generation}
  351.   name:=name+serialn;
  352.   pos:=1;
  353.   ecx:=0;
  354.   while pos <= length(name) do
  355.   begin
  356.    ecx:= ecx+ord(name[pos]);
  357.    pos:=pos+1;
  358.   end;
  359.   eax:=ecx;
  360.   while ecx >=13 do
  361.   begin
  362.    ecx:=ecx-13;
  363.   end;
  364.   ecx:=ecx+$59;
  365.   write('DSU',ecx,'-',eax);
  366.   ecx:=eax;
  367.   ecx:= ecx AND $80000003;
  368.   write(ecx,'-');
  369.   ecx:=eax;
  370.   edx:=0;
  371.   while ecx >=3 do
  372.   begin
  373.    ecx:=ecx-3;
  374.    edx:=edx+1;
  375.   end;
  376.   writeln(edx);
  377.  
  378. end.
  379.  
  380.  
  381. ===END CODE===
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388. I hope to see you again in Flu[X] tutor #8
  389. As always if you like a program buy it!  Thi essay is for
  390. educational purposes ONLY! Software authors deserve your support!
  391.  
  392. Flu[X]/PC98
  393. http://tuts98.cjb.net
  394. pcflux@hotmail.com
  395.