Reverse Engineering : Convert class or jar to Java files
Previously, we have seen how to extract contents of .img file and also how to convert dex files to classes/jar.
In this post, I'm going to show a method to covert class/classes/jar file to java file(s).
To do so, we are going to use a tool, JD-GUI. It is a Java Decompiler, which supports all versions of Java, including java-7.
Download the application from here, and extract it to a proper location.
Now, open the terminal (in case of Linux) and run the following command:
./jd-gui
It will open the GUI window of Java decompiler.

Reverse Engineering : Convert class or jar to Java files

Just drag-and-drop a class/jar file into this window. In the left panel, we can find the corresponding java files, arranged in proper package format.
To save a single file, select it and choose "Save Source" from the top menu. And to save entire package, choose "Save all sources".

Troubleshooting:
You may ran into one of these problems, while trying to open jd-gui. Install the packages specified accordingly.
Error 1:
./jd-gui: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
Solution:
sudo apt-get install libgtk2.0-0:i386
Error 2:
./jd-gui: error while loading shared libraries: libXxf86vm.so.1: cannot open shared object file: No such file or directory
Solution:
sudo apt-get install libxxf86vm1:i386
Error 3:
./jd-gui: error while loading shared libraries: libSM.so.6: cannot open shared object file: No such file or directory
Solution:
sudo apt-get install libsm6:i386
Error 4:
/jd-gui: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
Solution:
sudo apt-get install lib32stdc++6
Reverse Engineering : Android Dex files to Class files
In my previous post, we have seen how to extract the contents of img file.
After extraction, you will find that most of the files have ".dex" extension. These are Compiled Android application code files.
In order to convert them into executable format (.class or .jar), you can use dex2jar tool.
Extract it to a proper location and open the terminal to this location.
Now run the following command:
./d2j-dex2jar.sh <Path-to-dex_file>
It will bundle the dex files into a jar file, and stores it in the current directory.
dex2jar can also be used to convert dex files into variuos other formats.
For detailed info, click here.
Reverse Engineering : Extract .img files of Android
Unyaffs is a program to extract files from a YAFFS2 file system image. Currently it can only extract images created by mkyaffs2image.
Download the source from here.
Compiling:
Extract the contents into a suitable place and run the following command
make
Usage:

unyaffs [options] <image_file_name> [<extract_directory>]

Options:
-d detection of flash layout, no extraction
-b spare contains bad block information
-c <chunk size> set chunk size in KByte (default: autodetect, max: 16)
-s <spare size> set spare size in Byte (default: autodetect, max: 512)
-t list image contents
-v verbose output
-V print version
Source: Official github repository
Problem installing flash player
Recently, I installed ubuntu updates and my browser asked me for flash player, which was previously installed. i tried to install using the regular command
sudo apt-get install flashplugin-installer
But, it says
flashplugin-installer is already the newest version
Finally, I found the workaround. Previous installation has to removed first (which anyway is not working)
Run the following commands :
sudo apt-get purge flashplugin-installer
sudo apt-get install flashplugin-installer
Viola!! It works now.
Failure [INSTALL_FAILED_UID_CHANGED]

Today, I tried to install an application from command line and I found this error:
Failure [INSTALL_FAILED_UID_CHANGED]
After Googling for a while, I found the reason.
This happens when there is application data from older version is still present. To resolve this, clear/delete the following directory:
/data/data/<PACKAGE_NAME>
To do this, open terminal and type the following commands:
adb shell
cd /data/data/
rm -r <PACKAGE_NAME>
exit
Now try to install the application.
Viola.
localhost
By default, localhost (127.0.0.1) points to /var/www/ directory in Ubuntu. I prefer the location to be in my home directory.
To change the default location, open the file:
/etc/apache2/sites-available/000-default.conf
 and change it to look as follows:
(My wokspace is located at /home/chaithanya/www)

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /home/chaithanya/www

        <Directory /home/chaithanya/www/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        ErrorLog /var/log/apache2/error.log
        CustomLog /var/log/apache2/access.log common
</VirtualHost>
Note: This works for Ubuntu 13.10+
Ubuntu: Install with video drivers disabled
When I tried to install Ubuntu 12.04 on my PC, it halted with 4/5 dots under Ubuntu. It's stuck at that point and no progress. Sometimes you may see some distorted image or white screen. All these problems are due to incompatible video drivers.

To get pass behind this screen and boot into the system, hold down SHIFT button while booting from CD/USB and press F6. Now select "nomodeset" option to prevent video drivers from loading.

Now you can install Ubuntu successfully. But you may face the problem again while booting (after installation). Then boot in "Recovery Mode" and install graphics drivers from GRUB menu or command line.

Popular Labels

Featured Post (TOP)

Flickr Images

Follow Me on Facebook.com

Follow on Google+

Recent Posts

AD (728x60)

Pages

Powered by Blogger.

Labels

Followers

Popular Posts

Popular Posts

Subscribe Via Email

Sign up for our newsletter, and well send you news and tutorials on web design, coding, business, and more! You'll also receive these great gifts: