android applications reverse engineering

29
Android Applications Reverse Engineering Amel LIMAM Wafa BEN ALI Olivier MARTY Sahar SOULAIH Benjamin BRUSA Imededdine HOSNI AndroCheck Supervisors Jean-Rémy FALLERI Xavier BLANC

Upload: bracha

Post on 08-Feb-2016

48 views

Category:

Documents


1 download

DESCRIPTION

Amel LIMAM Wafa BEN ALI Olivier MARTY Sahar SOULAIH Benjamin BRUSA Imededdine HOSNI. Supervisors Jean-Rémy FALLERI Xavier BLANC. Android Applications Reverse Engineering. AndroCheck. Outline. Overview. 1. Specifications. 2. Tools. 3. Application’s architecture. 4. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Android  Applications Reverse Engineering

Android Applications Reverse Engineering

Amel LIMAMWafa BEN ALIOlivier MARTYSahar SOULAIHBenjamin BRUSAImededdine HOSNI

AndroCheck

SupervisorsJean-Rémy FALLERIXavier BLANC

Page 2: Android  Applications Reverse Engineering

Tools

Overview

Specifications

Application’s architecture

Implementation

Results

Project management

1

2

5

3

4

6

7

Outline

Page 3: Android  Applications Reverse Engineering

Overview►Increasing number of applications available in Android Markets

►There is no assumption about the developer’s programming skills

►Android applications contain more and more different artifacts and coherence is needed

? •What about application’s structure ? •Is it assured not to crash ?

Page 4: Android  Applications Reverse Engineering

Main objectives

Specifications

4

Static code analyzer to check requirements

Modular software to ease evolution and adding features

Software compatible with Eclipse environment and ADT

Page 5: Android  Applications Reverse Engineering

5

Android Platform

Page 6: Android  Applications Reverse Engineering

Generated at compilation

Android Platform

6

Need mechanisms to check syntax, type consistency, and data flow before compilation and execution

R.javaJava Resources XML descriptors

Page 7: Android  Applications Reverse Engineering

setContentView(R.layout.myLayout);ObjectType obj = (ObjectType)findViewById(R.id.ObjectId)

<ObjectType android:id="@+id/ObjectId"></ObjectType>

myLayout.xml

myActivity.java

Android Platform

7

Page 8: Android  Applications Reverse Engineering

Specifications

8

First requirement

Second requirement

Third requirement

A Java object instantiated in the main code must be declared in its corresponding XML layout.

The cast type of a Java object at its instantiation must be compatible with the type of the object declared in the XML layout.

Any useless XML layout must be reported to the developer

Page 9: Android  Applications Reverse Engineering

Modeling framework and code generation facility

►To develop and manage the whole application life cycle

►To focus on the model.►The model itself is described in a meta-model.

Eclipse Modeling Framework

9

Page 10: Android  Applications Reverse Engineering

Metamodeling ?► The construction of a collection of concepts within a certain domain

Meta-ModelAnother abstractionModel structure

ModelAn abstraction of phenomena in the real world

Application

Eclipse Modeling Framework

10

Page 11: Android  Applications Reverse Engineering

UML

XML Schema

Impo

rt Ecore Model(.ecore)

Gen Model(.genmodel)

Javacode

Typical EMF usage scenario

11

Page 12: Android  Applications Reverse Engineering

Application’s architecture

Page 13: Android  Applications Reverse Engineering

Parsers

Page 14: Android  Applications Reverse Engineering

► JDT (Java Development Tooling) parser provides APIs to manipulate Java source code

▲ Tree Structure based API : AST (Abstract Syntax Tree)

▲Use an AST parser▲Visit a specific element

Exemple : method invocation, Type, function, class …

The AST representation defines an API to modify, create, read and delete source code.

► Example

public boolean visit(MethodInvocation method){if(method.getName().getIdentifier().equals("findViewById")){

Processing1();}if(method.getName().getIdentifier().equals("setContentView")

){Processing2();

}return true;

}

Java Parser

Page 15: Android  Applications Reverse Engineering

► DOM (Document Object Model ) parser - Tree Structure based API

The Dom parser implements the DOM API and it creates a DOM tree in memory for a XML document► When to use DOM parser

