KR102176742B1 - Method of call graph extraction in android apps, recording medium and apparatus for performing the method - Google Patents

Method of call graph extraction in android apps, recording medium and apparatus for performing the method Download PDF

Info

Publication number
KR102176742B1
KR102176742B1 KR1020190007853A KR20190007853A KR102176742B1 KR 102176742 B1 KR102176742 B1 KR 102176742B1 KR 1020190007853 A KR1020190007853 A KR 1020190007853A KR 20190007853 A KR20190007853 A KR 20190007853A KR 102176742 B1 KR102176742 B1 KR 102176742B1
Authority
KR
South Korea
Prior art keywords
call relationship
android app
function
function call
generating
Prior art date
Application number
KR1020190007853A
Other languages
Korean (ko)
Other versions
KR20200060180A (en
Inventor
정수환
안진웅
Original Assignee
숭실대학교산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 숭실대학교산학협력단 filed Critical 숭실대학교산학협력단
Publication of KR20200060180A publication Critical patent/KR20200060180A/en
Application granted granted Critical
Publication of KR102176742B1 publication Critical patent/KR102176742B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/53Decompilation; Disassembly
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Abstract

안드로이드 앱의 호출 관계도 생성 방법, 이를 수행하기 위한 기록매체 및 장치가 개시된다. 안드로이드 앱의 호출 관계도 생성 장치는 안드로이드 앱의 DEX(Dalvik Excutable) 파일 및 SO(Shared Object) 파일을 추출하는 안드로이드 앱 분석부, 상기 DEX 파일에서 Dalvik 명령어를 추출하는 DEX 파일 분석부, 상기 SO 파일에서 ARM 명령어를 추출하는 SO 파일 분석부 및 상기 Dalvik 명령어로부터 상기 안드로이드 앱의 자바(Java) 코드 상의 함수 호출 관계를 추출하고, 상기 ARM 명령어로부터 상기 안드로이드 앱의 네이티브(Native) 코드 상의 함수 호출 관계를 추출하며, 상기 자바 코드 상의 함수 호출 관계 및 상기 네이티브 코드 상의 함수 호출 관계를 연결하여 상기 안드로이드 앱의 호출 관계도를 생성하는 함수 호출 관계도 생성부를 포함한다.Disclosed are a method of generating a call relationship of an Android app, a recording medium and a device for performing the same. The device for generating a call relationship diagram of an Android app includes an Android app analysis unit that extracts a DEX (Dalvik Excutable) file and an SO (Shared Object) file of an Android app, a DEX file analysis unit that extracts Dalvik commands from the DEX file, and the SO file. The SO file analysis unit extracting the ARM instruction from and extracts the function call relationship in the Java code of the Android app from the Dalvik instruction, and the function call relationship in the Android app's native code from the ARM instruction. It extracts and connects the function call relationship on the Java code and the function call relationship on the native code to generate a call relationship diagram of the Android app.

Description

안드로이드 앱의 호출 관계도 생성 방법, 이를 수행하기 위한 기록매체 및 장치{METHOD OF CALL GRAPH EXTRACTION IN ANDROID APPS, RECORDING MEDIUM AND APPARATUS FOR PERFORMING THE METHOD}How to create a call relationship diagram of an Android app, a recording medium and a device to perform it {METHOD OF CALL GRAPH EXTRACTION IN ANDROID APPS, RECORDING MEDIUM AND APPARATUS FOR PERFORMING THE METHOD}

본 발명은 안드로이드 앱의 호출 관계도 생성 방법, 이를 수행하기 위한 기록매체 및 장치에 관한 것으로서, 더욱 상세하게는 안드로이드 앱의 자바(Java) 코드 및 네이티브(Native) 코드 상의 호출 관계도를 생성하는 안드로이드 앱의 호출 관계도 생성 방법, 이를 수행하기 위한 기록매체 및 장치에 관한 것이다.The present invention relates to a method for generating a call relationship diagram of an Android app, a recording medium and a device for performing the same, and more particularly, an Android that generates a call relationship diagram on the Java code and the native code of the Android app. It relates to a method of generating a call relationship of an app, a recording medium and a device for performing it.

안드로이드 앱의 호출 관계도 생성 방법으로는 안드로이드 앱의 실행파일인 DEX(Dalvik Excutable) 파일을 추출하고, DEX 파일의 바이너리를 사람이 읽을 수 있는 코드로 보여주는 smali 코드로 변환하여 자바(Java) 코드 상의 함수 간 호출 관계를 알아내는 방법이 있다.As a method of creating the calling relationship of Android apps, the DEX (Dalvik Excutable) file, the executable file of the Android app, is extracted, and the binary of the DEX file is converted into smali code that shows human-readable code, There is a way to find out the calling relationship between functions.

여기에서 DEX 바이너리를 smali 코드로 변환하기 위해 apktool을 사용하는데, 디코딩을 방지하는 난독화 기법이 적용된 안드로이드 앱의 경우, apktool이 디코딩에 실패하여 DEX 파일 분석이 불가능하다.Here, apktool is used to convert DEX binary to smali code. In the case of an Android app with obfuscation technique that prevents decoding, apktool fails to decode and DEX file analysis is impossible.

또한 종래의 방식은 DEX 파일을 디컴파일하여 자바 코드 상의 함수 호출 관계를 추출하는 것으로, C/C++과 같은 네이티브(Native) 코드 상의 함수 호출 관계는 추출할 수 없다는 한계점이 있다.In addition, the conventional method extracts a function call relationship in Java code by decompiling a DEX file, and has a limitation in that it cannot extract a function call relationship in a native code such as C/C++.

본 발명은 DEX 파일 구조에 따라 자바 코드 상의 호출 관계를 추출함으로써 난독화가 적용된 안드로이드 앱의 함수 호출 관계를 파악하고, 네이티브 코드 상의 호출 관계 또한 추출하여 자바 코드로부터 네이티브 코드를 호출하는 관계를 포함하는 안드로이드 앱의 호출 관계도를 생성하는 안드로이드 앱의 호출 관계도 생성 방법, 이를 수행하기 위한 기록매체 및 장치를 제공한다.The present invention extracts the call relationship in the Java code according to the DEX file structure to identify the function call relationship of the obfuscated Android app, and also extracts the call relationship in the native code to include the relationship of calling the native code from the Java code. It provides a method of generating a call relationship diagram of an Android app that creates a call relationship diagram of an app, and a recording medium and a device for performing this.

본 발명의 기술적 과제는 이상에서 언급한 기술적 과제로 제한되지 않으며, 언급되지 않은 또 다른 기술적 과제들은 아래의 기재로부터 당업자에게 명확하게 이해될 수 있을 것이다.The technical problem of the present invention is not limited to the technical problem mentioned above, and other technical problems that are not mentioned will be clearly understood by those skilled in the art from the following description.

상기 과제를 해결하기 위한 안드로이드 앱의 호출 관계도 생성 장치는 안드로이드 앱의 DEX(Dalvik Excutable) 파일 및 SO(Shared Object) 파일을 추출하는 안드로이드 앱 분석부, 상기 DEX 파일에서 Dalvik 명령어를 추출하는 DEX 파일 분석부, 상기 SO 파일에서 ARM 명령어를 추출하는 SO 파일 분석부 및 상기 Dalvik 명령어로부터 상기 안드로이드 앱의 자바(Java) 코드 상의 함수 호출 관계를 추출하고, 상기 ARM 명령어로부터 상기 안드로이드 앱의 네이티브(Native) 코드 상의 함수 호출 관계를 추출하며, 상기 자바 코드 상의 함수 호출 관계 및 상기 네이티브 코드 상의 함수 호출 관계를 연결하여 상기 안드로이드 앱의 호출 관계도를 생성하는 함수 호출 관계도 생성부를 포함한다.The device for generating a call relationship diagram of an Android app to solve the above problem is an Android app analysis unit that extracts a DEX (Dalvik Excutable) file and a SO (Shared Object) file of the Android app, and a DEX file that extracts Dalvik commands from the DEX file. An analysis unit, an SO file analysis unit that extracts an ARM instruction from the SO file, and a function call relationship in the Java code of the Android app from the Dalvik instruction, and the Android app native from the ARM instruction A function call relationship diagram generator for extracting a function call relationship in a code, and generating a call relationship diagram of the Android app by connecting the function call relationship in the Java code and the function call relationship in the native code.

한편, 상기 안드로이드 앱의 호출 관계도를 시각화할 수 있도록 PDF 파일 또는 DOT 파일 형식으로 저장하는 시각화부를 더 포함할 수 있다.Meanwhile, a visualization unit for storing a PDF file or a DOT file format to visualize the call relationship diagram of the Android app may be further included.

또한, 상기 함수 호출 관계도 생성부는, 상기 Dalvik 명령어 중 다른 함수를 호출하는 invoke 명령어를 추출하고, 상기 invoke 명령어의 인자를 분석하여 상기 자바 코드 상의 함수 호출 관계를 추출할 수 있다.In addition, the function call relationship diagram generator may extract an invoke command that calls another function among the Dalvik commands, and analyze an argument of the invoke command to extract a function call relationship in the Java code.

또한, 상기 함수 호출 관계도 생성부는, 상기 ARM 명령어 중 다른 함수를 호출하는 branch 명령어를 추출하고, 상기 Branch 명령어의 인자를 분석하여 상기 네이티브 코드 상의 함수 호출 관계를 추출할 수 있다.In addition, the function call relationship diagram generator may extract a branch command that calls another function among the ARM commands, and analyze an argument of the branch command to extract a function call relationship in the native code.

또한, 상기 함수 호출 관계도 생성부는, 상기 자바 코드 상의 함수 호출 관계에 포함되는 호출 대상(callee) 함수의 접근제한자(access flags)의 네이티브 플래그 포함 여부에 따라 상기 자바 코드 상의 함수 호출 관계와 상기 네이티브 코드 상의 함수 호출 관계를 연결하여 자바 코드로부터 네이티브 코드를 호출하는 관계를 포함하는 상기 안드로이드 앱의 호출 관계도를 생성할 수 있다.In addition, the function call relationship generation unit, the function call relationship in the Java code and the function call relationship in the Java code according to whether or not the native flags of the access flags of the call target function included in the function call relationship in the Java code are included. A call relationship diagram of the Android app including a relationship of calling the native code from the Java code may be generated by connecting the function call relationship on the native code.

한편, 본 발명의 안드로이드 앱의 호출 관계도 생성 방법은 안드로이드 앱의 DEX(Dalvik Excutable) 파일 및 SO(Shared Object) 파일을 추출하는 안드로이드 앱 분석 단계, 상기 DEX 파일에서 Dalvik 명령어를 추출하는 DEX 파일 분석 단계, 상기 SO 파일에서 ARM 명령어를 추출하는 SO 파일 분석 단계, 상기 Dalvik 명령어로부터 상기 안드로이드 앱의 자바(Java) 코드 상의 함수 호출 관계를 추출하고, 상기 ARM 명령어로부터 상기 안드로이드 앱의 네이티브(Native) 코드 상의 함수 호출 관계를 추출하며, 상기 자바 코드 상의 함수 호출 관계 및 상기 네이티브 코드 상의 함수 호출 관계를 연결하여 상기 안드로이드 앱의 호출 관계도를 생성하는 함수 호출 관계도 생성 단계를 포함한다.On the other hand, the method for generating a call relationship diagram of an Android app of the present invention includes an Android app analysis step of extracting a DEX (Dalvik Excutable) file and a SO (Shared Object) file of the Android app, and a DEX file analysis of extracting Dalvik commands from the DEX file. Step, SO file analysis step of extracting an ARM instruction from the SO file, extracting a function call relationship in the Java code of the Android app from the Dalvik instruction, and the native code of the Android app from the ARM instruction And a function call relationship diagram generating step of extracting a function call relationship on the Java code and connecting the function call relationship on the Java code and the function call relationship on the native code to generate a call relationship diagram of the Android app.

한편, 상기 안드로이드 앱의 호출 관계도를 콜 그래프(Call Graph)로 시각화할 수 있도록 PDF 파일 또는 DOT 파일 형식으로 저장하는 시각화 단계를 더 포함할 수 있다.Meanwhile, a visualization step of storing the call relationship diagram of the Android app in a PDF file or a DOT file format may be further included so that the call graph may be visualized.

또한, 상기 함수 호출 관계도 생성 단계는, 상기 Dalvik 명령어 중 다른 함수를 호출하는 invoke 명령어를 추출하는 단계 및 상기 invoke 명령어의 인자를 분석하여 상기 자바 코드 상의 함수 호출 관계를 추출하는 단계를 포함할 수 있다.In addition, the step of generating the function call relationship may include extracting an invoke command that calls another function among the Dalvik commands, and extracting a function call relationship in the Java code by analyzing an argument of the invoke command. have.

또한, 상기 함수 호출 관계도 생성 단계는, 상기 ARM 명령어 중 다른 함수를 호출하는 branch 명령어를 추출하는 단계 및 상기 Branch 명령어의 인자를 분석하여 상기 네이티브 코드 상의 함수 호출 관계를 추출하는 단계를 포함할 수 있다.In addition, the step of generating the function call relationship may include extracting a branch instruction that calls another function among the ARM instructions, and analyzing an argument of the branch instruction to extract a function call relationship in the native code. have.

또한, 상기 함수 호출 관계도 생성 단계는, 상기 자바 코드 상의 함수 호출 관계에 포함되는 호출 대상(callee) 함수의 접근제한자(access flags)를 확인하는 단계 및 상기 호출 대상 함수의 접근제한자가 네이티브 플래그를 포함하는 경우, 상기 호출 대상 함수와 상기 네이티브 플래그에 해당하는 네이티브 코드 상의 함수를 연결하여 자바 코드로부터 네이티브 코드를 호출하는 관계를 포함하는 상기 안드로이드 앱의 호출 관계도를 생성하는 단계를 포함할 수 있다.In addition, in the step of generating the function call relationship, the step of checking access flags of the callee function included in the function call relationship in the Java code, and the access limiter of the call target function is a native flag In the case of including, generating a call relationship diagram of the Android app including a relationship of calling the native code from the Java code by connecting the function to be called and a function on the native code corresponding to the native flag. have.

또한, 상기 안드로이드 앱의 호출 관계도 생성 방법을 수행하기 위한, 컴퓨터 프로그램이 기록된 컴퓨터로 판독 가능한 기록 매체일 수 있다.In addition, it may be a computer-readable recording medium in which a computer program is recorded for performing the method for generating a call relationship of the Android app.

본 발명에 따르면 DEX 파일 구조에 따라 자바 코드 상의 호출 관계를 추출함으로써 난독화가 적용된 안드로이드 앱의 함수 호출 관계를 파악할 수 있으며, 나아가 네이티브 코드 상의 호출 관계 또한 추출하여 자바 코드로부터 네이티브 코드를 호출하는 관계를 포함하는 안드로이드 앱의 호출 관계도를 생성할 수 있다. According to the present invention, by extracting the call relationship in the Java code according to the DEX file structure, it is possible to grasp the function call relationship of the obfuscated Android app. Furthermore, the call relationship in the native code is also extracted to determine the relationship of calling the native code from the Java code. You can create a call relationship diagram of the containing Android app.

또한 안드로이드 앱의 통합 호출 관계도는 안드로이드 앱의 동작 시퀀스 획득에 용이하게 사용될 수 있으며, 코드 상에서 실제로 전달되는 컨텐츠의 흐름 파악이 가능하여 자바 코드와 네이티브 코드 모두에서 사용되는 데이터 분석에 사용될 수 있을 것이다.In addition, the integrated call relationship diagram of the Android app can be easily used to obtain the operation sequence of the Android app, and it can be used to analyze the data used in both the Java code and the native code because it is possible to understand the flow of the content actually delivered in the code. .

도 1은 본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치의 블록도이다.
도 2는 본 발명의 다른 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치의 블록도이다.
도 3은 본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 방법의 흐름도이다.
1 is a block diagram of an apparatus for generating a call relationship diagram of an Android app according to an embodiment of the present invention.
2 is a block diagram of an apparatus for generating a call relationship diagram of an Android app according to another embodiment of the present invention.
3 is a flowchart of a method for generating a call relationship diagram of an Android app according to an embodiment of the present invention.

후술하는 본 발명에 대한 상세한 설명은, 본 발명이 실시될 수 있는 특정 실시예를 예시로서 도시하는 첨부 도면을 참조한다. 이들 실시예는 당업자가 본 발명을 실시할 수 있기에 충분하도록 상세히 설명된다. 본 발명의 다양한 실시예는 서로 다르지만 상호 배타적일 필요는 없음이 이해되어야 한다. 예를 들어, 여기에 기재되어 있는 특정 형상, 구조 및 특성은 일 실시예와 관련하여 본 발명의 정신 및 범위를 벗어나지 않으면서 다른 실시예로 구현될 수 있다. 또한, 각각의 개시된 실시예 내의 개별 구성요소의 위치 또는 배치는 본 발명의 정신 및 범위를 벗어나지 않으면서 변경될 수 있음이 이해되어야 한다. 따라서, 후술하는 상세한 설명은 한정적인 의미로서 취하려는 것이 아니며, 본 발명의 범위는, 적절하게 설명된다면, 그 청구항들이 주장하는 것과 균등한 모든 범위와 더불어 첨부된 청구항에 의해서만 한정된다. 도면에서 유사한 참조부호는 여러 측면에 걸쳐서 동일하거나 유사한 기능을 지칭한다.DETAILED DESCRIPTION OF THE INVENTION The detailed description of the present invention to be described later refers to the accompanying drawings, which illustrate specific embodiments in which the present invention may be practiced. These embodiments are described in detail sufficient to enable a person skilled in the art to practice the present invention. It is to be understood that the various embodiments of the present invention are different from each other, but need not be mutually exclusive. For example, certain shapes, structures, and characteristics described herein may be implemented in other embodiments without departing from the spirit and scope of the present invention in relation to one embodiment. In addition, it is to be understood that the location or arrangement of individual components within each disclosed embodiment may be changed without departing from the spirit and scope of the present invention. Accordingly, the detailed description to be described below is not intended to be taken in a limiting sense, and the scope of the present invention, if properly described, is limited only by the appended claims, along with all scopes equivalent to those claimed by the claims. Like reference numerals in the drawings refer to the same or similar functions over several aspects.

이하, 도면들을 참조하여 본 발명의 바람직한 실시예들을 보다 상세하게 설명하기로 한다.Hereinafter, preferred embodiments of the present invention will be described in more detail with reference to the drawings.

도 1은 본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치의 블록도이다.1 is a block diagram of an apparatus for generating a call relationship diagram of an Android app according to an embodiment of the present invention.

도 1을 참조하면, 본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치(1)는 안드로이드 앱 분석부(10), DEX 파일 분석부(30), SO 파일 분석부(50) 및 함수 호출 관계도 생성부(70)를 포함할 수 있다.Referring to FIG. 1, the device 1 for generating a call relationship diagram of an Android app according to an embodiment of the present invention includes an Android app analysis unit 10, a DEX file analysis unit 30, an SO file analysis unit 50, and The function call relationship may also include the generator 70.

본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치(1)는 안드로이드 앱의 DEX(Dalvik Excutable) 파일 및 SO(Shared Object) 파일을 정적 분석하여 자바(Java) 코드 상의 함수 호출 관계를 추출하고, 네이티브(Native) 코드 상의 함수 호출 관계를 추출할 수 있으며, 자바 코드 상의 함수 호출 관계와 네이티브 코드 상의 함수 호출 관계를 연결하여 안드로이드 앱의 전체 함수 호출 관계도를 생성할 수 있다.The device 1 for generating a call relationship diagram of an Android app according to an embodiment of the present invention statically analyzes the DEX (Dalvik Excutable) file and the SO (Shared Object) file of the Android app to determine the function call relationship in the Java code. It is possible to extract, extract the function call relationship in the native code, and create the entire function call relationship diagram of the Android app by connecting the function call relationship in the Java code and the function call relationship in the native code.

본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치(1)는 안드로이드 앱의 호출 관계도 생성을 위한 소프트웨어(어플리케이션)가 설치되어 실행될 수 있으며, 안드로이드 앱 분석부(10), DEX 파일 분석부(30), SO 파일 분석부(50) 및 함수 호출 관계도 생성부(70)는 안드로이드 앱의 호출 관계도 생성을 위한 소프트웨어에 의해 제어될 수 있다.The device 1 for generating a call relationship diagram of an Android app according to an embodiment of the present invention may install and execute software (application) for generating a call relationship diagram for an Android app, and the Android app analysis unit 10, the DEX file The analysis unit 30, the SO file analysis unit 50, and the function call relationship diagram generation unit 70 may be controlled by software for generating a call relationship diagram of an Android app.

안드로이드 앱 분석부(10), DEX 파일 분석부(30), SO 파일 분석부(50) 및 함수 호출 관계도 생성부(70)의 구성은 통합 모듈로 형성되거나, 하나 이상의 모듈로 이루어질 수 있다. 그러나, 이와 반대로 각 구성은 별도의 모듈로 이루어질 수도 있다. The configuration of the Android app analysis unit 10, the DEX file analysis unit 30, the SO file analysis unit 50, and the function call relationship diagram generation unit 70 may be formed as an integrated module or one or more modules. However, on the contrary, each component may be formed as a separate module.

본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치(1)는 이동성을 갖거나 고정될 수 있다. 본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치(1)는 컴퓨터(computer), 서버(server) 또는 엔진(engine) 형태일 수 있으며, 디바이스(device), 기구(apparatus), 단말(terminal), UE(user equipment), MS(mobile station), MT(mobile terminal), UT(user terminal), SS(subscriber station), 무선기기(wireless device), PDA(personal digital assistant), 무선 모뎀(wireless modem), 휴대기기(handheld device) 등 다른 용어로 불릴 수 있다.The device 1 for generating a call relationship diagram of an Android app according to an embodiment of the present invention may have mobility or may be fixed. The apparatus 1 for generating a call relationship diagram of an Android app according to an embodiment of the present invention may be in the form of a computer, a server, or an engine, and may be a device, an apparatus, or a terminal. (terminal), UE (user equipment), MS (mobile station), MT (mobile terminal), UT (user terminal), SS (subscriber station), wireless device (wireless device), PDA (personal digital assistant), wireless modem (wireless modem), handheld device, etc. can be called in other terms.

이하, 도 1에 도시된 본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치(1)의 각 구성에 대하여 구체적으로 설명한다.Hereinafter, each configuration of the device 1 for generating a call relationship diagram of an Android app according to an embodiment of the present invention shown in FIG. 1 will be described in detail.

안드로이드 앱 분석부(10)는 안드로이드 앱의 DEX 파일 및 SO(Shared Object) 파일을 추출할 수 있다.The Android app analysis unit 10 may extract a DEX file and a shared object (SO) file of an Android app.

안드로이드 앱 분석부(10)는 안드로이드 앱의 압축을 해제하고, DEX 파일과 SO 파일을 탐색하여 추출할 수 있다.The Android app analysis unit 10 may decompress the Android app, search for and extract DEX files and SO files.

DEX 파일 분석부(30)는 DEX 파일에서 Dalvik 명령어를 추출할 수 있다.The DEX file analysis unit 30 may extract Dalvik commands from the DEX file.

DEX 파일 분석부(30)는 DEX 파일의 구조를 분석하여, DEX 파일에서 Dalvik 명령어를 추출할 수 있다.The DEX file analysis unit 30 may analyze the structure of the DEX file and extract the Dalvik command from the DEX file.

DEX 파일의 구조는 공식 웹사이트 (https://source.android.com/ devices/tech/dalvik/dex-format.html)를 통해 확인할 수 있다. DEX 파일의 구조를 살펴보면 안드로이드 앱에서 사용되는 문자열, 타입, 변수, 클래스 타입, 메소드(함수), 클래스 정의부 등을 각 영역을 통하여 정의하고 있으며, DEX 파일의 헤더는 각 영역의 offset과 크기를 나타낸다. 특히, 클래스 정의부에는 클래스에 정의된 메소드(함수) 들을 참조하고 있으며, 각 메소드(함수) 들은 안드로이드 앱 실행 시 실제로 실행되는 Dalvik 명령어가 정의되어 있다. Dalvik 명령어의 종류, 수행하는 작업, opcode 또한 공식 웹사이트(https://source.android.com/devices/ tech/dalvik/dalvik-bytecode.html)를 통해 확인할 수 있다.The structure of the DEX file can be checked through the official website (https://source.android.com/ devices/tech/dalvik/dex-format.html). Looking at the structure of the DEX file, strings, types, variables, class types, methods (functions), and class definitions used in Android apps are defined through each area, and the header of the DEX file specifies the offset and size of each area. Show. In particular, the class definition section refers to the methods (functions) defined in the class, and each method (function) defines a Dalvik command that is actually executed when an Android app is executed. You can also check the type of Dalvik instruction, the operation it performs, and the opcode on the official website (https://source.android.com/devices/tech/dalvik/dalvik-bytecode.html).

DEX 파일 분석부(30)는 이러한 DEX 파일의 구조를 분석하여 DEX 파일에서 Dalvik 명령어를 추출할 수 있을 것이다.The DEX file analysis unit 30 may analyze the structure of the DEX file and extract the Dalvik command from the DEX file.

SO 파일 분석부(50)는 SO 파일에서 ARM 명령어를 추출할 수 있다.The SO file analysis unit 50 may extract an ARM instruction from the SO file.

SO 파일은 네이티브 코드를 컴파일하여 생기는 파일로, ELF(Executable and Linkable Format) 파일 형식을 따른다. ELF 파일의 헤더에는 컴파일된 OS와 명령어 set에 대한 정보, 프로그램 헤더 테이블, 섹션 헤더 테이블에 대한 정보 등이 포함될 수 있다. 특히, 섹션 헤더 테이블에는 ELF 파일의 각 섹션에 대한 정보가 저장되며, 각 엔트리에는 섹션의 이름과 타입, offset, size가 저장된다. 이때 섹션의 offset 및 size를 통하여 파일 내에서 섹션이 저장된 주소를 추출할 수 있으며, 섹션 중 ".text"와 같이 실제 실행되는 명령어를 저장하는 섹션이 존재한다. The SO file is a file created by compiling native code, and follows the ELF (Executable and Linkable Format) file format. The header of the ELF file may include information on the compiled OS and instruction set, program header table, and section header table. In particular, the section header table stores information about each section of the ELF file, and each entry stores the section name, type, offset, and size. At this time, the address where the section is stored in the file can be extracted through the offset and size of the section, and among the sections, there is a section that stores the command actually executed, such as ".text".

안드로이드 운영체제를 기반으로 한 모바일 디바이스는 대부분 ARM 32-bit 명령어 셋을 사용하므로, SO 파일 분석부(50)는 ".text"섹션의 명령어를 ARM 32-bit 명령어를 기반으로 하여 디컴파일하는 경우, ARM 명령어의 opcode와 인자값을 추출할 수 있을 것이다. 즉, SO 파일 분석부(50)는 SO 파일의 코드 섹션을 ARM 명령어로 디컴파일하여 ARM 명령어를 추출할 수 있다.Most mobile devices based on the Android operating system use the ARM 32-bit instruction set, so when the SO file analysis unit 50 decompiles the instruction of the ".text" section based on the ARM 32-bit instruction, You will be able to extract the opcode and argument values of ARM instructions. That is, the SO file analysis unit 50 may extract the ARM instruction by decompiling the code section of the SO file into the ARM instruction.

함수 호출 관계도 생성부(70)는 Dalvik 명령어로부터 안드로이드 앱의 자바 코드 상의 함수 호출 관계를 추출하고, ARM 명령어로부터 네이티브 코드 상의 함수 호출 관계를 추출할 수 있다. 그리고 함수 호출 관계도 생성부(70)는 자바 코드 상의 함수 호출 관계 및 네이티브 코드 상의 함수 호출 관계를 연결하여 안드로이드 앱의 호출 관계도를 생성할 수 있다.The function call relationship diagram generator 70 may extract a function call relationship in Java code of an Android app from a Dalvik instruction, and extract a function call relationship in native code from an ARM instruction. In addition, the function call relationship diagram generation unit 70 may generate a call relationship diagram of an Android app by connecting a function call relationship in a Java code and a function call relationship in a native code.

구체적으로는, 함수 호출 관계도 생성부(70)는 Dalvik 명령어 중 다른 함수를 호출하는 명령어를 필터링하여 자바 코드 상의 함수 호출 관계를 정의할 수 있다. 여기서 자바 코드 상에서는 함수를 메소드라 칭하는 것이 일반적이나, 본 실시예에서는 설명의 편의를 위해 자바 코드 상에서의 메소드를 함수로 지칭하여 설명한다.Specifically, the function call relationship diagram generation unit 70 may define a function call relationship in Java code by filtering a command that calls another function among Dalvik commands. Here, a function is generally referred to as a method in Java code, but in this embodiment, a method in a Java code is referred to as a function for convenience of description.

Dalvik 명령어 중 다른 함수를 호출하는 명령어는 아래 표 1과 같이 총 10개가 존재한다.Among Dalvik commands, there are a total of 10 commands that call other functions as shown in Table 1 below.

invoke-virtualinvoke-virtual invoke-virtual/rangeinvoke-virtual/range invoke-superinvoke-super invoke-super/rangeinvoke-super/range invoke-directinvoke-direct invoke-direct/rangeinvoke-direct/range invoke-staticinvoke-static invoke-static/rangeinvoke-static/range invoke-interfaceinvoke-interface invoke-interface/rangeinvoke-interface/range

표 1을 참조하면, Dalvik 명령어에서 다른 함수를 호출하는 명령어는 invoke-* 형식을 갖는 명령어임을 확인할 수 있다.따라서 함수 호출 관계도 생성부(70)는 Dalvik 명령어 중 다른 함수를 호출하는 invoke 명령어를 추출할 수 있다.Referring to Table 1, it can be seen that the instruction for calling another function in the Dalvik instruction is an instruction in the form of invoke-*. Therefore, the function call relationship generator 70 generates an invoke instruction that calls another function among Dalvik instructions. Can be extracted.

함수 호출 관계도 생성부(70)는 invoke 명령어를 분석하여 자바 코드 상의 함수 호출 관계를 추출할 수 있다. invoke 명령어의 인자는 호출 대상(Callee)이 되는 함수 타입에 대한 offset 값을 가지므로, 함수 호출 관계도 생성부(70)는 이러한 invoke 명령어의 인자를 분석하여 invoke 명령어의 호출 대상인 함수의 소속 클래스와 함수명, 파라미터와 리턴 타입을 획득할 수 있으며, 이를 토대로 자바 코드 상의 호출 주체(Caller)-호출 대상(Callee)의 함수 호출 관계를 추출할 수 있다.The function call relationship diagram generator 70 may analyze the invoke command to extract a function call relationship in Java code. Since the argument of the invoke command has an offset value for the function type to be called, the function call relationship diagram generator 70 analyzes the arguments of the invoke command to identify the class belonging to the function that is the target of the invoke command. The function name, parameters, and return type can be obtained, and based on this, the function call relationship between the calling subject (Caller) and the called target (Callee) in the Java code can be extracted.

또한, 함수 호출 관계도 생성부(70)는 ARM 명령어 중 다른 함수를 호출하는 명령어를 필터링하여 네이티브 코드 상의 함수 호출 관계를 정의할 수 있다.In addition, the function call relationship diagram generation unit 70 may define a function call relationship in a native code by filtering an instruction that calls another function among ARM instructions.

ARM 명령어 중 다른 함수를 호출하는 명령어는 branch 명령어로 볼 수 있다. branch 명령어는 명령어 실행 도중 지정된 주소로 점프하며, 점프 후 되돌아올 주소를 저장하는 명령어로, 네이티브 코드 상에서 다른 함수를 호출하는 경우 해당 함수의 주소로 점프하는 방식으로 함수 호출을 수행할 수 있다.Among ARM instructions, an instruction that calls another function can be viewed as a branch instruction. The branch command jumps to a specified address during command execution and stores the address to return after jumping. When calling another function in native code, a function call can be performed by jumping to the address of the corresponding function.

따라서 함수 호출 관계도 생성부(70)는 ARM 명령어 중 다른 함수를 호출하는 branch 명령어를 추출할 수 있다.Therefore, the function call relationship diagram generator 70 may extract a branch instruction that calls another function from among ARM instructions.

함수 호출 관계도 생성부(70)는 branch 명령어를 분석하여 네이티브 코드 상의 함수 호출 관계를 추출할 수 있다. 안드로이드 운영체제에서는 미리 빌드된 라이브러리를 제공하는 Dynamic Link 방식을 채택하고 있는데, Dynamic Link는 실행파일에서 라이브러리 코드를 포함하지 않도록 하는 공유 라이브러리 방식이다. Dynamic Link 방식은 PLT(Procedure Linkable Table) 및 GOT(Global Offset Table)을 섹션을 필요로 한다. PLT 섹션은 프로그램이 호출하는 모든 함수를 나열하는 섹션이고, GOT는 PLT에서 참조하는 테이블로 프로그램에서 호출되는 함수의 실제 주소를 저장할 수 있다. 네이티브 코드 상에서는 함수를 호출하는 경우, PLT 섹션을 참조하여 다른 라이브러리의 함수를 호출할 수 있다. 따라서 함수 호출 관계도 생성부(70)는 branch 명령어의 PLT를 참조하여 branch 명령어가 라이브러리 함수를 호출하는 관계를 추출할 수 있으며, 이를 토대로 네이티브 코드 상의 호출 주체(Caller)-호출 대상(Callee)의 함수 호출 관계를 추출할 수 있다.The function call relationship diagram generation unit 70 may analyze a branch instruction to extract a function call relationship in a native code. The Android operating system adopts the Dynamic Link method, which provides pre-built libraries. Dynamic Link is a shared library method that does not include library codes in executable files. The Dynamic Link method requires sections of a PLT (Procedure Linkable Table) and GOT (Global Offset Table). The PLT section is a section listing all functions called by the program, and the GOT is a table referenced by the PLT and can store the actual addresses of the functions called by the program. When calling functions in native code, you can call functions in other libraries by referring to the PLT section. Therefore, the function call relationship diagram generation unit 70 can extract the relationship in which the branch command calls the library function by referring to the PLT of the branch command, and based on this, the calling subject (Caller) in the native code-the call target (Callee) Function call relations can be extracted.

함수 호출 관계도 생성부(70)는 안드로이드 앱의 통합 호출 관계도를 생성하기 위해 자바 코드 상의 함수 호출 관계 및 네이티브 코드 상의 함수 호출 관계를 연결할 수 있다.The function call relationship diagram generator 70 may connect a function call relationship in Java code and a function call relationship in native code to generate an integrated call relationship diagram of an Android app.

함수 호출 관계도 생성부(70)는 자바 코드 상의 함수 호출 관계에 포함되는 호출 대상(Callee) 함수의 접근제한자(access flags)의 네이티브 플래그 포함 여부에 따라 자바 코드 상의 함수 호출 관계와 네이티브 코드 상의 함수 호출 관계를 연결할 수 있다. 호출 대상(Callee) 함수의 접근제한자에 네이티브 플래그가 포함되는 경우, 해당 함수는 네이티브 코드 상의 함수로 볼 수 있기 때문이다.The function call relationship diagram generation unit 70 includes the function call relationship in the Java code and the function call relationship in the native code according to whether or not the native flags of the access flags of the call target function included in the function call relationship in the Java code are included. You can link function call relationships. This is because if the callee function's access limiter includes a native flag, the function can be viewed as a function in native code.

예를 들면, 함수 호출 관계도 생성부(70)는 자바 코드 상의 함수 호출 관계에서 호출 대상(Callee) 함수의 접근제한자에 네이티브 플래그가 포함되는 경우, 네이티브 코드 상의 함수 호출 관계에서 해당 함수를 찾아 연결할 수 있다. 즉, 함수 호출 관계도 생성부(70)는 자바 코드로부터 네이티브 코드를 호출하는 관계를 포함하는 안드로이드 앱의 호출 관계도를 생성할 수 있다.For example, when a native flag is included in the access limiter of a call target function in the function call relationship in Java code, the function call relationship diagram generator 70 searches for the function in the function call relationship in the native code. I can connect. That is, the function call relationship diagram generation unit 70 may generate a call relationship diagram of an Android app including a relationship of calling a native code from a Java code.

한편, 도 2는 본 발명의 다른 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치의 블록도이다.Meanwhile, FIG. 2 is a block diagram of an apparatus for generating a call relationship diagram of an Android app according to another embodiment of the present invention.

본 발명의 다른 실시예에 따른 안드로이드 앱의 호출 관계도 생성 장치(2)는 도 1에 도시된 본 발명의 일 실시예에 다른 안드로이드 앱의 호출 관계도 생성 장치(1)와 비교하면, 시각화부(90)를 더 포함한다는 점에서 차이가 있을 뿐 나머지 다른 구성은 모두 동일하다. 따라서 이하에서는 시각화부(90)에 대해서만 설명하고 나머지 다른 구성에 대한 설명은 상술한 것으로 대체한다.The device 2 for generating a call relationship diagram of an Android app according to another embodiment of the present invention is compared with the device 1 for generating a call relationship diagram for another Android app according to the embodiment of the present invention shown in FIG. 1. There is a difference in that it further includes (90), but all other configurations are the same. Therefore, hereinafter, only the visualization unit 90 will be described, and the other components will be described above.

시각화부(90)는 함수 호출 관계도 생성부(70)에서 생성한 안드로이드 앱의 호출 관계도를 PDF 파일, DOT 파일 또는 Text 파일 형식으로 저장할 수 있다. 시각화부(90)는 안드로이드 앱의 호출 관계도를 PDF 파일, DOT 파일 또는 Text 파일 형식으로 저장하여 콜 그래프의 시각화를 달성할 수 있다.The visualization unit 90 may store the call relationship diagram of the Android app generated by the function call relationship diagram generation unit 70 in a PDF file, a DOT file, or a text file format. The visualization unit 90 may visualize a call graph by storing the call relationship diagram of the Android app in a PDF file, a DOT file, or a text file format.

이와 같은 본 발명의 안드로이드 앱의 호출 관계도 생성 장치는 자바 코드와 네이티브 코드 상의 호출 관계를 모두 표현하는 함수 호출 관계도를 생성할 수 있다. 본 발명의 안드로이드 앱의 호출 관계도 생성 장치는 DEX 파일 구조에 따라 자바 코드 상의 호출 관계를 추출함으로써 난독화가 적용된 안드로이드 앱의 함수 호출 관계를 파악할 수 있으며, 나아가 네이티브 코드 상의 호출 관계 또한 추출하여 자바 코드로부터 네이티브 코드를 호출하는 관계를 포함하는 안드로이드 앱의 호출 관계도를 생성할 수 있다. 이러한 안드로이드 앱의 호출 관계도는 안드로이드 앱의 동작 시퀀스 획득에 용이하게 사용될 수 있으며, 코드 상에서 실제로 전달되는 컨텐츠의 흐름 파악이 가능하여 자바 코드와 네이티브 코드 모두에서 사용되는 데이터 분석에 사용될 수 있을 것이다.The apparatus for generating a call relationship diagram of an Android app according to the present invention may generate a function call relationship diagram that expresses both a calling relationship in a Java code and a native code. The device for generating a call relationship diagram of an Android app according to the present invention can determine the function call relationship of an obfuscated Android app by extracting the call relationship in the Java code according to the DEX file structure, and further extract the call relationship in the native code to extract the Java code. You can create a call relationship diagram of an Android app that includes the relationship calling native code from. The call relationship diagram of the Android app can be easily used to obtain the operation sequence of the Android app, and it is possible to grasp the flow of content actually delivered in the code, and thus can be used for data analysis used in both Java code and native code.

이하 도 3을 참조하여 본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 방법에 대하여 설명한다.Hereinafter, a method of generating a call relationship diagram of an Android app according to an embodiment of the present invention will be described with reference to FIG. 3.

도 3은 본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 방법의 흐름도이다.3 is a flowchart of a method for generating a call relationship diagram of an Android app according to an embodiment of the present invention.

본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 방법은 도 2에 도시된 본 발명의 다른 실시예에 다른 안드로이드 앱의 호출 관계도 생성 장치(2)와 실질적으로 동일한 구성에서 진행될 수 있다. 따라서 도 2의 장치(2)와 동일한 구성요소는 동일한 도면부호를 부여하고, 반복되는 설명은 생략한다.The method for generating a call relationship diagram of an Android app according to an embodiment of the present invention may be performed in substantially the same configuration as the device 2 for generating a call relationship diagram of an Android app according to another embodiment of the present invention shown in FIG. 2. . Accordingly, the same components as those of the device 2 of FIG. 2 are given the same reference numerals, and repeated descriptions are omitted.

도 3을 참조하면, 안드로이드 앱 분석부(10)는 안드로이드 앱의 DEX 파일 및 SO 파일을 추출할 수 있다(S100).Referring to FIG. 3, the Android app analysis unit 10 may extract a DEX file and an SO file of an Android app (S100).

안드로이드 앱 분석부(10)는 안드로이드 앱의 압축을 해제하고, DEX 파일과 SO 파일을 탐색하여 추출할 수 있다.The Android app analysis unit 10 may decompress the Android app, search for and extract DEX files and SO files.

DEX 파일 분석부(30)는 DEX 파일에서 Dalvik 명령어를 추출할 수 있다(S200).The DEX file analysis unit 30 may extract a Dalvik command from the DEX file (S200).

DEX 파일 분석부(30)는 DEX 파일의 구조를 분석하여 DEX 파일에서 Dalvik 명령어를 추출할 수 있다.The DEX file analysis unit 30 may analyze the structure of the DEX file and extract Dalvik commands from the DEX file.

SO 파일 분석부(50)는 SO 파일에서 ARM 명령어를 추출할 수 있다(S300).The SO file analysis unit 50 may extract an ARM instruction from the SO file (S300).

SO 파일 분석부(50)는 SO 파일의 코드 섹션을 ARM 명령어로 디컴파일하여 ARM 명령어를 추출할 수 있다.The SO file analysis unit 50 may extract the ARM instruction by decompiling the code section of the SO file into the ARM instruction.

함수 호출 관계도 생성부(70)는 Dalvik 명령어로부터 안드로이드 앱의 자바 코드 상의 함수 호출 관계를 추출할 수 있다(S400).The function call relationship diagram generator 70 may extract a function call relationship in the Java code of the Android app from the Dalvik command (S400).

함수 호출 관계도 생성부(70)는 Dalvik 명령어 중 다른 함수를 호출하는 invoke 명령어를 추출할 수 있다. 함수 호출 관계도 생성부(70)는 invoke 명령어를 분석하여 자바 코드 상의 함수 호출 관계를 추출할 수 있다. invoke 명령어의 인자는 호출 대상(Callee)이 되는 함수 타입에 대한 offset 값을 가지므로, 함수 호출 관계도 생성부(70)는 이러한 invoke 명령어의 인자를 분석하여 invoke 명령어의 호출 대상인 함수의 소속 클래스와 함수명, 파라미터와 리턴 타입을 획득할 수 있으며, 이를 토대로 자바 코드 상의 호출 주체(Caller)-호출 대상(Callee)의 함수 호출 관계를 추출할 수 있다.The function call relationship diagram generation unit 70 may extract an invoke command that calls another function from among Dalvik commands. The function call relationship diagram generator 70 may analyze the invoke command to extract a function call relationship in Java code. Since the argument of the invoke command has an offset value for the function type to be called, the function call relationship diagram generator 70 analyzes the arguments of the invoke command to identify the class belonging to the function that is the target of the invoke command. The function name, parameters, and return type can be obtained, and based on this, the function call relationship between the calling subject (Caller) and the called target (Callee) in the Java code can be extracted.

함수 호출 관계도 생성부(70)는 ARM 명령어로부터 안드로이드 앱의 네이티브 코드 상의 함수 호출 관계를 추출할 수 있다(S500).The function call relationship diagram generator 70 may extract a function call relationship in the native code of the Android app from the ARM instruction (S500).

함수 호출 관계도 생성부(70)는 ARM 명령어 중 다른 함수를 호출하는 branch 명령어를 추출할 수 있다. 함수 호출 관계도 생성부(70)는 branch 명령어를 분석하여 네이티브 코드 상의 함수 호출 관계를 추출할 수 있다. 안드로이드 운영체제에서는 미리 빌드된 라이브러리를 제공하는 Dynamic Link 방식을 채택하고 있는데, Dynamic Link는 실행파일에서 라이브러리 코드를 포함하지 않도록 하는 공유 라이브러리 방식이다. Dynamic Link 방식은 PLT(Procedure Linkable Table) 및 GOT(Global Offset Table)을 섹션을 필요로 한다. PLT 섹션은 프로그램이 호출하는 모든 함수를 나열하는 섹션이고, GOT는 PLT에서 참조하는 테이블로 프로그램에서 호출되는 함수의 실제 주소를 저장할 수 있다. 네이티브 코드 상에서는 함수를 호출하는 경우, PLT 섹션을 참조하여 다른 라이브러리의 함수를 호출할 수 있다. 따라서 함수 호출 관계도 생성부(70)는 branch 명령어의 PLT를 참조하여 branch 명령어가 라이브러리 함수를 호출하는 관계를 추출할 수 있으며, 이를 토대로 네이티브 코드 상의 호출 주체(Caller)-호출 대상(Callee)의 함수 호출 관계를 추출할 수 있다.The function call relationship diagram generator 70 may extract a branch instruction that calls another function from among ARM instructions. The function call relationship diagram generation unit 70 may analyze a branch instruction to extract a function call relationship in a native code. The Android operating system adopts the Dynamic Link method, which provides pre-built libraries. Dynamic Link is a shared library method that does not include library codes in executable files. The Dynamic Link method requires sections of a PLT (Procedure Linkable Table) and GOT (Global Offset Table). The PLT section is a section listing all functions called by the program, and the GOT is a table referenced by the PLT and can store the actual addresses of the functions called by the program. When calling functions in native code, you can call functions in other libraries by referring to the PLT section. Therefore, the function call relationship diagram generation unit 70 can extract the relationship in which the branch command calls the library function by referring to the PLT of the branch command, and based on this, the calling subject (Caller) in the native code-the call target (Callee) Function call relations can be extracted.

함수 호출 관계도 생성부(70)는 자바 코드 상의 함수 호출 관계와 네이티브 코드 상의 함수 호출 관계를 연결하여 안드로이드 앱의 호출 관계도를 생성할 수 있다(S600).The function call relationship diagram generation unit 70 may generate a call relationship diagram of the Android app by connecting the function call relationship in the Java code and the function call relationship in the native code (S600).

함수 호출 관계도 생성부(70)는 안드로이드 앱의 통합 호출 관계도를 생성하기 위해 자바 코드 상의 함수 호출 관계 및 네이티브 코드 상의 함수 호출 관계를 연결할 수 있다.The function call relationship diagram generator 70 may connect a function call relationship in Java code and a function call relationship in native code to generate an integrated call relationship diagram of an Android app.

함수 호출 관계도 생성부(70)는 자바 코드 상의 함수 호출 관계에 포함되는 호출 대상(Callee) 함수의 접근제한자(access flags)의 네이티브 플래그 포함 여부에 따라 자바 코드 상의 함수 호출 관계와 네이티브 코드 상의 함수 호출 관계를 연결할 수 있다. 호출 대상(Callee) 함수의 접근제한자에 네이티브 플래그가 포함되는 경우, 해당 함수는 네이티브 코드 상의 함수로 볼 수 있기 때문이다.The function call relationship diagram generation unit 70 includes the function call relationship in the Java code and the function call relationship in the native code according to whether or not the native flags of the access flags of the call target function included in the function call relationship in the Java code are included. You can link function call relationships. This is because if the callee function's access limiter includes a native flag, the function can be viewed as a function in native code.

예를 들면, 함수 호출 관계도 생성부(70)는 자바 코드 상의 함수 호출 관계에서 호출 대상(Callee) 함수의 접근제한자에 네이티브 플래그가 포함되는 경우, 네이티브 코드 상의 함수 호출 관계에서 해당 함수를 찾아 연결할 수 있다. 즉, 함수 호출 관계도 생성부(70)는 자바 코드로부터 네이티브 코드를 호출하는 관계를 포함하는 안드로이드 앱의 호출 관계도를 생성할 수 있다.For example, when a native flag is included in the access limiter of a call target function in the function call relationship in Java code, the function call relationship diagram generator 70 searches for the function in the function call relationship in the native code. I can connect. That is, the function call relationship diagram generation unit 70 may generate a call relationship diagram of an Android app including a relationship of calling a native code from a Java code.

시각화부(90)는 안드로이드 앱의 호출 관계도를 PDF 파일 또는 DOT 파일 형식으로 저장할 수 있다(S700).The visualization unit 90 may store the call relationship diagram of the Android app in the form of a PDF file or a DOT file (S700).

시각화부(90)는 안드로이드 앱의 호출 관계도를 PDF 파일, DOT 파일 또는 Text 파일 형식으로 저장하여 콜 그래프의 시각화를 달성할 수 있다.The visualization unit 90 may visualize a call graph by storing the call relationship diagram of the Android app in a PDF file, a DOT file, or a text file format.

이와 같은 본 발명의 일 실시예에 따른 안드로이드 앱의 호출 관계도 생성 방법은 어플리케이션으로 구현되거나 다양한 컴퓨터 구성요소를 통하여 수행될 수 있는 프로그램 명령어의 형태로 구현되어 컴퓨터 판독 가능한 기록 매체에 기록될 수 있다. 상기 컴퓨터 판독 가능한 기록 매체는 프로그램 명령어, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다.The method for generating a call relationship diagram of an Android app according to an embodiment of the present invention may be implemented as an application or implemented in the form of a program command that can be executed through various computer components and recorded in a computer-readable recording medium. . The computer-readable recording medium may include program instructions, data files, data structures, etc. alone or in combination.

상기 컴퓨터 판독 가능한 기록 매체에 기록되는 프로그램 명령어는 본 발명을 위하여 특별히 설계되고 구성된 것들이거니와 컴퓨터 소프트웨어 분야의 당업자에게 공지되어 사용 가능한 것일 수도 있다.The program instructions recorded in the computer-readable recording medium may be specially designed and constructed for the present invention, and may be known and usable to those skilled in the computer software field.

컴퓨터 판독 가능한 기록 매체의 예에는, 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM, DVD 와 같은 광기록 매체, 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical media), 및 ROM, RAM, 플래시 메모리 등과 같은 프로그램 명령어를 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다.Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes, optical recording media such as CD-ROMs and DVDs, and magnetic-optical media such as floptical disks. media), and a hardware device specially configured to store and execute program instructions such as ROM, RAM, flash memory, and the like.

