Some experiences on Reverse Engineering

Source: Internet
Author: User

[What is reverse engineering of software]

A few of my friends commented that this is reverse engineering. In my opinion, what is reverse engineering is benevolent and wise. For more information, see Wikipedia [4]. The excerpt is as follows:

 

Reverse Engineering of software

 

The termReverse EngineeringAs applied to software means
Different things to different people, prompting chikofsky and cross
Write a paper researching the various uses and defining a taxonomy.
From their paper, they state, "reverse engineering is the process
Analyzing a subject system to create representations of the system at
Higher Level of login action. "[4] It can also be seen as" going backwards through the development cycle ". [5]
In this model, the output of the implementation phase (in source code
Form) is reverse-engineered back to the analysis phase, in an inversion
Of the traditional waterfall model.
Reverse engineering is a process of examination only: the software
System under consideration is not modified (which wocould make it Reengineering). Software anti-tamper
Technology is used to deter both reverse engineering and Reengineering
Of proprietary software and software-powered systems. In practice, two
Main Types of reverse engineering emerge.In the first case, Source
Code is already available for the software, but higher-level aspects
The program, perhaps poorly incluented or incluented but no longer
Valid, are discovered.
In the second case, there is no source code
Available for the software, and any efforts towards discovering one
Possible source code for the software are regarded as reverse
Engineering.
This second usage of the term is the one most people are
Familiar with. Reverse Engineering of software can make use of the clean room design technique to avoid copyright infringement.

On a related note, black box testing in software engineering has a lot in common with reverse engineering. the tester usually has the API, but their goals are to find bugs and uninitialized ented features by bashing the product from outside.

Other Purposes of reverse engineering include security auditing, removal of copy protection ("cracking"), circumvention of access restrictions often present in consumer electronics, customization of Embedded Systems
(Such as engine management systems), in-house repairs or your fits,
Enabling of additional features on low-cost "Crippled" hardware (such
As some graphics card chipsets), or even mere satisfaction of curiosity.

Because Java is used, other languages can only be used for reference, but the basic method should be similar.

The United States has a good open-source environment, the most famous is the old SourceForge, but now Google also provides similar services; many universities have published their own research code. Many times, people are using or learning other people's things for development. "standing on the shoulders of giants, reverse engineering is a shortcut to the shoulders of giants ." [1]

The first step is to download the source code. Generally, the zip package is downloaded directly, and the latest development package is also downloaded directly using SVN. It depends on your requirements and whether you want to update the latest development progress. Websites generally provideUser Manual
AndDevelopment Manual
These documents are especially important and should be carefully read. In some cases, the website also provides some FAQs, wiki, and examples or demos.

Before reading the code, read the FAQ and get start carefully to avoid unnecessary errors!

Reading source code requires some basic knowledge, such as design patterns, XML, UML, and JUnit. Most of the current code is in the Community model and many software engineering models are applied. Next, import the code to the development tool. I mainly use eclipse and netbeans. In many cases, the import is smooth. If the source code needs to call other class libraries, you need to set the jar path and even download those class libraries by yourself. If J2EE is involved, you need to configure the runtime environment, this is a digress.

I basically divide the source code into two types, with or without a GUI. There are some special features with GUI, which will be discussed later.

Generally, you should first look at the package and analyze the relationship between classes. In this case, UML is very useful. Refer to my previous article [2 ]. The next step is to analyze the specific functions in the class. At this time, we need to analyze the call relationship of the following functions, also called call hierarchy. This is generally a tree structure. If it is represented by a graph, it is also called call graph. Here we will talk about how to analyze the function call relationship in eclipse.

There are several shortcut keys to remember [3 ]:

1. CTRL + Left click

This is frequently used by most people to view the definitions of variables, methods, and classes.
2. CTRL + O

View the outline of a class and list its methods and member variables. Tip: press Ctrl + O to list the methods and variables inherited by the class.
Note: "O" ---> "outline" ---> "outline"
3. CTRL + T

View the inheritance tree of a class, which is top-down. If you press Ctrl + T one more time, the structure is displayed from bottom to top.
Tip: select a method name and press Ctrl + T. You can view the parent class, subclass, and interface of the method with the same name.
Note: "T" -------> "Tree" -----> "Hierarchy Tree"
4. Alt + left and right direction keys

We often encounter situations where we read the code by pressing CTRL + left-click, trace them layer by layer, and then get lost in the Code. In this case, we only need to press "Alt + Left-direction key" to return to the last read position, similarly, pressing "Alt + right arrow key" will move to the returned reading position, just like the browser's forward and backward buttons.
5. CTRL + ALT + H

If you want to know whether a class method is called by other classes, select the method name and press CTRL + ALT + H ", eclipse will display the methods called by this method, and ultimately generate a call relationship tree.


5. Alt + Shift + Q, T

This is used for display. You can drag any function in the above call hierarchy to this Panel to analyze the class call relationship and generate a class hierarchy.

With the macro UML and the micro function call relationship, we can generally better understand the source code.

There are also some other software (I have not used most of it), which may be useful here: GPROF, Ariadne, slickedit, codeviz, dtrace.

 

Refer:

[1] http://hi.baidu.com/ghd_214/blog/item/87a72dadb6df2f034b36d6ea.html

[2] http://blog.csdn.net/autofei/archive/2009/11/04/4765289.aspx

[3] http://doggou.javaeye.com/blog/211741

[4] http://en.wikipedia.org/wiki/Reverse_engineering#Reverse_engineering_of_software

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.