Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Saturday, July 19, 2014

How to use the same C++ code for Android and iOS?

Best tutorial on using C++ code with iOS and Android


Please read this wonderful StackOverflow post:

Tuesday, July 3, 2012

How to install Eclipse on Ubuntu

How to install Eclipse

Open your terminal:

sudo apt-get install eclipse

This is will install the stable version from the repositories.

How to switch your Java version on Ubuntu

How to easily change your Java version

This is how you can get the versions you are using now:

java -version
javac -version
javaws -version

Easily change which Java installation you would like to use:

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws

If you have installed this repository:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update

You can install a graphical version to easily change your Java version:

sudo apt-get install update-java
sudo update-java

How to install Java 7 on Ubuntu

How to install Java 7 - fastest way
 
Add this repository:

sudo add-apt-repository ppa:webupd8team/java

Update your package list:

sudo apt-get update

Add this, in case you don't have it:

sudo mkdir -p /usr/lib/mozilla/plugins

Finally install Java 7:

sudo apt-get install oracle-jdk7-installer

http://www.webupd8.org/2011/09/how-to-install-oracle-java-7-jdk-in.html
http://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7

Tuesday, May 8, 2012

How to Reverse Engineer Android Malware

Reverse Engineer Android Malware

Tools you may need for decompiling Android malware:

apktool – a tool used for manipulating .apk files
   Download: http://code.google.com/p/android-apktool/
jad – a Java decompiler (Windows only)
   Download: http://www.varaneckas.com/jad
JD-Core + JD-GUI – another Java decompiler, supporting newer Java versions and features
   Download: http://java.decompiler.free.fr
dex2jar – a tool for converting .dex files to .class files
   Download: http://code.google.com/p/dex2jar/downloads/list (dex2jar)
apkinspector - all in one tool
   Download: http://code.google.com/p/apkinspector/

However, this tutorial is fairly easy and simple and I will only be using dex2jar and jd-gui. This tutorial is a standard for all apps. You can use the same tools and methods to help decompile your applications and other applications, especially malware, in order to see and understand what the code is actually doing.

So, say we have our malicious malware such as "file.apk".

A lot of these tools can be used in Windows as well as Linux, however I happen to be using Windows for this tutorial.
For Linux: sh dex2jar.sh file.apk
For Windows: dex2jar.bat file.apk



This will create the file called file_dex2jar.jar. Now we can easily view our app's code with jd-gui.
Simply just click on the jd-gui and open the file_dex2jar.jar.


 Now we can easily read and see the code.

Further Research/Advanced Topics:

  • Code Obfuscation 
  • Decompiling Manifest Files
  • Obtaining the Resources - images, etc.

For Related Articles:

http://blog.burrowsapps.com/2012/02/hacking-facebook-for-android.html

Thursday, September 1, 2011

Android - FREE Samples

Free Code and Projects
I used Google to find these, very helpful for learning new layouts and different android features.

GitHub
https://github.com/

Blogspot(Google Blogs)
http://android-coding.blogspot.com/
http://androidblogger.blogspot.com/
http://techdroid.kbeanie.com/

Google Code
http://code.google.com/p/androidnetworktester/
http://code.google.com/p/myandroidwidgets/

StackOverflow
http://stackoverflow.com/

Wordpess
http://pareshnmayani.wordpress.com/

Monday, May 30, 2011

HelloWorld in Java

For a pure Java HelloWorld:

HelloWorld.java

public class HelloWorld {
 public static void main(String[] args) {
  System.out.println("HelloWorld");
 }
}

javac HellWorld.java

java HelloWorld

HelloWorld in Android

1) Download Eclipse IDE: http://www.eclipse.org/downloads/
2) Download Android SDK for Eclipse: http://developer.android.com/sdk/index.html
-Installing Setup: http://developer.android.com/sdk/installing.html
3) Beginning Tutorial: http://developer.android.com/resources/tutorials/hello-world.html


HelloWorld.java
location: HelloWorld > src > com.HelloWord > HelloWorld.java
package com.HelloWorld;

import android.app.Activity;
import android.os.Bundle;

public class Hello extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
    }

}

main.xml

location: HelloWorld > res > layout > main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
</LinearLayout>

strings.xml

location: HelloWorld > res > values > strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello World, Hello!</string>
    <string name="app_name">HelloWorld</string>
</resources>

AndroidManifest.xml

location: HelloWorld > AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.HelloWorld"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="3" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Hello"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>


Notice: "System.out.println("HelloWorld!");" is not being used because "HelloWorld" is a string pulled from "strings.xml" which is used in the "main.xml"