▲Manipulate the document▲Traverse the document back and forth▲Small XML files

► Drawbacks of DOM parser Consumes lot of memory

XML Parser

Page 16: Android  Applications Reverse Engineering

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout>

<ListView android:id="@+id/list  android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"/>

<Button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Clear Cache"/>

</LinearLayout>

Node Linear Layout

Node ListView• Attribute• Android:id• Attrinute Android:layout-width• Attrinute Android:layout-heigth

Node Button • Attribute• Android:id• Attrinute Android:layout-width• Attrinute Android:layout-heigth

Document Object Tree

XML ParserXML Document

Page 17: Android  Applications Reverse Engineering

Model and properties check

Page 18: Android  Applications Reverse Engineering

Applications’ Metamodel

Page 19: Android  Applications Reverse Engineering

► Using androidElementsFactory in order to

create model elements.► Instantiate EMF model with java and XML

elements.► Comparison between java and XML elements

properties.

Model instance and properties check

IdentifierTypeFile

XML ElementsId

CastFile

Java Elements

Page 20: Android  Applications Reverse Engineering

Application’s architecture

Page 21: Android  Applications Reverse Engineering

Java code describing the interface

describing the plug-in and its dependencies

Plugin’s Architecture

21

Page 22: Android  Applications Reverse Engineering

PDEPlugin Development

Environment

Plugin A

Plugin B

Core

User Interface

Workbench

JFace

SWT

Workspace

Runtime

Eclipse Platform

JDTJava Development Tools

ExtensionPoint Extension

Plugin’s Architecture

Page 23: Android  Applications Reverse Engineering

Creating a Plugin

23

Create a new plug-in

Add a View Extension to the

plugin.xml file

Define a View Class for the

Extension within the Plug-in

►Create a plug-in project►Define a plugin.xml file: contains a declaration of the plug-in id, name, pre-requisites,...

XML code added to the plugin.xml file▲Id: a unique name that will be used to identify the view▲name : a translatable name that will be used in the UI for the view▲Icon: a relative name of the icon that will be associated with the view▲Class: a fully qualified name of the class that implements

graphical elements of the interface

Page 24: Android  Applications Reverse Engineering

Update Site► Contains all required components for the plugin to funtion.► supports installation over the web via an installation url to avoid a

separate download.

Features directory

Plugins directory feature.xmlfile

update site components

Update site

Featurea list of plugins and other features which can be understood as a logical separate unit

maintain the properties •Modify feature name •Add new plugins

feature.xmlfile

24

Page 25: Android  Applications Reverse Engineering

GUI

25

Page 26: Android  Applications Reverse Engineering

Demo

26

Page 27: Android  Applications Reverse Engineering

Project Management

27

SVNHandle collaborative work on project’s source code

Google documents•Requirements•Gantt diagram•Division of labour

•Short and frequent meetings

•Roadmap

• Sprints of 1 to 2 weeks

• Objectifs’ evaluation

Wiki centralise project informationhttp://projets9androidapps.wiki-site.com/index.php/Accueil

Problems ListListing bugs and problems with date of detection, gravity and status

Tools Organizational method

Page 28: Android  Applications Reverse Engineering

Gantt

28

Durée S1 S2 S3 S4 S1 S2 S3 S4 S1 S2 S3 S4 S1 S2 S3 S4 S1 S2 S3 S4

2 SMise en place des outils de travail collaboratif 1 SFeuille d'organisation de groupe 1 S

4 SPrise en main Android 1 SEtude EMF 1 SManipulation d'EMF 2SEtude des besoins 2 SDocument de specification fonctionnelle 3 SRecherche d'exemples de méta-modèles 2S

5 SEtude des artefacts d'une application Android 4 SÉlaboration d'un méta-modèle 3 S

4SMise en place d'un prototype 3 SAjout des vérifications 3 S

5 SRédaction du rapport 3 SPréparation de la soutenance 3 S

Reverse-engineering d'applications Android 2010 2011

OCT NOV DEC JAN FEV

Finalisation du projet

Livrables

Phase de planning et d'organisation

Etude du projet

Phase de Conception

Phase d'implémentation

Page 29: Android  Applications Reverse Engineering

Thank you

Do You Have Any Questions ?

29