프로그램 명령어의 예에는, 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드도 포함된다. 상기 하드웨어 장치는 본 발명에 따른 처리를 수행하기 위해 하나 이상의 소프트웨어 모듈로서 작동하도록 구성될 수 있으며, 그 역도 마찬가지이다.Examples of the program instructions include not only machine language codes such as those produced by a compiler, but also high-level language codes that can be executed by a computer using an interpreter or the like. The hardware device may be configured to operate as one or more software modules to perform processing according to the present invention, and vice versa.

이상에서는 실시예들을 참조하여 설명하였지만, 해당 기술 분야의 숙련된 당업자는 하기의 특허 청구범위에 기재된 본 발명의 사상 및 영역으로부터 벗어나지 않는 범위 내에서 본 발명을 다양하게 수정 및 변경시킬 수 있음을 이해할 수 있을 것이다.Although the above has been described with reference to embodiments, those skilled in the art will understand that various modifications and changes can be made to the present invention without departing from the spirit and scope of the present invention described in the following claims. I will be able to.

1: 안드로이드 앱의 호출 관계도 생성 장치
10: 안드로이드 앱 분석부
30: DEX 파일 분석부
50: SO 파일 분석부
70: 함수 호출 관계도 생성부
1: Device for generating call relationship diagram of Android app
10: Android app analysis unit
30: DEX file analysis unit
50: SO file analysis unit
70: function call relationship diagram generator

Claims (11)

안드로이드 앱의 DEX(Dalvik Excutable) 파일 및 SO(Shared Object) 파일을 추출하는 안드로이드 앱 분석부;
상기 DEX 파일의 구조를 분석하여 상기 DEX 파일에서 Dalvik 명령어를 추출하는 DEX 파일 분석부;
상기 SO 파일에서 ARM 명령어를 추출하는 SO 파일 분석부; 및
상기 Dalvik 명령어로부터 상기 안드로이드 앱의 자바(Java) 코드 상의 함수 호출 관계를 추출하고, 상기 ARM 명령어로부터 상기 안드로이드 앱의 네이티브(Native) 코드 상의 함수 호출 관계를 추출하며, 상기 자바 코드 상의 함수 호출 관계 및 상기 네이티브 코드 상의 함수 호출 관계를 연결하여 상기 안드로이드 앱의 호출 관계도를 생성하는 함수 호출 관계도 생성부;를 포함하며,
상기 함수 호출 관계도 생성부는,
상기 Dalvik 명령어 중 다른 함수를 호출하는 invoke 명령어를 추출하고, 상기 invoke 명령어의 인자를 분석하여 상기 자바 코드 상의 함수 호출 관계를 추출하는, 안드로이드 앱의 호출 관계도 생성 장치.
An Android app analysis unit that extracts DEX (Dalvik Excutable) files and SO (Shared Object) files of the Android app;
A DEX file analysis unit that analyzes the structure of the DEX file and extracts a Dalvik command from the DEX file;
An SO file analysis unit extracting an ARM instruction from the SO file; And
Extracting a function call relationship in Java code of the Android app from the Dalvik instruction, extracting a function call relationship in native code of the Android app from the ARM command, and a function call relationship in the Java code and Includes; a function call relationship diagram generating unit for generating a call relationship diagram of the Android app by connecting the function call relationship on the native code, and
The function call relationship diagram generation unit,
An apparatus for generating a call relationship of an Android app, which extracts an invoke command that calls another function among the Dalvik commands, analyzes an argument of the invoke command, and extracts a function call relationship in the Java code.
제1항에 있어서,
상기 안드로이드 앱의 호출 관계도를 시각화할 수 있도록 PDF 파일 또는 DOT 파일 형식으로 저장하는 시각화부;를 더 포함하는, 안드로이드 앱의 호출 관계도 생성 장치.
The method of claim 1,
A visualization unit for storing a PDF file or a DOT file format to visualize the call relationship diagram of the Android app; further comprising, a call relationship diagram generating device for an Android app.
삭제delete 제1항에 있어서,
상기 함수 호출 관계도 생성부는,
상기 ARM 명령어 중 다른 함수를 호출하는 branch 명령어를 추출하고, 상기 branch 명령어의 인자를 분석하여 상기 네이티브 코드 상의 함수 호출 관계를 추출하는, 안드로이드 앱의 호출 관계도 생성 장치.
The method of claim 1,
The function call relationship diagram generation unit,
An apparatus for generating a call relationship of an Android app, which extracts a branch command calling another function from among the ARM commands, and extracts a function call relationship on the native code by analyzing an argument of the branch command.
제1항에 있어서,
상기 함수 호출 관계도 생성부는,
상기 자바 코드 상의 함수 호출 관계에 포함되는 호출 대상(callee) 함수의 접근제한자(access flags)의 네이티브 플래그 포함 여부에 따라 상기 자바 코드 상의 함수 호출 관계와 상기 네이티브 코드 상의 함수 호출 관계를 연결하여 자바 코드로부터 네이티브 코드를 호출하는 관계를 포함하는 상기 안드로이드 앱의 호출 관계도를 생성하는, 안드로이드 앱의 호출 관계도 생성 장치.
The method of claim 1,
The function call relationship diagram generation unit,
Java by connecting the function call relationship in the Java code and the function call relationship in the native code according to whether or not the native flag of the access flags of the call target function included in the function call relationship in the Java code is included. An apparatus for generating a calling relationship diagram of an Android app, which generates a calling relationship diagram of the Android app including a relationship calling a native code from a code.
안드로이드 앱의 DEX(Dalvik Excutable) 파일 및 SO(Shared Object) 파일을 추출하는 안드로이드 앱 분석 단계;
상기 DEX 파일의 구조를 분석하여 상기 DEX 파일에서 Dalvik 명령어를 추출하는 DEX 파일 분석 단계;
상기 SO 파일에서 ARM 명령어를 추출하는 SO 파일 분석 단계; 및
상기 Dalvik 명령어로부터 상기 안드로이드 앱의 자바(Java) 코드 상의 함수 호출 관계를 추출하고, 상기 ARM 명령어로부터 상기 안드로이드 앱의 네이티브(Native) 코드 상의 함수 호출 관계를 추출하며, 상기 자바 코드 상의 함수 호출 관계 및 상기 네이티브 코드 상의 함수 호출 관계를 연결하여 상기 안드로이드 앱의 호출 관계도를 생성하는 함수 호출 관계도 생성 단계;를 포함하며,
상기 함수 호출 관계도 생성 단계는,
상기 Dalvik 명령어 중 다른 함수를 호출하는 invoke 명령어를 추출하는 단계; 및
상기 invoke 명령어의 인자를 분석하여 상기 자바 코드 상의 함수 호출 관계를 추출하는 단계;를 포함하는, 안드로이드 앱의 호출 관계도 생성 방법.
Android app analysis step of extracting DEX (Dalvik Excutable) files and SO (Shared Object) files of the Android app;
Analyzing the structure of the DEX file and extracting a Dalvik command from the DEX file;
An SO file analysis step of extracting an ARM instruction from the SO file; And
Extracting a function call relationship in Java code of the Android app from the Dalvik instruction, extracting a function call relationship in native code of the Android app from the ARM command, and a function call relationship in the Java code and Including; a function call relationship diagram generating step of generating a call relationship diagram of the Android app by connecting the function call relationship on the native code; and
The step of generating the function call relationship diagram,
Extracting an invoke instruction that calls another function among the Dalvik instructions; And
Analyzing the argument of the invoke command to extract a function call relationship in the Java code; Containing, a method for generating a call relationship diagram of an Android app.
제6항에 있어서,
상기 안드로이드 앱의 호출 관계도를 콜 그래프(Call Graph)로 시각화할 수 있도록 PDF 파일 또는 DOT 파일 형식으로 저장하는 시각화 단계;를 더 포함하는, 안드로이드 앱의 호출 관계도 생성 방법.
The method of claim 6,
A visualization step of storing the call relationship diagram of the Android app in a PDF file or DOT file format so that the call graph can be visualized as a call graph; further comprising, a method for generating a call relationship diagram of an Android app.
삭제delete 제6항에 있어서,
상기 함수 호출 관계도 생성 단계는,
상기 ARM 명령어 중 다른 함수를 호출하는 branch 명령어를 추출하는 단계; 및
상기 branch 명령어의 인자를 분석하여 상기 네이티브 코드 상의 함수 호출 관계를 추출하는 단계;를 더 포함하는, 안드로이드 앱의 호출 관계도 생성 방법.
The method of claim 6,
The step of generating the function call relationship diagram,
Extracting a branch instruction calling another function from among the ARM instructions; And
Analyzing the argument of the branch command and extracting a function call relationship on the native code; further comprising, a method for generating a call relationship of an Android app.
제6항에 있어서,
상기 함수 호출 관계도 생성 단계는,
상기 자바 코드 상의 함수 호출 관계에 포함되는 호출 대상(callee) 함수의 접근제한자(access flags)를 확인하는 단계; 및
상기 호출 대상 함수의 접근제한자가 네이티브 플래그를 포함하는 경우, 상기 호출 대상 함수와 상기 네이티브 플래그에 해당하는 네이티브 코드 상의 함수를 연결하여 자바 코드로부터 네이티브 코드를 호출하는 관계를 포함하는 상기 안드로이드 앱의 호출 관계도를 생성하는 단계;를 더 포함하는, 안드로이드 앱의 호출 관계도 생성 방법.
The method of claim 6,
The step of generating the function call relationship diagram,
Checking access flags of a call target function included in a function call relationship in the Java code; And
When the access limiter of the called function includes a native flag, calling the Android app including the relationship of calling the native code from the Java code by connecting the called function and a function on the native code corresponding to the native flag Generating a relationship diagram; further comprising, a method of generating a call relationship diagram of an Android app.
제6항에 따른 안드로이드 앱의 호출 관계도 생성 방법을 수행하기 위한, 컴퓨터 프로그램이 기록된 컴퓨터로 판독 가능한 기록 매체. A computer-readable recording medium in which a computer program is recorded for performing the method for generating a call relationship diagram of an Android app according to claim 6.
KR1020190007853A 2018-11-21 2019-01-22 Method of call graph extraction in android apps, recording medium and apparatus for performing the method KR102176742B1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR20180144745 2018-11-21
KR1020180144745 2018-11-21

Publications (2)

Publication Number Publication Date
KR20200060180A KR20200060180A (en) 2020-05-29
KR102176742B1 true KR102176742B1 (en) 2020-11-09

Family

ID=70912076

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020190007853A KR102176742B1 (en) 2018-11-21 2019-01-22 Method of call graph extraction in android apps, recording medium and apparatus for performing the method

Country Status (1)

Country Link
KR (1) KR102176742B1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11928220B2 (en) 2021-01-29 2024-03-12 Foundation Of Soongsil University-Industry Cooperation Method for evaluating risk of data leakage in application, recording medium and device for performing the method
KR102416292B1 (en) * 2021-01-29 2022-07-01 숭실대학교 산학협력단 Dynamic analysis method for android applications, recording medium and device for performing the method
KR102314829B1 (en) * 2021-01-29 2021-10-18 숭실대학교산학협력단 Method for evaluating risk of data leakage in application, recording medium and device for performing the method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011170749A (en) * 2010-02-22 2011-09-01 Fujitsu Ltd Simulation device and simulation method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9420031B2 (en) * 2013-01-15 2016-08-16 Microsoft Technology Licensing, Llc Systems and methods for building and using hybrid mobile applications
KR101583932B1 (en) * 2014-05-20 2016-01-11 한양대학교 산학협력단 Signature generation apparatus for generating signature of program and the method, malicious code detection apparatus for detecting malicious code of signature and the method
KR20160025881A (en) * 2014-08-28 2016-03-09 주식회사 안랩 Apparatus and method for detecting malicious shared library file

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011170749A (en) * 2010-02-22 2011-09-01 Fujitsu Ltd Simulation device and simulation method

Also Published As

Publication number Publication date
KR20200060180A (en) 2020-05-29

Similar Documents

Publication Publication Date Title
KR102176742B1 (en) Method of call graph extraction in android apps, recording medium and apparatus for performing the method
CN110414261B (en) Data desensitization method, device, equipment and readable storage medium
Lin et al. Automated forensic analysis of mobile applications on Android devices
KR101857001B1 (en) Android dynamic loading file extraction method, recording medium and system for performing the method
KR101545272B1 (en) Method for Binary Obfuscating of Dalvix Executable File in Android
CN110929234B (en) Python program encryption protection system and method based on code virtualization
CN105574411A (en) Dynamic unshelling method, device and equipment
CN107678748B (en) Source code file compiling method and device
KR101861341B1 (en) Deobfuscation apparatus of application code and method of deobfuscating application code using the same
CN107015841B (en) Preprocessing method for program compiling and program compiling device
KR101356676B1 (en) Translating expressions in a computing environment
Chen et al. DroidCIA: A novel detection method of code injection attacks on HTML5-based mobile apps
CN111008151B (en) Program scanning method, terminal device and computer readable storage medium
CN112612502A (en) Patch generation method, device, equipment and storage medium
CN111782239B (en) Method, device and storage medium for software packaging and source code version information acquisition
CN112214736A (en) Code encryption method and related assembly
CN105786465A (en) Scripting language execution method and device
CN110032838B (en) Script file reinforcement method, device and equipment
Ascia et al. Making android apps data-leak-safe by data flow analysis and code injection
CN110472425A (en) Unity plug-in unit encryption method based on Mono, storage medium
KR102314829B1 (en) Method for evaluating risk of data leakage in application, recording medium and device for performing the method
CN111796832B (en) Hot patch file generation method, device, equipment and storage medium
CN114417347A (en) Vulnerability detection method, device, equipment, storage medium and program of application program
CN109445798B (en) LuaJIT byte code processing method, device and storage medium
CN111310133A (en) Script obfuscating method and device

Legal Events

Date Code Title Description
E701 Decision to grant or registration of patent right
GRNT Written decision to grant