Advertisement
vxpz

REVERSE CODING

Sep 19th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.26 KB | None | 0 0
  1. REVERSE CODING
  2.  
  3. Index:
  4. -------
  5. 1.Introduction
  6. 2.Disclaimer
  7. 3.Hexadecimal
  8. 4.RAM and ROM
  9. 5.ASM
  10. 6.Needed programs
  11. 7.Cracking
  12. 8.Conclusion
  13. ---------------------------
  14. ---Introduction----------
  15.  
  16. Welcome to my Reverse Coding tutorial! In this paper, you will
  17. learn how to crack and modify your own software. I'll try to get
  18. into as much detail as possible, yet also dumb it down a bit, so you don't just throw bs around and expect magic to happen.
  19. ------------------------------------------------------------------------------------------------------
  20. ---Disclaimer------------
  21.  
  22. All information is purely for educational purposes only! The author
  23. cannot be held responsible for any (ab)use of this information.
  24. USE AT YOUR OWN RISK!!!
  25. ------------------------------------------------------------------------------------------------------
  26. ---Hexadecimal----------
  27.  
  28. To begin, I'm going to teach you about hexadecimal, so if you already
  29. know it, then move on. Even if you do already know it, I suggest
  30. sticking around for a refreshment of your memory.=)
  31.  
  32. Hexadecimal, or hex as it's more commonly known, is a base 16
  33. numbering system. Base 16 meaning that it consists of 16 numbers:
  34. 0-9 and A-F. Each of these numbers (A-F=10-16) have a value of 4 bits
  35. and are also called nibbles. In representing a hexadecimal number, one
  36. would write an "0x" before the actual bit set. 0x is simply a tag put
  37. before a hex number to let programmers know that it is in fact, hex.
  38. When writing hex, you will not need to use this prefix.
  39.  
  40. If you haven't already noticed, the 0x prefix looks similar to that of exponential
  41. notation. Actually this is where 0x has been derived, seeing as how
  42. hex is simply a number that has been raised to a power of 16.
  43. This means 10 in hexadecimal represents the value 16+0, or 16. So check
  44. out this example:
  45.  
  46. 0xB3 (hex)= 2*16(squared)+11*16(to the 1st power)+3*16(to the power of 0 )
  47. =2*256+11*16+3=691 (decimal)
  48.  
  49. Yeah, you could do all of that, or you could be lazy and use an automated
  50. program that does it all for you. Why do you need to know hex? Because
  51. it's used by every piece of software and hardware. How? Memory based address
  52. allocation. Here's an example:
  53.  
  54. When you clicked on your browsers icon to launch it, the click triggered a "call"
  55. (an asm function that will be discussed more in depth in later chapters.) which
  56. went back to the programs memory with the "click in it's hand." It finds the
  57. address where the code is that makes the program launch and executes it. The
  58. address is written in, you guessed it, hex. An example of an address would be
  59. something like this:
  60.  
  61. 101c5018
  62.  
  63. 5108 would be the actual specific address and 101c would be the sector
  64. of RAM were the address is located. Those are the basics of Hexadecimal
  65. You should probley read this chapter againbecause getting a firm grasp on hex
  66. is essential to cracking and moding programs.
  67. ----------------------------------------------------------------------------------------------------------
  68. ---RAM and ROM--------
  69.  
  70. In this section we are gonna learn about RAM and ROM. Many people kno about
  71. the hardware part of RAM and ROM and that's gonna be very useful to you......
  72. just not in this tutorial. =) We are about to learn about the "software" side. I use the
  73. term software loosly in that software tends to have a GUI (Graphical User Interface)
  74. and this does not. BUT, there are ways to access and modify the behavior of it that
  75. I will talk about in this chapter, as well as in the next. To start off, I'll answer some
  76. common questions:
  77.  
  78. What is RAM?
  79.  
  80. RAM (Random Access Memory) is basically memory and the process of accessing it.
  81. The term "Random Access Memory" was approprietly given to this memory unit because
  82. when executing a command, the CPU doesn't have to scroll through all the memory on
  83. your PC until it finds the right address. It "randomly" whips out the addy from it's back
  84. pocket and serves it up.This process is both quick and efficient. Learning this process
  85. will help you understand the ASM functions in the next chapter.
  86.  
  87. How does RAM work?
  88.  
  89. When a command is issued and the memory is pulled from file, it must first go through
  90. what is called a "vector". A vector is a "gateway" or a "sector" of RAM where the address
  91. of the function is stored with others of it's own kind. An example of a vector would be
  92. something like this:
  93.  
  94. 8c0000b4-8c00ffff
  95.  
  96. This means that all "addressii" (hehe) that are between those values are stored in that
  97. sector of RAM. A vector acts as a gateway in that, first, pass through a vector to get to
  98. address. Your average program probley has about 30 to 40 main vectors, sectioning
  99. off from boot until exit. Knowing the vector of an addy or a function will greatly reduce
  100. your headache when you start searching for it.
  101.  
  102. ROM. ROM is a part of memory that doesn't change. (Although we can change it.=) )
  103. Boot ROM for instance, follows the same plan of action it is called upon. ROM also has
  104. vectors, just like RAM. ROM is not that important when it comes to cracking to we will
  105. leave it alone for now.
  106.  
  107. Back to RAM. Believe it or not, but addressii (there I go again, I'm such a g33k.)
  108. actually follow certain formats or syntax's for certain functions. Take hot keys for
  109. example: In the under ground, we call them "Joker commands". By pressing a certain
  110. combonation of keys, a program will run, close, be stupid, whatever. The syntax for a
  111. Joker command is as follows:
  112.  
  113. 0d-aaaaaf
  114. 000zvvvv
  115.  
  116. Let's examine this format a little closer.
  117.  
  118. 0d= The proclemation of a specifyed format
  119.  
  120. aaaaa= The address of the function
  121.  
  122. f= The float or remainder; "Floating point number" ; decimal
  123.  
  124. 000= "NOP" No operation
  125.  
  126. z= The "Booleon" as we the C++ programmers call it. A booleon is an "IF, THEN" statement.
  127. "IF this is true, THEN do this." Value 0= equal; 1= different; 2=less than; 3=greater than.
  128.  
  129. vvvv= The combonation of hex values (The values of the keys pressed) used to execute the "CALL"
  130.  
  131. Say the "A" key had a vlaue of fffb and the "B" key has a vlaue of fffd. You would then add both
  132. values using a hex calculator and get fff9 as the sum. The output on you calculator would
  133. show 1fff8. Add the first value and the last value to find the fourth byte segment. So say
  134. we've found the address of the Joker function (usually in the boot ROM sector) commonly
  135. called the "Maple address" and we are ready to program in some hex code. Our code may
  136. look like this:
  137.  
  138. 0d7ae671
  139. 0000fff9
  140.  
  141. This means that IF the value of fff9 (A and B) is equal (0) to the address (aaaaf) of the function,
  142. THEN execute it. See? Easy isn't it? You'll need to know things like this when modding programs
  143. as a use of executing of your arbitrary code in certain parts of your program at a certain time.
  144. Joker commands are also reversable in that if you enter the same code except with a 1,2, or 3,
  145. in the z slot and by changing the button combonations. Reversable meaning terminating the
  146. function or other functions that were started. A good use for this is for firewalls and babysitting
  147. programs. Are you on a college machine and can't download stuff because of that pesky firewall?
  148. Crack it open and program in some Joker commands so you can turn it on and off at will
  149. WITHOUT the administrator's password!
  150. --------------------------------------------------------------------------------------------------------------
  151. ---ASM-----------------------
  152.  
  153. To start off with our small and to the point ASM section, I'll warn you in advance, after reading this,
  154. you'll need to go take a shower cause this is disgusting! Here we go!
  155.  
  156. To begin, I'm gonna define for you some functions that you'll be seeing alot of, and be using. Here they are:
  157.  
  158. .:Hex:. .:ASM:. .:MEANING:.
  159.  
  160. 75,0f85 jne jump if not equal
  161. 74,0f84 je jump is equal
  162. eb jmp jump directly to
  163. 90 nop no operation
  164. 77,0f87 ja jump if above
  165. 0f86 jna jump if not above
  166. 0f83 jae jump if above or equal to
  167. 0f82 jnae jump if not above or equal
  168. 0f82 jb jump if below
  169. 0f83 jnb jump is not below
  170. of86 jbe jump if below or equal
  171. 0f87 jnbe jump if not below or equal
  172. 0f8f jg jump if greater
  173. 0f8e jng jump if not greater
  174. 0f8d jge jump if greater or equal
  175. 0f8c jnge jump if not greater or equal
  176. 0f8c jl jump if less
  177. 0f8d jnl jump if not less
  178. 0f8e jle jump if less or equal
  179. 0f8f jnle jump if not less or equal
  180.  
  181. The easy thing about most of the functions in ASM are that they sound like what they mean.
  182. Jump, means of coarse, to Jump from one thing to another. Example:
  183.  
  184. "jmp 00401744" would mean to jump directly to the address 00401744 once the code
  185. hits the function.
  186.  
  187. Let's look at "CALL". Call is a function that is used to "call" a certain task, string, address, whatever.
  188. Take a look at this example:
  189.  
  190. "Call 0040ccc2" this would of coarse call the address 0040ccc2 and use it. Those are the functions
  191. you'll be using.
  192.  
  193. The reason why I'm not going into loads of detail in this chapter is because when
  194. cracking software, not an extensive amount of knowledge of ASM is needed. If you want
  195. to know more or need help with something, contact me via discord which is provided at the end of
  196. this tutorial. This chapter wasn't so bad was it? Nah, it was easy =)
  197. ------------------------------------------------------------------------------------------------------------------------
  198. ---Needed Programs----------------
  199.  
  200. The programs you will need are as follows:
  201.  
  202. WDasm 8.9 or Higher
  203. Hiew 6.1
  204. Softice for win9x v3.24
  205. SubmitWolf(demo)v4.01 (http://www.trellian.com/swolf)
  206. Programming Language (C,C++,Pascal,ASM whatever you would like) Prefably C for this tutorial!
  207. And a brain (no seriously)
  208. --------------------------------------------------------------------------------------------------------------------------
  209. ---Cracking-----------------------------
  210.  
  211.  
  212. Ok, here we go! The first thing you need to do is to open up SoftIce and then swolf32.exe which is the name given to our
  213. target program. Go to the help menu and select register. Here's where your brain will come in, start to look
  214. for how the protection is running by entering some random crap into the blank space. Don't press the OK button yet though.
  215. Instead, press CTRL-D to bring up SoftIce. What we are gonna try to do is define a breakpoint, using BPX hmemcpy.
  216. Hit CTRL-D again and it will bring you back to the program. Click OK on the box and SoftIce will again pop up. Now press F12
  217. and it will bring you to the target program code. Scroll down a few lines and find:
  218.  
  219. :004167D9 8D4C2410 lea ecx, dword ptr {esp+10}--;ecx=the random crap you typed in.
  220. :004167DD 8D94290000000 lea edx, dword ptr {esp+00000090}-;edx=name
  221. :004167E4 51 push ecx
  222. :004167E5 52 push edx
  223. :004167E6 E8B5450100 call 0042ADA0----;this is the call which calculates the serial
  224. :004167EB 83C410 add esp, 00000010--;
  225. :004167EE 85C0 test eax, eax----;and return eax=1 if true (booleon =) )
  226. :004167F0 0F8596000000 jne 0041688C----;jump to registered
  227. :004167F6 8D442408 lea eax, dword ptr {esp+08}
  228. :004167FA 8D8C2488000000 lea ecx, dword ptr {esp+00000088}
  229. :00416801 50 push eax
  230. :00416802 51 push ecx
  231. :00416803 E868470100 call 0042AF70----;this call tests our serial
  232. :00416808 83C408 add esp, 00000008---;
  233. :0041680B 85C0 test eax, eax----;for v3.XX one.
  234. :0041680D 7433 je 00416842;jump is equal
  235.  
  236. The call that we want to focas on is at 004167E6. This call tests wether our serial is for the correct version or not.
  237. Let's trace the call 004ADA0:
  238.  
  239. *Referenced by a CALL at address:
  240. :0042ABFC
  241. :0042ADA 83EC30 sub esp, 00000030
  242. :0042ADA3 55 push ebp
  243. :0042ASA4 56 push esi
  244. :004ADA5 57 push edi
  245. :0042ADA6 8B7C24444 mov edi, dword ptr {esp+44}--;edi=our fake serial
  246. :004ADAA 85FF test edi, edi
  247. :004ADAC 0F4A7010000 je 0042AF59----;die if empty
  248. :004ADB2 8B6C2440 mov ebp, dword ptr {esp+40}--ebp=our name
  249. :0042ADB6 85ED test ebp, ebp
  250. :004ADB8 0F849B010000 je 0042AF59---;die if empty
  251. :004ADBE 8A07 mov al, byte ptr {edi}--;compare 1st byte of serial with 'p', die
  252. :0042ADC0 3C50 cmp al, 50----;
  253. :0042ADC2 0F8587010000 jne 0042AF4F----;if not equal
  254. :0042ADC8 807F0134 cmp byte ptr {edi+01}, 34--:compare byte of serial with '4'
  255. :004ADCC 750C jne 0042ADDA----;
  256. :0042ADCE C70500C8430000000000 mov dword ptr {0043C800}, 00000000
  257. :0042ADD8 EB1C jmp 0042ADF6
  258.  
  259. As we can see by the above, the code tells us that the first value of our serial will
  260. be 'p' and a cycle of a four byte algorythm. I could go on and on about all of the internals
  261. of all this stuff but that would be going beyond the scope of this tutorial. The idea was to show
  262. how to crack this pro, and thats what I'm going to do. Based on the information I've given you, and the
  263. information that you can deduce from reading the code, I've written a small key generator in C.
  264. If you know C, then you'll be able to tell where i got the algorythms to write it. So here it is:
  265.  
  266. #include<stdio.h>
  267. #include<conio.h>
  268.  
  269. int main(void)
  270. {
  271. long code=555583,count1,count2;
  272. char name[25],cod[5],type='0';
  273. clrscr();
  274. textcolor(14);
  275. printf("This is a simple key-generator");
  276. printf("=================================================");
  277. text color(10);
  278. printf("SubmitWolf(demo)ver4.1 cracked by vxp");
  279. textcolor(14);
  280. printf("%c%c%c",0x10,0x10,0x10");
  281. textcolor(12);
  282. printf("Yup")
  283. prinf("-November 2002");
  284. prinf("'\n\nSelect Edition PRO(0) or Enterprise(1) (0/1)=");
  285. scanf("%c",&type);
  286. if(type=='1')code=557283;
  287. getchar();
  288. prinf("Enter Registration Name=");
  289. scanf("%[^\n]",name);
  290. for(count1=0;count1<=3;count1++
  291. cod[count1]=name[count1];
  292. for(count=1;count1=3;count1++){
  293. for(count2=0;count2<=3;count2++)
  294. cod[count2]=cod[count2]*(code%100);
  295. code=code/100;
  296. }
  297. for(count1=0;name[count1]>0;count1++);
  298. for(count2=0;count2<=3;count2++)
  299. cod[count2]=cod[count2]^(name[count1]+3);
  300. for=(count1-3;count1>=0;count1--){
  301. code=code+(cod[count1]&0xFF);
  302. if(count1>0)
  303. code=code*0x100;
  304. }
  305. if(code<0)code=-code;
  306. for(;code<10000;) code=code*10;
  307. for(;code>999999;) code=code/10;
  308. printf(Your Serial Number=P%c4-%ld",(type=='1')? 'E':'4'code);
  309. return ;
  310. }
  311.  
  312. Ok! So! An overall conclusion of this code is:
  313.  
  314. 1.First two characters of the serial must be either 'PE' or 'P4'.
  315. 2.Multiply every first four characters or our name with every byte of our serial before '-'
  316. 3.XOR every four byte with every byte of our name.
  317. 4.Convert to positive number if<0.
  318. 5.Convert to number between 10000 and 1000000.
  319.  
  320. Forgive me if this code is buggy as I wrote it very quickly in the little spare time I had.
  321.  
  322. -Contact me here: via discord:ᴠxᴘ
  323. #0652
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement