C # code decompilation to share the project running source code experience (Appendix: Tools for modifying file names in batches)

Source: Internet
Author: User
Tags reflector

When talking about "C # code decompilation", you may think of the reflector code decompilation tool, which should not be too unfamiliar with it; do C # development, it is an indispensable utility. You can easily viewProgramSetSource code(This is the most basic use and is also commonly used). It can also facilitate software cracking...ArticleI would like to share with you a project that uses reflector to develop the C # software [project] (This article describes the winform project and can be used for reference for. Net projects ).CodeRestore-decompile to get the source code of the runable project. The Decompilation I have done is not 'cracking '. The premise or situation of the use is: The company originally invited people to develop the 'catering software (Kindergarten edition)'. The current customers want to buy it, in addition, there are some problems in the software that need to be changed. The software is not developed by myself, and there is no source code. to modify the software, you can only find a way to get the source code. The specific 'cracking 'method is recorded for later viewing! (PS: the method of 'cracking '. I have explored it before. However, after decompilation, there are many errors, and there are no patience. Some problems may seem strange. If you try a few times, you will not be able to give up. This is an indirect explanation: the real hacker, it should be patient ..., but why don't we need to do this for software development ?!)

A. The tool used: reflector, specifically: reflector plug-in file disassembler (what is it and how to use it, directly go online ).

B. open reflector, select the software (.exe) main program to 'crack ', and then click:, select the type 'windows appliction' on the Assembly (output) Type Selection interface displayed on the right (because it is a winform application, if it is other selected, such as 'class... 'class library, you need to change the output type in the project properties in the subsequent steps. We do not recommend this operation ),

Click Generate to obtain the source code of the main assembly. You can perform this operation on other related assembly! -- Do not think that success is achieved. This is only the first step, and it is troublesome!

C. open the generated source code in vs (project) and try to run it first. (generally) An error will be reported to exclude errors like 'xxx assembly does not exist'. What I encounter is as follows:

Using System;
Using System. Collections. Generic;
Using System. runtime. compilerservices;
Using System. runtime. interopservices;

[Compilergenerated]
Internal Class < Privateimplementationdetails > {1ff4f699 - 35e0 - 4117 - Bdbc - 9e44a1b0f9f5}
{
Internal Static Dictionary < String , Int > $ Method0x600012e - 1 ;
Internal Static Dictionary < String , Int > $ Method0x6000133 - 1 ;
Internal Static Dictionary < String , Int > $ Method0x6000133 - 2 ;
Internal Static Dictionary < String , Int > $ Method0x600014a - 1 ;
Internal Static Dictionary < String , Int > $ Method0x6000169 - 1 ;
Internal Static Dictionary < String , Int > $ Method0x60001b6 - 1 ;
Internal Static _ Staticarrayinittypesize = 20 $ Method0x6000213 - 1 ; // Data size: 20 bytes
Internal Static _ Staticarrayinittypesize = 20 $ Method0x6000213 - 2 ; // Data size: 20 bytes
Internal Static _ Staticarrayinittypesize = 20 $ Method0x6000213 - 3 ; // Data size: 20 bytes
Internal Static _ Staticarrayinittypesize = 20 $ Method0x6000213 - 4 ; // Data size: 20 bytes

[Structlayout (layoutkind. explicit, size = 20 , Pack = 1 )]
Private Struct _ Staticarrayinittypesize = 20
{
}
}

The source code file contains a _ privateimplementationdetails _ {1ff4f699-35e0-4117-bdbc-9e44a1b0f9f5}. The CS file name contains a long garbled class. Solution: Comment this class or delete it directly. [Remember to place Program-related files, slices, databases, and so on in the project's associated location, usually in the bin/debug/folder]

D. Add references to the relevant Assembly and set the startup object. At this point, almost the program can run, but it is not complete-because the decompiled code, folder location and interface and resource reference are basically messy. so the key issue to be solved now is: Restore the association and reference between files (other problems can be solved through debugging ). :

Form. CS and. the resx (Resource) file is not in the same folder, corresponding to. the resx file is prefixed with the project or solution name (zhiyisystem .) -- This is point! This is the key to solving the problem: to restore the association between the. CS and. resx files in the form, follow these two steps:1. Place the. CS and. resx files of the form in the same file, that is, the same directory. 2. remove. the prefix of the resx file-that is, to modify the file name. If there are many forms to modify each file, it is a very repetitive and boring thing, so I went online to find the tool "batch Modify file names" and downloaded one or two files. I couldn't find them, but I had to do it myself. Besides, this is simple, to put it bluntly, you just need to traverse the files in the folder and 'rename '(the code will not be pasted, and the article will be accompanied by a self-written "batch file name modification" tool ).

At this point, the program can actually run. Although I wrote it out, it seems that "cracking" is a matter of time, but when I did it, I felt like "forget it, I got stuck again... ", there are some major or minor problems. I cannot remember them because of the time and some steps at half past one, but the main methods should not fall, if you have any questions, you can leave a message and answer them. If you have experience in the 'hacking' method, Please give more comments and share your 'hackers' experience!

Appendix:

Batch Modify file name tool .rar

(Reflector )reflector.filedisassembler.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.