├── .gitignore ├── .idea ├── .gitignore ├── AndroidReverseEngineering.iml ├── inspectionProfiles │ └── profiles_settings.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── FridaDexDump ├── README.md ├── __init__.py ├── agent.js └── main.py ├── Frida_Dump ├── README.md ├── dump_dex.js ├── dump_dex_class.js └── dump_so.js ├── Ghidra ├── README.md └── src │ └── png │ ├── 01_ghidra运行.png │ ├── 02_Ghidra运行成功.png │ ├── 03_使用步骤.png │ ├── 04_创建项目.png │ ├── 05_创建个人项目.png │ ├── 06_路径设置.png │ ├── 07_0项目创建好后.png │ ├── 07_1导入需要分析的项目.png │ ├── 07_2_1设置选项.png │ ├── 07_2加载需要分析的文件.png │ ├── 07_3设置好后点OK.png │ ├── 07_4会弹出分析程序的信息.png │ ├── 07_5是否开始分析程序.png │ ├── 07_6默认设置就好.png │ ├── 08_加载需要分析的程序.png │ ├── 09_双击加载程序.png │ ├── 10_加载画面.png │ ├── 11_加载成功画面.png │ └── 13完成.png ├── Jadx ├── README.md └── src │ └── png │ ├── 01运行.png │ ├── 02选择需要分析的APK.png │ ├── 03APP源文件结构和代码.png │ ├── 04查找关键字.png │ └── 05success.png ├── LICENSE ├── README.md └── ReadElf ├── README.md ├── readelf.py └── result.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /.idea/AndroidReverseEngineering.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /FridaDexDump/README.md: -------------------------------------------------------------------------------- 1 | # FridaDexDump 2 | 基于frida的内存搜索动态脱壳 3 | 4 | Fast search and dump dex on memory. 5 | 6 | ## Features 7 | 1. support fuzzy search no-magic dex. (eg: baidu protect) 8 | 2. auto fill magic into dex-header. 9 | 3. compatible with full android version(frida supported). 10 | 4. support loading as objection plugin~ 11 | 12 | ## Usage 13 | 1. update your frida-server and frida python binding to latest. 14 | 2. launch app. 15 | 3. run: python main.py. 16 | 4. check `SavePath`. 17 | 18 | 19 | -------------------------------------------------------------------------------- /FridaDexDump/__init__.py: -------------------------------------------------------------------------------- 1 | # Author: hluwa 2 | # HomePage: https://github.com/hluwa 3 | # CreatedTime: 2020/3/5 19:14 4 | 5 | 6 | __description__ = "a objection plugin to fast search and dump dex on memory." 7 | 8 | from objection.state.connection import state_connection 9 | from objection.utils.plugin import Plugin 10 | 11 | from .main import * 12 | 13 | 14 | class DEXDump(Plugin): 15 | 16 | def __init__(self, ns): 17 | """ 18 | Creates a new instance of the plugin 19 | :param ns: 20 | """ 21 | 22 | self.script_path = os.path.join(os.path.dirname(__file__), "agent.js") 23 | 24 | implementation = { 25 | 'meta': 'fast search and dump dex on memory.', 26 | 'commands': { 27 | 'search': { 28 | 'meta': 'search all dex', 29 | 'exec': self.search 30 | }, 31 | 'dump': { 32 | 'meta': 'dump all dex', 33 | 'exec': self.dump 34 | } 35 | } 36 | } 37 | 38 | super().__init__(__file__, ns, implementation) 39 | 40 | self.inject() 41 | 42 | def search(self, args=None): 43 | main.search(self.api) 44 | 45 | def dump(self, args=None): 46 | """ 47 | """ 48 | main.dump(state_connection.gadget_name, self.api) 49 | 50 | 51 | namespace = 'dexdump' 52 | plugin = DEXDump 53 | -------------------------------------------------------------------------------- /FridaDexDump/agent.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: hluwa 3 | * HomePage: https://github.com/hluwa 4 | * CreatedTime: 2020/1/7 20:44 5 | * */ 6 | 7 | 8 | var enable_deep_search = false; 9 | 10 | function verify_by_maps(dexptr, mapsptr) { 11 | var maps_offset = dexptr.add(0x34).readUInt(); 12 | var maps_size = mapsptr.readUInt(); 13 | for (var i = 0; i < maps_size; i++) { 14 | var item_type = mapsptr.add(4 + i * 0xC).readU16(); 15 | if (item_type === 4096) { 16 | var map_offset = mapsptr.add(4 + i * 0xC + 8).readUInt(); 17 | if (maps_offset === map_offset) { 18 | return true; 19 | } 20 | } 21 | } 22 | return false; 23 | } 24 | 25 | function verify(dexptr, range, enable_verify_maps) { 26 | 27 | if (range != null) { 28 | var range_end = range.base.add(range.size); 29 | // verify header_size 30 | if (dexptr.add(0x70) > range_end) { 31 | return false; 32 | } 33 | 34 | // verify file_size 35 | var dex_size = dexptr.add(0x20).readUInt(); 36 | if (dexptr.add(dex_size) > range_end) { 37 | return false; 38 | } 39 | 40 | if (enable_verify_maps) { 41 | var maps_offset = dexptr.add(0x34).readUInt(); 42 | if (maps_offset === 0) { 43 | return false 44 | } 45 | 46 | var maps_address = dexptr.add(maps_offset); 47 | if (maps_address > range_end) { 48 | return false 49 | } 50 | 51 | var maps_size = maps_address.readUInt(); 52 | if (maps_size < 2 || maps_size > 50) { 53 | return false 54 | } 55 | var maps_end = maps_address.add(maps_size * 0xC + 4); 56 | if (maps_end < range.base || maps_end > range_end) { 57 | return false 58 | } 59 | return verify_by_maps(dexptr, maps_address) 60 | } else { 61 | return dexptr.add(0x3C).readUInt() === 0x70; 62 | } 63 | } 64 | 65 | 66 | } 67 | 68 | rpc.exports = { 69 | memorydump: function memorydump(address, size) { 70 | return new NativePointer(address).readByteArray(size); 71 | }, 72 | scandex: function scandex() { 73 | var result = []; 74 | Process.enumerateRanges('r--').forEach(function (range) { 75 | try { 76 | Memory.scanSync(range.base, range.size, "64 65 78 0a 30 ?? ?? 00").forEach(function (match) { 77 | 78 | if (range.file && range.file.path 79 | && (// range.file.path.startsWith("/data/app/") || 80 | range.file.path.startsWith("/data/dalvik-cache/") || 81 | range.file.path.startsWith("/system/"))) { 82 | return; 83 | } 84 | 85 | if (verify(match.address, range, false)) { 86 | var dex_size = match.address.add(0x20).readUInt(); 87 | result.push({ 88 | "addr": match.address, 89 | "size": dex_size 90 | }); 91 | } 92 | }); 93 | 94 | if (enable_deep_search) { 95 | Memory.scanSync(range.base, range.size, "70 00 00 00").forEach(function (match) { 96 | var dex_base = match.address.sub(0x3C); 97 | if (dex_base < range.base) { 98 | return 99 | } 100 | if (dex_base.readCString(4) != "dex\n" && verify(dex_base, range, true)) { 101 | var dex_size = dex_base.add(0x20).readUInt(); 102 | result.push({ 103 | "addr": dex_base, 104 | "size": dex_size 105 | }); 106 | } 107 | }) 108 | } else { 109 | if (range.base.readCString(4) != "dex\n" && verify(range.base, range, true)) { 110 | var dex_size = range.base.add(0x20).readUInt(); 111 | result.push({ 112 | "addr": range.base, 113 | "size": dex_size 114 | }); 115 | } 116 | } 117 | 118 | } catch (e) { 119 | } 120 | }); 121 | 122 | return result; 123 | } 124 | }; 125 | -------------------------------------------------------------------------------- /FridaDexDump/main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # !/usr/bin/env python 3 | 4 | import os 5 | import sys 6 | import click 7 | import frida 8 | import logging 9 | 10 | logging.basicConfig(level=logging.INFO, 11 | format="%(asctime)s %(levelname)s %(message)s", 12 | datefmt='%m-%d/%H:%M:%S') 13 | 14 | 15 | def get_all_process(device, pkgname): 16 | return [process for process in device.enumerate_processes() if process.name == pkgname] 17 | 18 | 19 | def search(api, args=None): 20 | """ 21 | """ 22 | 23 | matches = api.scandex() 24 | for info in matches: 25 | click.secho("[DEXDump] Found: DexAddr={}, DexSize={}" 26 | .format(info['addr'], hex(info['size'])), fg='green') 27 | return matches 28 | 29 | 30 | def dump(pkg_name, api): 31 | """ 32 | """ 33 | matches = api.scandex() 34 | for info in matches: 35 | try: 36 | bs = api.memorydump(info['addr'], info['size']) 37 | if not os.path.exists("./" + pkg_name + "/"): 38 | os.mkdir("./" + pkg_name + "/") 39 | if bs[:4] != "dex\n": 40 | bs = b"dex\n035\x00" + bs[8:] 41 | with open(pkg_name + "/" + info['addr'] + ".dex", 'wb') as out: 42 | out.write(bs) 43 | click.secho("[DEXDump]: DexSize={}, SavePath={}/{}/{}.dex" 44 | .format(hex(info['size']), os.getcwd(), pkg_name, info['addr']), fg='green') 45 | except Exception as e: 46 | click.secho("[Except] - {}: {}".format(e, info), bg='yellow') 47 | 48 | 49 | if __name__ == "__main__": 50 | try: 51 | device = frida.get_usb_device() 52 | except: 53 | device = frida.get_remote_device() 54 | target = device.get_frontmost_application() 55 | pkg_name = target.identifier 56 | 57 | processes = get_all_process(device, pkg_name) 58 | if len(processes) == 1: 59 | target = processes[0] 60 | else: 61 | s_processes = "" 62 | for index in range(len(processes)): 63 | s_processes += "\t[{}] {}\n".format(index, str(processes[index])) 64 | input_id = int(input("[{}] has multiprocess: \n{}\nplease choose target process: " 65 | .format(pkg_name, s_processes))) 66 | target = processes[input_id] 67 | try: 68 | for index in range(len(processes)): 69 | if index == input_id: 70 | os.system("adb shell \"su -c 'kill -18 {}'\"".format(processes[index].pid)) 71 | else: 72 | os.system("adb shell \"su -c 'kill -19 {}'\"".format(processes[index].pid)) 73 | except: 74 | pass 75 | 76 | logging.info("[DEXDump]: found target [{}] {}".format(target.pid, pkg_name)) 77 | session = device.attach(target.pid) 78 | path = os.path.dirname(sys.argv[0]) 79 | path = path if path else "." 80 | script = session.create_script(open(path + "/agent.js").read()) 81 | script.load() 82 | 83 | dump(pkg_name, script.exports) 84 | -------------------------------------------------------------------------------- /Frida_Dump/README.md: -------------------------------------------------------------------------------- 1 | # frida_dump 2 | 3 | 基于具有root权限的安卓手机采用frida脱壳和获取so文件 4 | 5 | ## 1. 使用dump_so 6 | 7 | ```Text 8 | > frida -U packagename -l dump_so.js 9 | ____ 10 | / _ | Frida 12.4.8 - A world-class dynamic instrumentation toolkit 11 | | (_| | 12 | > _ | Commands: 13 | /_/ |_| help -> Displays the help system 14 | . . . . object? -> Display information about 'object' 15 | . . . . exit/quit -> Exit 16 | . . . . 17 | . . . . More info at http://www.frida.re/docs/home/ 18 | 19 | [LGE AOSP on HammerHead::packagename]-> dump_so("name.so") 20 | [name]: name.so 21 | [base]: 0x99adf000 22 | [size]: 0x2d4000 23 | [path]: /data/app/packagename-2/lib/arm/name.so 24 | [dump]: /data/user/0/packagename/files/name.so_0x99adf000_0x2d4000.so 25 | undefined 26 | [LGE AOSP on HammerHead::packagename]-> 27 | ``` 28 | 29 | ## 2. 使用dump_dex 30 | 31 | 更新了查找DefineClass的函数签名 32 | 33 | ```Text 34 | frida -U --no-pause -f packagename -l dump_dex.js 35 | ____ 36 | / _ | Frida 12.4.8 - A world-class dynamic instrumentation toolkit 37 | | (_| | 38 | > _ | Commands: 39 | /_/ |_| help -> Displays the help system 40 | . . . . object? -> Display information about 'object' 41 | . . . . exit/quit -> Exit 42 | . . . . 43 | . . . . More info at http://www.frida.re/docs/home/ 44 | Spawned `packagename`. Resuming main thread! 45 | [Google Pixel XL::packagename]-> [dlopen:] libart.so 46 | _ZN3art11ClassLinker11DefineClassEPNS_6ThreadEPKcmNS_6HandleINS_6mirror11ClassLoaderEEERKNS_7DexFileERKNS9_8ClassDefE 0x7ac6dc4f74 47 | [DefineClass:] 0x7ac6dc4f74 48 | [dump dex]: /data/data/packagename/files/7aab800000_8341c4.dex 49 | ``` 50 | -------------------------------------------------------------------------------- /Frida_Dump/dump_dex.js: -------------------------------------------------------------------------------- 1 | function get_self_process_name() { 2 | var openPtr = Module.getExportByName('libc.so', 'open'); 3 | var open = new NativeFunction(openPtr, 'int', ['pointer', 'int']); 4 | 5 | var readPtr = Module.getExportByName("libc.so", "read"); 6 | var read = new NativeFunction(readPtr, "int", ["int", "pointer", "int"]); 7 | 8 | var closePtr = Module.getExportByName('libc.so', 'close'); 9 | var close = new NativeFunction(closePtr, 'int', ['int']); 10 | 11 | var path = Memory.allocUtf8String("/proc/self/cmdline"); 12 | var fd = open(path, 0); 13 | if (fd != -1) { 14 | var buffer = Memory.alloc(0x1000); 15 | 16 | var result = read(fd, buffer, 0x1000); 17 | close(fd); 18 | result = ptr(buffer).readCString(); 19 | return result; 20 | } 21 | 22 | return "-1"; 23 | } 24 | 25 | function dump_dex() { 26 | var libart = Process.findModuleByName("libart.so"); 27 | var addr_DefineClass = null; 28 | var symbols = libart.enumerateSymbols(); 29 | for (var index = 0; index < symbols.length; index++) { 30 | var symbol = symbols[index]; 31 | var symbol_name = symbol.name; 32 | //这个DefineClass的函数签名是Android9的 33 | //_ZN3art11ClassLinker11DefineClassEPNS_6ThreadEPKcmNS_6HandleINS_6mirror11ClassLoaderEEERKNS_7DexFileERKNS9_8ClassDefE 34 | if (symbol_name.indexOf("ClassLinker") >= 0 && 35 | symbol_name.indexOf("DefineClass") >= 0 && 36 | symbol_name.indexOf("Thread") >= 0 && 37 | symbol_name.indexOf("DexFile") >= 0 ) { 38 | console.log(symbol_name, symbol.address); 39 | addr_DefineClass = symbol.address; 40 | } 41 | } 42 | var dex_maps = {}; 43 | 44 | console.log("[DefineClass:]", addr_DefineClass); 45 | if (addr_DefineClass) { 46 | Interceptor.attach(addr_DefineClass, { 47 | onEnter: function (args) { 48 | var dex_file = args[5]; 49 | //ptr(dex_file).add(Process.pointerSize) is "const uint8_t* const begin_;" 50 | //ptr(dex_file).add(Process.pointerSize + Process.pointerSize) is "const size_t size_;" 51 | var base = ptr(dex_file).add(Process.pointerSize).readPointer(); 52 | var size = ptr(dex_file).add(Process.pointerSize + Process.pointerSize).readUInt(); 53 | 54 | if (dex_maps[base] == undefined) { 55 | dex_maps[base] = size; 56 | var magic = ptr(base).readCString(); 57 | if (magic.indexOf("dex") == 0) { 58 | var process_name = get_self_process_name(); 59 | if (process_name != "-1") { 60 | var dex_path = "/data/data/" + process_name + "/files/" + base.toString(16) + "_" + size.toString(16) + ".dex"; 61 | console.log("[find dex]:", dex_path); 62 | var fd = new File(dex_path, "wb"); 63 | if (fd && fd != null) { 64 | var dex_buffer = ptr(base).readByteArray(size); 65 | fd.write(dex_buffer); 66 | fd.flush(); 67 | fd.close(); 68 | console.log("[dump dex]:", dex_path); 69 | 70 | } 71 | } 72 | } 73 | } 74 | }, onLeave: function (retval) { 75 | } 76 | }); 77 | } 78 | } 79 | 80 | var is_hook_libart = false; 81 | 82 | function hook_dlopen() { 83 | Interceptor.attach(Module.findExportByName(null, "dlopen"), { 84 | onEnter: function (args) { 85 | var pathptr = args[0]; 86 | if (pathptr !== undefined && pathptr != null) { 87 | var path = ptr(pathptr).readCString(); 88 | //console.log("dlopen:", path); 89 | if (path.indexOf("libart.so") >= 0) { 90 | this.can_hook_libart = true; 91 | console.log("[dlopen:]", path); 92 | } 93 | } 94 | }, 95 | onLeave: function (retval) { 96 | if (this.can_hook_libart && !is_hook_libart) { 97 | dump_dex(); 98 | is_hook_libart = true; 99 | } 100 | } 101 | }) 102 | 103 | Interceptor.attach(Module.findExportByName(null, "android_dlopen_ext"), { 104 | onEnter: function (args) { 105 | var pathptr = args[0]; 106 | if (pathptr !== undefined && pathptr != null) { 107 | var path = ptr(pathptr).readCString(); 108 | //console.log("android_dlopen_ext:", path); 109 | if (path.indexOf("libart.so") >= 0) { 110 | this.can_hook_libart = true; 111 | console.log("[android_dlopen_ext:]", path); 112 | } 113 | } 114 | }, 115 | onLeave: function (retval) { 116 | if (this.can_hook_libart && !is_hook_libart) { 117 | dump_dex(); 118 | is_hook_libart = true; 119 | } 120 | } 121 | }); 122 | } 123 | 124 | 125 | setImmediate(dump_dex); -------------------------------------------------------------------------------- /Frida_Dump/dump_dex_class.js: -------------------------------------------------------------------------------- 1 | function get_self_process_name() { 2 | var openPtr = Module.getExportByName('libc.so', 'open'); 3 | var open = new NativeFunction(openPtr, 'int', ['pointer', 'int']); 4 | 5 | var readPtr = Module.getExportByName("libc.so", "read"); 6 | var read = new NativeFunction(readPtr, "int", ["int", "pointer", "int"]); 7 | 8 | var closePtr = Module.getExportByName('libc.so', 'close'); 9 | var close = new NativeFunction(closePtr, 'int', ['int']); 10 | 11 | var path = Memory.allocUtf8String("/proc/self/cmdline"); 12 | var fd = open(path, 0); 13 | if (fd != -1) { 14 | var buffer = Memory.alloc(0x1000); 15 | 16 | var result = read(fd, buffer, 0x1000); 17 | close(fd); 18 | result = ptr(buffer).readCString(); 19 | return result; 20 | } 21 | 22 | return "-1"; 23 | } 24 | 25 | function load_all_class() { 26 | if (Java.available) { 27 | Java.perform(function () { 28 | 29 | var DexFileclass = Java.use("dalvik.system.DexFile"); 30 | var BaseDexClassLoaderclass = Java.use("dalvik.system.BaseDexClassLoader"); 31 | var DexPathListclass = Java.use("dalvik.system.DexPathList"); 32 | 33 | Java.enumerateClassLoaders({ 34 | onMatch: function (loader) { 35 | try { 36 | var basedexclassloaderobj = Java.cast(loader, BaseDexClassLoaderclass); 37 | var pathList = basedexclassloaderobj.pathList.value; 38 | var pathListobj = Java.cast(pathList, DexPathListclass) 39 | var dexElements = pathListobj.dexElements.value; 40 | for (var index in dexElements) { 41 | var element = dexElements[index]; 42 | try { 43 | var dexfile = element.dexFile.value; 44 | var dexfileobj = Java.cast(dexfile, DexFileclass); 45 | console.log("dexFile:", dexfileobj); 46 | const classNames = []; 47 | const enumeratorClassNames = dexfileobj.entries(); 48 | while (enumeratorClassNames.hasMoreElements()) { 49 | var className = enumeratorClassNames.nextElement().toString(); 50 | classNames.push(className); 51 | try { 52 | loader.loadClass(className); 53 | } catch (error) { 54 | console.log("loadClass error:", error); 55 | } 56 | } 57 | } catch (error) { 58 | console.log("dexfile error:", error); 59 | } 60 | } 61 | } catch (error) { 62 | console.log("loader error:", error); 63 | } 64 | }, 65 | onComplete: function () { 66 | 67 | } 68 | }) 69 | console.log("load_all_class end."); 70 | }); 71 | } 72 | } 73 | var dex_maps = {}; 74 | 75 | function print_dex_maps() { 76 | for (var dex in dex_maps) { 77 | console.log(dex, dex_maps[dex]); 78 | } 79 | } 80 | 81 | function dump_dex() { 82 | load_all_class(); 83 | 84 | for (var base in dex_maps) { 85 | var size = dex_maps[base]; 86 | console.log(base); 87 | 88 | var magic = ptr(base).readCString(); 89 | if (magic.indexOf("dex") == 0) { 90 | var process_name = get_self_process_name(); 91 | if (process_name != "-1") { 92 | var dex_path = "/data/data/" + process_name + "/files/" + base.toString(16) + "_" + size.toString(16) + ".dex"; 93 | console.log("[find dex]:", dex_path); 94 | var fd = new File(dex_path, "wb"); 95 | if (fd && fd != null) { 96 | var dex_buffer = ptr(base).readByteArray(size); 97 | fd.write(dex_buffer); 98 | fd.flush(); 99 | fd.close(); 100 | console.log("[dump dex]:", dex_path); 101 | 102 | } 103 | } 104 | } 105 | } 106 | } 107 | 108 | function hook_dex() { 109 | var libart = Process.findModuleByName("libart.so"); 110 | var addr_DefineClass = null; 111 | var symbols = libart.enumerateSymbols(); 112 | for (var index = 0; index < symbols.length; index++) { 113 | var symbol = symbols[index]; 114 | var symbol_name = symbol.name; 115 | //这个DefineClass的函数签名是Android9的 116 | //_ZN3art11ClassLinker11DefineClassEPNS_6ThreadEPKcmNS_6HandleINS_6mirror11ClassLoaderEEERKNS_7DexFileERKNS9_8ClassDefE 117 | if (symbol_name.indexOf("ClassLinker") >= 0 && 118 | symbol_name.indexOf("DefineClass") >= 0 && 119 | symbol_name.indexOf("Thread") >= 0 && 120 | symbol_name.indexOf("DexFile") >= 0) { 121 | console.log(symbol_name, symbol.address); 122 | addr_DefineClass = symbol.address; 123 | } 124 | } 125 | 126 | console.log("[DefineClass:]", addr_DefineClass); 127 | if (addr_DefineClass) { 128 | Interceptor.attach(addr_DefineClass, { 129 | onEnter: function (args) { 130 | var dex_file = args[5]; 131 | //ptr(dex_file).add(Process.pointerSize) is "const uint8_t* const begin_;" 132 | //ptr(dex_file).add(Process.pointerSize + Process.pointerSize) is "const size_t size_;" 133 | var base = ptr(dex_file).add(Process.pointerSize).readPointer(); 134 | var size = ptr(dex_file).add(Process.pointerSize + Process.pointerSize).readUInt(); 135 | 136 | if (dex_maps[base] == undefined) { 137 | dex_maps[base] = size; 138 | console.log("hook_dex:", base, size); 139 | } 140 | }, 141 | onLeave: function (retval) {} 142 | }); 143 | } 144 | 145 | } 146 | 147 | var is_hook_libart = false; 148 | 149 | function hook_dlopen() { 150 | Interceptor.attach(Module.findExportByName(null, "dlopen"), { 151 | onEnter: function (args) { 152 | var pathptr = args[0]; 153 | if (pathptr !== undefined && pathptr != null) { 154 | var path = ptr(pathptr).readCString(); 155 | //console.log("dlopen:", path); 156 | if (path.indexOf("libart.so") >= 0) { 157 | this.can_hook_libart = true; 158 | console.log("[dlopen:]", path); 159 | } 160 | } 161 | }, 162 | onLeave: function (retval) { 163 | if (this.can_hook_libart && !is_hook_libart) { 164 | hook_dex(); 165 | is_hook_libart = true; 166 | } 167 | } 168 | }) 169 | 170 | Interceptor.attach(Module.findExportByName(null, "android_dlopen_ext"), { 171 | onEnter: function (args) { 172 | var pathptr = args[0]; 173 | if (pathptr !== undefined && pathptr != null) { 174 | var path = ptr(pathptr).readCString(); 175 | //console.log("android_dlopen_ext:", path); 176 | if (path.indexOf("libart.so") >= 0) { 177 | this.can_hook_libart = true; 178 | console.log("[android_dlopen_ext:]", path); 179 | } 180 | } 181 | }, 182 | onLeave: function (retval) { 183 | if (this.can_hook_libart && !is_hook_libart) { 184 | hook_dex(); 185 | is_hook_libart = true; 186 | } 187 | } 188 | }); 189 | } 190 | 191 | 192 | setImmediate(hook_dex); -------------------------------------------------------------------------------- /Frida_Dump/dump_so.js: -------------------------------------------------------------------------------- 1 | function dump_so(so_name) { 2 | Java.perform(function () { 3 | var currentApplication = Java.use("android.app.ActivityThread").currentApplication(); 4 | var dir = currentApplication.getApplicationContext().getFilesDir().getPath(); 5 | var libso = Process.getModuleByName(so_name); 6 | console.log("[name]:", libso.name); 7 | console.log("[base]:", libso.base); 8 | console.log("[size]:", ptr(libso.size)); 9 | console.log("[path]:", libso.path); 10 | var file_path = dir + "/" + libso.name + "_" + libso.base + "_" + ptr(libso.size) + ".so"; 11 | var file_handle = new File(file_path, "wb"); 12 | if (file_handle && file_handle != null) { 13 | Memory.protect(ptr(libso.base), libso.size, 'rwx'); 14 | var libso_buffer = ptr(libso.base).readByteArray(libso.size); 15 | file_handle.write(libso_buffer); 16 | file_handle.flush(); 17 | file_handle.close(); 18 | console.log("[dump]:", file_path); 19 | } 20 | }); 21 | } -------------------------------------------------------------------------------- /Ghidra/README.md: -------------------------------------------------------------------------------- 1 | # Ghidra 2 | 3 | Ghidra是由美国国家安全局(NSA)研究部门开发的软件逆向工程(SRE)套件, 4 | 是一个软件逆向工程(SRE)框架,包括一套功能齐全的高端软件分析工具, 5 | 使用户能够在各种平台上分析编译后的代码,包括Windows、Mac OS和Linux。 6 | 功能包括反汇编,汇编,反编译,绘图和脚本,以及数百个其他功能。 7 | Ghidra支持各种处理器指令集和可执行格式,可以在用户交互模式和自动模式下运行。 8 | 用户还可以使用公开的API开发自己的Ghidra插件和脚本。 9 | 10 | 开源地址:https://github.com/NationalSecurityAgency/ghidra 11 | 下载地址:https://www.ghidra-sre.org/ (注意:需要很高的梯子) 12 | 13 | ## Usage 14 | 本文介绍的是windows版本的安装和使用 15 | 16 | 一、所需下载准备的软件 17 | ghidra 9_1.2 (解压缩) 18 | jdk-11.0.7 (安装配置环境) 19 | 20 | ghidra 9_1.2 下载: 21 | 链接:https://pan.baidu.com/s/1iLmW6HTbi4rCZJeW4M5xPw 22 | 提取码:lm1n 23 | 24 | jdk-11.0.7 下载: 25 | 链接:https://pan.baidu.com/s/1kPapBPehOensCYyANfm3Yg 26 | 提取码:9ppd 27 | 28 | 二、安装步骤 29 | 30 | 1.下载ghidra源代码并压缩 31 | 2.下载好后打开目录,双击ghidraRun.bat文件运行 32 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/01_ghidra%E8%BF%90%E8%A1%8C.png) 33 | 34 | 3.如果出现这个界面的话就是配置成功 35 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/02_Ghidra%E8%BF%90%E8%A1%8C%E6%88%90%E5%8A%9F.png) 36 | 37 | 4.如图所示,我们只需保留主程序窗口就可以了. 38 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/03_%E4%BD%BF%E7%94%A8%E6%AD%A5%E9%AA%A4.png) 39 | 40 | 5.到此,我们就成功安装好了Ghidra,现在我们就可以使用它了. 41 | 42 | 如何使用 43 | 44 | 1.首先,我们来新建一个工程 45 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/04_%E5%88%9B%E5%BB%BA%E9%A1%B9%E7%9B%AE.png) 46 | 47 | 2.我们选择个人项目,然后点击next 48 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/05_%E5%88%9B%E5%BB%BA%E4%B8%AA%E4%BA%BA%E9%A1%B9%E7%9B%AE.png) 49 | 50 | 3.填写完之后点击finish 51 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/06_%E8%B7%AF%E5%BE%84%E8%AE%BE%E7%BD%AE.png) 52 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/07_0%E9%A1%B9%E7%9B%AE%E5%88%9B%E5%BB%BA%E5%A5%BD%E5%90%8E.png) 53 | 54 | 4.导入需要分析的工具,或者直接将文件拖拽进工程 55 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/07_1%E5%AF%BC%E5%85%A5%E9%9C%80%E8%A6%81%E5%88%86%E6%9E%90%E7%9A%84%E9%A1%B9%E7%9B%AE.png) 56 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/07_2%E5%8A%A0%E8%BD%BD%E9%9C%80%E8%A6%81%E5%88%86%E6%9E%90%E7%9A%84%E6%96%87%E4%BB%B6.png) 57 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/07_3%E8%AE%BE%E7%BD%AE%E5%A5%BD%E5%90%8E%E7%82%B9OK.png) 58 | 59 | 5.打开之后是这个界面,可以点击options设置,默认即可 60 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/07_2_1%E8%AE%BE%E7%BD%AE%E9%80%89%E9%A1%B9.png) 61 | 62 | 6.得到一个程序的信息 63 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/07_4%E4%BC%9A%E5%BC%B9%E5%87%BA%E5%88%86%E6%9E%90%E7%A8%8B%E5%BA%8F%E7%9A%84%E4%BF%A1%E6%81%AF.png) 64 | 65 | 7.双击这个工程的.so文件/程序,或者将程序拖入Tool Chest中小龙(Tool Chest可以自己添加工具) 66 | ![image](hhttps://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/08_%E5%8A%A0%E8%BD%BD%E9%9C%80%E8%A6%81%E5%88%86%E6%9E%90%E7%9A%84%E7%A8%8B%E5%BA%8F.png) 67 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/09_%E5%8F%8C%E5%87%BB%E5%8A%A0%E8%BD%BD%E7%A8%8B%E5%BA%8F.png) 68 | 69 | 8.选择yes 70 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/07_5%E6%98%AF%E5%90%A6%E5%BC%80%E5%A7%8B%E5%88%86%E6%9E%90%E7%A8%8B%E5%BA%8F.png) 71 | 72 | 73 | 9.按照默认的来,选择Analyze 74 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/07_6%E9%BB%98%E8%AE%A4%E8%AE%BE%E7%BD%AE%E5%B0%B1%E5%A5%BD.png) 75 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/10_%E5%8A%A0%E8%BD%BD%E7%94%BB%E9%9D%A2.png) 76 | 77 | 10.等待一会,出现以下界面就打大功告成! 78 | ![image](https://github.com/kingking888/AndroidReverseEngineering/blob/master/Ghidra/src/png/13%E5%AE%8C%E6%88%90.png) 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /Ghidra/src/png/01_ghidra运行.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/01_ghidra运行.png -------------------------------------------------------------------------------- /Ghidra/src/png/02_Ghidra运行成功.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/02_Ghidra运行成功.png -------------------------------------------------------------------------------- /Ghidra/src/png/03_使用步骤.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/03_使用步骤.png -------------------------------------------------------------------------------- /Ghidra/src/png/04_创建项目.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/04_创建项目.png -------------------------------------------------------------------------------- /Ghidra/src/png/05_创建个人项目.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/05_创建个人项目.png -------------------------------------------------------------------------------- /Ghidra/src/png/06_路径设置.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/06_路径设置.png -------------------------------------------------------------------------------- /Ghidra/src/png/07_0项目创建好后.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/07_0项目创建好后.png -------------------------------------------------------------------------------- /Ghidra/src/png/07_1导入需要分析的项目.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/07_1导入需要分析的项目.png -------------------------------------------------------------------------------- /Ghidra/src/png/07_2_1设置选项.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/07_2_1设置选项.png -------------------------------------------------------------------------------- /Ghidra/src/png/07_2加载需要分析的文件.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/07_2加载需要分析的文件.png -------------------------------------------------------------------------------- /Ghidra/src/png/07_3设置好后点OK.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/07_3设置好后点OK.png -------------------------------------------------------------------------------- /Ghidra/src/png/07_4会弹出分析程序的信息.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/07_4会弹出分析程序的信息.png -------------------------------------------------------------------------------- /Ghidra/src/png/07_5是否开始分析程序.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/07_5是否开始分析程序.png -------------------------------------------------------------------------------- /Ghidra/src/png/07_6默认设置就好.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/07_6默认设置就好.png -------------------------------------------------------------------------------- /Ghidra/src/png/08_加载需要分析的程序.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/08_加载需要分析的程序.png -------------------------------------------------------------------------------- /Ghidra/src/png/09_双击加载程序.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/09_双击加载程序.png -------------------------------------------------------------------------------- /Ghidra/src/png/10_加载画面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/10_加载画面.png -------------------------------------------------------------------------------- /Ghidra/src/png/11_加载成功画面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/11_加载成功画面.png -------------------------------------------------------------------------------- /Ghidra/src/png/13完成.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Ghidra/src/png/13完成.png -------------------------------------------------------------------------------- /Jadx/README.md: -------------------------------------------------------------------------------- 1 | # Jadx 2 | 3 | Jadx简介 4 | 5 | Android开发人员的日常工作中免不了要向其它优秀App学习借鉴。 6 | 俗话说:“工欲善其事,必先利其器”,下面介绍一下常用的逆向工具。 7 | jadx是个人比较喜欢的一款反编译利器,同时支持命令行和图形界面, 8 | 能以最简便的方式完成apk的反编译操作。 9 | 先给出工具的GitHub地址,可以按照自己喜欢的方式安装并查看功能文档: 10 | 11 | 源码地址:https://github.com/skylot/jadx 12 | 13 | 14 | ## Usage 15 | 1.下载 16 | https://bintray.com/skylot/jadx/releases/v1.1.0#files/ 17 | 18 | 2.以管理员身份运行 19 | 20 | ![image](src/png/01运行.png) 21 | 22 | 3.加载需要分析的app 23 | 24 | ![image](src/png/02选择需要分析的APK.png) 25 | 26 | 4.app的整体结构 27 | 28 | ![image](src/png/03APP源文件结构和代码.png) 29 | 30 | 5.查找关键函数 31 | ![image](src/png/04查找关键字.png) 32 | 33 | 34 | 6.分析源代码 35 | ![image](src/png/05success.png) 36 | 37 | ##Problem 38 | 39 | 如何修改jadx的默认内存 40 | 1.使用记事本或者notpad++打开jadx-gui.bat。 41 | 2.找到 set DEFAULT_JVM_OPTS="-Xms128M" "-Xmx4g" 。 42 | 3.将其修改为 set DEFAULT_JVM_OPTS="-Xms128M" "-Xmx8g" 后保存就ok了。 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Jadx/src/png/01运行.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Jadx/src/png/01运行.png -------------------------------------------------------------------------------- /Jadx/src/png/02选择需要分析的APK.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Jadx/src/png/02选择需要分析的APK.png -------------------------------------------------------------------------------- /Jadx/src/png/03APP源文件结构和代码.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Jadx/src/png/03APP源文件结构和代码.png -------------------------------------------------------------------------------- /Jadx/src/png/04查找关键字.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Jadx/src/png/04查找关键字.png -------------------------------------------------------------------------------- /Jadx/src/png/05success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenny67/AndroidReverseEngineering/cb1bfc9dfd94de456fc51ac070335bb1b82e28af/Jadx/src/png/05success.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AndroidReverseEngineering 2 | 3 | 安卓逆向工程 4 | ELFRead、Frida、FridaDump、DexDump、SoDump、Ghidra、Xpose... 5 | 6 | ### AboutFiles: 7 | 8 | 1.Frida_Dump 9 | 安卓app加固脱壳,获取dex和so文件 10 | 11 | 2.FridaDexDump 12 | 安卓app加固脱壳,获取dex文件 13 | 14 | 3.Ghidra 15 | 强大的逆向反编译器-->>分析工具 16 | 17 | 4.Jadx 18 | 强大的APP逆向反编译器-->>分析工具 19 | 20 | 5.ReadElf 21 | so文件结构分析 22 | 23 | 24 | ### Features: 25 | update and update -------------------------------------------------------------------------------- /ReadElf/README.md: -------------------------------------------------------------------------------- 1 | # AndroidReverseEngineering 2 | 3 | 安卓逆向工程之so文件分析 4 | 5 | SO文件是Linux下共享库文件,它的文件格式被称为ELF文件格式。在Android逆向中对so文件格式分析非常重要。 6 | ELF文件主要由 ELF header 、section header table、program header table组成 7 | 8 | ELF header 9 | 10 | 什么是ELFheader? 11 | 12 | 所谓的elfHeader也就是系统要解析一个elf文件第一步需要解析的地方,怎么解析不是本章的主要,本章只分析elf文件整体的框架,方面在脑袋里形成图画。所以elf文件头部包含了整个elf文件重要组成部分的offset,什么是重要的组成部分?上面说到了section header table、program header table。 13 | 14 | ELFheader的组成: 15 | 16 | 1.固定格式(ident/type/machine/version/entry):这些成员在同类型的elf文件中一般是固定的 17 | 18 | 2.sectionHeaderTable信息(shoff/shentsize/shnum):此三个成员描述的是sectionHeaderTable的偏移、单个大小、总个数 19 | 20 | 3.programHeaderTable信息(phoff/phentsize/phnum):同上,描述的是programHeaderTable的信息 21 | 22 | 4.字符串表在sectionHeaderTable中的位置(这个先不说了,说也说不明白,等第二篇解析ELF文件的时候在说,总之有这个东西) 23 | 24 | 换句话说:通过elfHeader我们便可获取到elf文件的各种信息。因为已经获取到了其他两个table的偏移、单个大小、总个数 25 | 26 | section header table 27 | 28 | 什么是section header table? 29 | 30 | 一句话:一个so里面所有的资源。如变量名、字符串、执行代码、got、plt等。。。 31 | 32 | sectionHeaderTable的组成: 33 | 34 | 1.由多个sectionHeader组成,至于是多少个?上面ELFHreader已经告诉我们了 35 | 36 | 2.每个sectionHeader又代表了不同的资源。如上面说的变量名、字符串、执行代码等。。。 37 | 38 | 换句话说:section header table表示so里面所有的资源的一个表单 39 | 40 | program header table 41 | 42 | 什么是program header table? 43 | 服务于sectionHreader的一张表! 44 | 45 | sectionHeaderTable的组成: 46 | 47 | 1.一个sectionHeaderTable由多个segment组成. 48 | 49 | 2.而一个segment包含多个section 50 | 51 | 换句话说: 从组成结构上可以看得出他主要是服务于section的,而section又是so的资源,所以狭义上我们可以理解成此表为告诉计算机要怎么加载解析so资源的一张表. 52 | 53 | 使用: 54 | 55 | Run readelf 56 | 然后输入so的路径 57 | 58 | 59 | -------------------------------------------------------------------------------- /ReadElf/readelf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # !/usr/bin/env python 3 | 4 | """ 5 | ------------------------------------------------- 6 | File Name: readelf.py 7 | Description : 分析so文件 8 | Author : Andy Zhong 9 | date: 2020/5/20 10 | ------------------------------------------------- 11 | Change Activity: 12 | 2020/5/20: 13 | ------------------------------------------------- 14 | """ 15 | 16 | __author__ = 'Andy Zhong' 17 | 18 | import sys 19 | import mmap 20 | import binascii 21 | 22 | 23 | def hexlify(data): 24 | return '0x' + binascii.hexlify(data).decode() 25 | 26 | 27 | class ELFFile(object): 28 | def __init__(self, elf): 29 | self.header = ELFHeader(elf) 30 | self.program_headers = [] 31 | current = self.header.phoff 32 | for i in range(self.header.phnum): 33 | p_header = ProgramHeader(elf, self.header, current) 34 | self.program_headers.append(p_header) 35 | current += self.header.phentsize 36 | 37 | self.section_headers = [] 38 | self.strtable = None 39 | current = self.header.shoff 40 | for i in range(self.header.shnum): 41 | s_header = SectionHeader(elf, self.header, current) 42 | if i == self.header.shstrndx: 43 | self.strtable = StrTableSection(elf, s_header) 44 | self.section_headers.append(s_header) 45 | current += self.header.shentsize 46 | 47 | def print_program_header(self): 48 | if len(self.program_headers) == 0: 49 | print('There is no program header....') 50 | return 51 | ProgramHeader.print_title() 52 | for header in self.program_headers: 53 | header.print() 54 | 55 | def print_section_header(self): 56 | if len(self.section_headers) == 0: 57 | print('There is no section header....') 58 | return 59 | SectionHeader.print_section_header_title() 60 | for header in self.section_headers: 61 | header.print() 62 | 63 | 64 | class ELFHeader(object): 65 | def __init__(self, elf): 66 | self.magic = elf[0:3] 67 | if self.magic != b'\x7fEL': 68 | raise ValueError('Illegal file format: ', self.magic) 69 | self.clazz = elf[4] 70 | self.data = elf[5] 71 | 72 | original = lambda x: x 73 | # (attr_name, size, transform_func) 74 | items = [('version', 1, self.int_from_bytes), 75 | ('osabi', 1, None), 76 | ('abiversion', 1, None), 77 | ('pad', 7, original), 78 | ('type', 2, None), 79 | ('machine', 2, None), 80 | ('e_version', 4, self.int_from_bytes), 81 | ('entry', 8 if self.is_64 else 4, original), 82 | ('phoff', 8 if self.is_64 else 4, self.int_from_bytes), 83 | ('shoff', 8 if self.is_64 else 4, self.int_from_bytes), 84 | ('flags', 4, None), 85 | ('ehsize', 2, self.int_from_bytes), 86 | ('phentsize', 2, self.int_from_bytes), 87 | ('phnum', 2, self.int_from_bytes), 88 | ('shentsize', 2, self.int_from_bytes), 89 | ('shnum', 2, self.int_from_bytes), 90 | ('shstrndx', 2, self.int_from_bytes)] 91 | current = 0x06 92 | for item in items: 93 | attr_name, size, transform_func = item 94 | next_current = current + size 95 | value = elf[current: next_current] 96 | current = next_current 97 | if transform_func is not None: 98 | value = transform_func(value) 99 | elif size != 1 and self.is_little: 100 | value = value[::-1] 101 | setattr(self, attr_name, value) 102 | 103 | def int_from_bytes(self, bytes): 104 | return int.from_bytes(bytes, 'little' if self.is_little else 'big', signed=True) 105 | 106 | @property 107 | def is_little(self): 108 | return self.data == 1 109 | 110 | @property 111 | def is_64(self): 112 | return self.clazz == 2 113 | 114 | def _class_desc(self): 115 | return 'ELF64' if self.is_64 else 'ELF32' 116 | 117 | def _data_desc(self): 118 | return "2's complement, little endian" if self.is_little else "2's complement, big endian" 119 | 120 | def _osabi_desc(self): 121 | abi = {b'\x00': "System V", 122 | b'\x01': "HP-UX", 123 | b'\x02': "NetBSD", 124 | b'\x03': "Linux", 125 | b'\x04': "GNU Hurd", 126 | b'\x06': "Solaris", 127 | b'\x07': "AIX", 128 | b'\x08': "IRIX", 129 | b'\x09': "FreeBSD"} 130 | return abi[self.osabi] 131 | 132 | def _type_desc(self): 133 | type = { 134 | b'\x00\x00': "NONE", 135 | b'\x00\x01': "REL", 136 | b'\x00\x02': "EXEC", 137 | b'\x00\x03': "DYN", 138 | b'\x00\x04': "CORE", 139 | b'\xfe\x00': "LOOS", 140 | b'\xfe\xff': "HIOS", 141 | } 142 | return type[self.type] 143 | 144 | def _machine_desc(self): 145 | machine = { 146 | b'\x00\x00': 'NONE', 147 | b'\x00\x02': 'SPARC', 148 | b'\x00\x03': 'x86', 149 | b'\x00\x08': 'MIPS', 150 | b'\x00\x14': "PowerPC", 151 | b'\x00\x16': "S390", 152 | b'\x00\x28': 'ARM', 153 | b'\x00\x2A': "SuperH", 154 | b'\x00\x32': 'IA-64', 155 | b'\x00\x3E': 'x86-64', 156 | b'\x00\xB7': 'AArch64', 157 | b'\x00\xF3': 'RISC-V' 158 | } 159 | return machine[self.machine] 160 | 161 | def print(self): 162 | width = 45 163 | print('ELF Header: ') 164 | print(' Class:'.ljust(width), self._class_desc()) 165 | print(' Data:'.ljust(width), self._data_desc()) 166 | print(' OS/ABI:'.ljust(width), self._osabi_desc()) 167 | print(' Type:'.ljust(width), self._type_desc()) 168 | print(' Machine:'.ljust(width), self._machine_desc()) 169 | print(' Entry point address:'.ljust(width), hex(self.int_from_bytes(self.entry))) 170 | print(' Start of program headers:'.ljust(width), self.phoff, ' (bytes into file)') 171 | print(' Start for section headers:'.ljust(width), self.shoff, ' (bytes into file)') 172 | print(' Flags:'.ljust(width), self.flags) 173 | print(' Size of this header:'.ljust(width), self.ehsize, ' (bytes)') 174 | print(' Size of program header:'.ljust(width), self.phentsize, ' (bytes)') 175 | print(' Number of program headers:'.ljust(width), self.phnum) 176 | print(' Size of section headers:'.ljust(width), self.shentsize, ' (bytes)') 177 | print(' Number of section headers:'.ljust(width), self.shnum) 178 | print(' Section header string table index:'.ljust(width), self.shstrndx) 179 | print('') 180 | 181 | 182 | class ProgramHeader(object): 183 | def __init__(self, elf, elf_header, base): 184 | address_offset = 8 if elf_header.is_64 else 4 185 | items = [ 186 | ('type', 4, None), 187 | ('flags', 4 if elf_header.is_64 else 0, None), 188 | ('offset', address_offset, elf_header.int_from_bytes), 189 | ('vaddr', address_offset, None), 190 | ('paddr', address_offset, None), 191 | ('filesz', address_offset, elf_header.int_from_bytes), 192 | ('memsz', address_offset, elf_header.int_from_bytes), 193 | ('flags', 0 if elf_header.is_64 else 4, None), 194 | ('align', address_offset, elf_header.int_from_bytes)] 195 | current = base 196 | for item in items: 197 | attr_name, size, transform_func = item 198 | current_next = current + size 199 | if size == 0: 200 | continue 201 | value = elf[current: current_next] 202 | if transform_func is not None: 203 | value = transform_func(value) 204 | elif elf_header.is_little: 205 | value = value[::-1] 206 | setattr(self, attr_name, value) 207 | current = current_next 208 | 209 | @staticmethod 210 | def print_item(items, item_width=10): 211 | content = ' '.join( 212 | [str(item).center(item_width) if type(item) is not tuple else str(item[0]).center(item[1]) for item in 213 | items]) 214 | print(content) 215 | 216 | def _type_desc(self): 217 | types = { 218 | b'\x00\x00\x00\x00': 'NULL', 219 | b'\x00\x00\x00\x01': 'LOAD', 220 | b'\x00\x00\x00\x02': 'DYNAMIC', 221 | b'\x00\x00\x00\x03': 'INTERP', 222 | b'\x00\x00\x00\x04': 'NOTE', 223 | b'\x00\x00\x00\x05': 'SHLIB', 224 | b'\x00\x00\x00\x06': 'PHDR', 225 | b'\x60\x00\x00\x00': 'LOOS', 226 | b'\x6F\xFF\xFF\xFF': 'HIOS', 227 | b'\x70\x00\x00\x00': 'LOPROC', 228 | b'\x7F\xFF\xFF\xFF': 'HIPROC' 229 | } 230 | if self.type in types: 231 | return types[self.type] 232 | return hexlify(self.type) 233 | 234 | @staticmethod 235 | def print_title(): 236 | ProgramHeader.print_item(['type', 'flags', 'offset', \ 237 | ('vaddr', 20), ('paddr', 20), \ 238 | 'filesz', 'memsz', 'align']) 239 | 240 | def print(self): 241 | ProgramHeader.print_item([self._type_desc(), hexlify(self.flags), self.offset, \ 242 | (hexlify(self.vaddr), 20), (hexlify(self.paddr), 20), \ 243 | self.filesz, self.memsz, self.align]) 244 | 245 | 246 | class SectionHeader(object): 247 | def __init__(self, elf, elf_header, base): 248 | self.elf = elf 249 | address_len = 8 if elf_header.is_64 else 4 250 | items = [ 251 | ('name', 4, None), 252 | ('type', 4, None), 253 | ('flags', address_len, None), 254 | ('addr', address_len, None), 255 | ('offset', address_len, elf_header.int_from_bytes), 256 | ('size', address_len, elf_header.int_from_bytes), 257 | ('link', 4, elf_header.int_from_bytes), 258 | ('info', 4, None), 259 | ('addralign', address_len, elf_header.int_from_bytes), 260 | ('entsize', address_len, elf_header.int_from_bytes) 261 | ] 262 | current = base 263 | for item in items: 264 | attr_name, size, transform_func = item 265 | next_current = current + size 266 | value = elf[current: next_current] 267 | if transform_func is not None: 268 | value = transform_func(value) 269 | elif elf_header.is_little: 270 | value = value[::-1] 271 | current = next_current 272 | setattr(self, attr_name, value) 273 | 274 | def _type_desc(self): 275 | types = { 276 | b'\x00\x00\x00\x00': 'NULL', 277 | b'\x00\x00\x00\x01': 'PROGBITS', 278 | b'\x00\x00\x00\x02': 'SYMTAB', 279 | b'\x00\x00\x00\x03': 'STRTAB', 280 | b'\x00\x00\x00\x04': 'RELA', 281 | b'\x00\x00\x00\x05': 'HASH', 282 | b'\x00\x00\x00\x06': 'DYNAMIC', 283 | b'\x00\x00\x00\x07': 'NOTE', 284 | b'\x00\x00\x00\x08': 'NOBITS', 285 | b'\x00\x00\x00\x09': 'REL', 286 | b'\x00\x00\x00\x0A': 'SHLIB', 287 | b'\x00\x00\x00\x0B': 'DYNSYM', 288 | b'\x00\x00\x00\x0E': 'INIT_ARRAY', 289 | b'\x00\x00\x00\x0F': 'FINI_ARRAY', 290 | b'\x00\x00\x00\x10': 'PREINIT_ARRAY', 291 | b'\x00\x00\x00\x11': 'GROUP', 292 | b'\x00\x00\x00\x12': 'SYMTAB_SHNDX', 293 | b'\x00\x00\x00\x13': 'NUM', 294 | } 295 | if self.type in types: 296 | return types[self.type] 297 | return hexlify(self.type) 298 | 299 | def _flag_desc(self): 300 | flags = { 301 | 0x01: 'WRITE', 302 | 0x02: 'ALLOC', 303 | 0x04: 'EXECINSTR', 304 | 0x10: 'MERGE', 305 | 0x20: 'STRINGS', 306 | 0x40: 'INFO_LINK', 307 | 0x80: 'LINK_ORDER', 308 | 0x100: 'OS_NONCONFORMING', 309 | 0x0200: 'GROUP', 310 | 0x0400: 'TLS', 311 | 0x0ff00000: 'MASKOS', 312 | 0xf0000000: 'MASKPROC', 313 | 0x40000000: 'ORDERED', 314 | 0x80000000: 'EXCLUDE' 315 | } 316 | flag = int.from_bytes(self.flags, byteorder='big') 317 | if flag in flags: 318 | return flags[flag] 319 | else: 320 | return hexlify(self.flags) 321 | 322 | def _name_desc(self): 323 | if self.elf.strtable is None: 324 | return hexlify(self.name) 325 | else: 326 | return hexlify(self.name) 327 | 328 | @staticmethod 329 | def print_section_header_title(): 330 | ProgramHeader.print_item(['name', ('type', 15), ('flags', 20), \ 331 | ('addr', 20), ('offset', 5), ('size', 8), \ 332 | ('link', 8), 'info', 'addralign']) 333 | 334 | def print(self): 335 | ProgramHeader.print_item([hexlify(self.name), (self._type_desc(), 15), (self._flag_desc(), 20), \ 336 | (hexlify(self.addr), 20), (self.offset, 5), (self.size, 8), \ 337 | (self.link, 8), hexlify(self.info), self.addralign]) 338 | 339 | 340 | class StrTableSection(object): 341 | def __init__(self, elf, strtable_header): 342 | content = elf[strtable_header.offset: strtable_header.offset + strtable_header.size] 343 | self.strs = content.split(b'\x00') 344 | 345 | 346 | if __name__ == '__main__': 347 | # file_path = sys.argv[1] 348 | file_path = input("[请输入您的so文件路径,如:C:\\Users\\Administrator\\Desktop\\libcms.so]==>>>") 349 | print("\n") 350 | # file_path = r"C:\Users\Administrator\Desktop\libcms.so" 351 | print("read elf info from: ", file_path) 352 | elffile = open(file_path, 'r') 353 | map = mmap.mmap(elffile.fileno(), 0, access=mmap.ACCESS_READ) 354 | elf = ELFFile(map) 355 | elf.header.print() 356 | print('\nELF Program Headers:') 357 | elf.print_program_header() 358 | print('\nELF Section Headers: ') 359 | elf.print_section_header() 360 | map.close() 361 | elffile.close() 362 | -------------------------------------------------------------------------------- /ReadElf/result.txt: -------------------------------------------------------------------------------- 1 | ELF 头: 2 | Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 3 | 类别: ELF64 4 | 数据: 2 补码,小端序 (little endian) 5 | 版本: 1 (current) 6 | OS/ABI: UNIX - System V 7 | ABI 版本: 0 8 | 类型: DYN (共享目标文件) 9 | 系统架构: Advanced Micro Devices X86-64 10 | 版本: 0x1 11 | 入口点地址: 0x1040 12 | 程序头起点: 64 (bytes into file) 13 | Start of section headers: 14712 (bytes into file) 14 | 标志: 0x0 15 | 本头的大小: 64 (字节) 16 | 程序头大小: 56 (字节) 17 | Number of program headers: 11 18 | 节头大小: 64 (字节) 19 | 节头数量: 29 20 | 字符串表索引节头: 28 21 | 22 | 节头: 23 | [号] 名称 类型 地址 偏移量 24 | 大小 全体大小 旗标 链接 信息 对齐 25 | [ 0] NULL 0000000000000000 00000000 26 | 0000000000000000 0000000000000000 0 0 0 27 | [ 1] .interp PROGBITS 00000000000002a8 000002a8 28 | 000000000000001c 0000000000000000 A 0 0 1 29 | [ 2] .note.ABI-tag NOTE 00000000000002c4 000002c4 30 | 0000000000000020 0000000000000000 A 0 0 4 31 | [ 3] .note.gnu.build-i NOTE 00000000000002e4 000002e4 32 | 0000000000000024 0000000000000000 A 0 0 4 33 | [ 4] .gnu.hash GNU_HASH 0000000000000308 00000308 34 | 000000000000001c 0000000000000000 A 5 0 8 35 | [ 5] .dynsym DYNSYM 0000000000000328 00000328 36 | 00000000000000a8 0000000000000018 A 6 1 8 37 | [ 6] .dynstr STRTAB 00000000000003d0 000003d0 38 | 0000000000000082 0000000000000000 A 0 0 1 39 | [ 7] .gnu.version VERSYM 0000000000000452 00000452 40 | 000000000000000e 0000000000000002 A 5 0 2 41 | [ 8] .gnu.version_r VERNEED 0000000000000460 00000460 42 | 0000000000000020 0000000000000000 A 6 1 8 43 | [ 9] .rela.dyn RELA 0000000000000480 00000480 44 | 00000000000000c0 0000000000000018 A 5 0 8 45 | [10] .rela.plt RELA 0000000000000540 00000540 46 | 0000000000000018 0000000000000018 AI 5 22 8 47 | [11] .init PROGBITS 0000000000001000 00001000 48 | 000000000000001b 0000000000000000 AX 0 0 4 49 | [12] .plt PROGBITS 0000000000001020 00001020 50 | 0000000000000020 0000000000000010 AX 0 0 16 51 | [13] .text PROGBITS 0000000000001040 00001040 52 | 0000000000000195 0000000000000000 AX 0 0 16 53 | [14] .fini PROGBITS 00000000000011d8 000011d8 54 | 000000000000000d 0000000000000000 AX 0 0 4 55 | [15] .rodata PROGBITS 0000000000002000 00002000 56 | 0000000000000011 0000000000000000 A 0 0 4 57 | [16] .eh_frame_hdr PROGBITS 0000000000002014 00002014 58 | 0000000000000034 0000000000000000 A 0 0 4 59 | [17] .eh_frame PROGBITS 0000000000002048 00002048 60 | 00000000000000d8 0000000000000000 A 0 0 8 61 | [18] .init_array INIT_ARRAY 0000000000003de8 00002de8 62 | 0000000000000008 0000000000000008 WA 0 0 8 63 | [19] .fini_array FINI_ARRAY 0000000000003df0 00002df0 64 | 0000000000000008 0000000000000008 WA 0 0 8 65 | [20] .dynamic DYNAMIC 0000000000003df8 00002df8 66 | 00000000000001e0 0000000000000010 WA 6 0 8 67 | [21] .got PROGBITS 0000000000003fd8 00002fd8 68 | 0000000000000028 0000000000000008 WA 0 0 8 69 | [22] .got.plt PROGBITS 0000000000004000 00003000 70 | 0000000000000020 0000000000000008 WA 0 0 8 71 | [23] .data PROGBITS 0000000000004020 00003020 72 | 0000000000000010 0000000000000000 WA 0 0 8 73 | [24] .bss NOBITS 0000000000004030 00003030 74 | 0000000000000008 0000000000000000 WA 0 0 1 75 | [25] .comment PROGBITS 0000000000000000 00003030 76 | 000000000000002b 0000000000000001 MS 0 0 1 77 | [26] .symtab SYMTAB 0000000000000000 00003060 78 | 0000000000000600 0000000000000018 27 44 8 79 | [27] .strtab STRTAB 0000000000000000 00003660 80 | 000000000000020f 0000000000000000 0 0 1 81 | [28] .shstrtab STRTAB 0000000000000000 0000386f 82 | 0000000000000103 0000000000000000 0 0 1 83 | Key to Flags: 84 | W (write), A (alloc), X (execute), M (merge), S (strings), I (info), 85 | L (link order), O (extra OS processing required), G (group), T (TLS), 86 | C (compressed), x (unknown), o (OS specific), E (exclude), 87 | l (large), p (processor specific) 88 | 89 | There are no section groups in this file. 90 | 91 | 程序头: 92 | Type Offset VirtAddr PhysAddr 93 | FileSiz MemSiz Flags Align 94 | PHDR 0x0000000000000040 0x0000000000000040 0x0000000000000040 95 | 0x0000000000000268 0x0000000000000268 R 0x8 96 | INTERP 0x00000000000002a8 0x00000000000002a8 0x00000000000002a8 97 | 0x000000000000001c 0x000000000000001c R 0x1 98 | [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] 99 | LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000 100 | 0x0000000000000558 0x0000000000000558 R 0x1000 101 | LOAD 0x0000000000001000 0x0000000000001000 0x0000000000001000 102 | 0x00000000000001e5 0x00000000000001e5 R E 0x1000 103 | LOAD 0x0000000000002000 0x0000000000002000 0x0000000000002000 104 | 0x0000000000000120 0x0000000000000120 R 0x1000 105 | LOAD 0x0000000000002de8 0x0000000000003de8 0x0000000000003de8 106 | 0x0000000000000248 0x0000000000000250 RW 0x1000 107 | DYNAMIC 0x0000000000002df8 0x0000000000003df8 0x0000000000003df8 108 | 0x00000000000001e0 0x00000000000001e0 RW 0x8 109 | NOTE 0x00000000000002c4 0x00000000000002c4 0x00000000000002c4 110 | 0x0000000000000044 0x0000000000000044 R 0x4 111 | GNU_EH_FRAME 0x0000000000002014 0x0000000000002014 0x0000000000002014 112 | 0x0000000000000034 0x0000000000000034 R 0x4 113 | GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 114 | 0x0000000000000000 0x0000000000000000 RW 0x10 115 | GNU_RELRO 0x0000000000002de8 0x0000000000003de8 0x0000000000003de8 116 | 0x0000000000000218 0x0000000000000218 R 0x1 117 | 118 | Section to Segment mapping: 119 | 段节... 120 | 00 121 | 01 .interp 122 | 02 .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt 123 | 03 .init .plt .text .fini 124 | 04 .rodata .eh_frame_hdr .eh_frame 125 | 05 .init_array .fini_array .dynamic .got .got.plt .data .bss 126 | 06 .dynamic 127 | 07 .note.ABI-tag .note.gnu.build-id 128 | 08 .eh_frame_hdr 129 | 09 130 | 10 .init_array .fini_array .dynamic .got 131 | 132 | Dynamic section at offset 0x2df8 contains 26 entries: 133 | 标记 类型 名称/值 134 | 0x0000000000000001 (NEEDED) 共享库:[libc.so.6] 135 | 0x000000000000000c (INIT) 0x1000 136 | 0x000000000000000d (FINI) 0x11d8 137 | 0x0000000000000019 (INIT_ARRAY) 0x3de8 138 | 0x000000000000001b (INIT_ARRAYSZ) 8 (bytes) 139 | 0x000000000000001a (FINI_ARRAY) 0x3df0 140 | 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes) 141 | 0x000000006ffffef5 (GNU_HASH) 0x308 142 | 0x0000000000000005 (STRTAB) 0x3d0 143 | 0x0000000000000006 (SYMTAB) 0x328 144 | 0x000000000000000a (STRSZ) 130 (bytes) 145 | 0x000000000000000b (SYMENT) 24 (bytes) 146 | 0x0000000000000015 (DEBUG) 0x0 147 | 0x0000000000000003 (PLTGOT) 0x4000 148 | 0x0000000000000002 (PLTRELSZ) 24 (bytes) 149 | 0x0000000000000014 (PLTREL) RELA 150 | 0x0000000000000017 (JMPREL) 0x540 151 | 0x0000000000000007 (RELA) 0x480 152 | 0x0000000000000008 (RELASZ) 192 (bytes) 153 | 0x0000000000000009 (RELAENT) 24 (bytes) 154 | 0x000000006ffffffb (FLAGS_1) 标志: PIE 155 | 0x000000006ffffffe (VERNEED) 0x460 156 | 0x000000006fffffff (VERNEEDNUM) 1 157 | 0x000000006ffffff0 (VERSYM) 0x452 158 | 0x000000006ffffff9 (RELACOUNT) 3 159 | 0x0000000000000000 (NULL) 0x0 160 | 161 | 重定位节 '.rela.dyn' at offset 0x480 contains 8 entries: 162 | 偏移量 信息 类型 符号值 符号名称 + 加数 163 | 000000003de8 000000000008 R_X86_64_RELATIVE 1130 164 | 000000003df0 000000000008 R_X86_64_RELATIVE 10e0 165 | 000000004028 000000000008 R_X86_64_RELATIVE 4028 166 | 000000003fd8 000100000006 R_X86_64_GLOB_DAT 0000000000000000 _ITM_deregisterTMClone + 0 167 | 000000003fe0 000300000006 R_X86_64_GLOB_DAT 0000000000000000 __libc_start_main@GLIBC_2.2.5 + 0 168 | 000000003fe8 000400000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0 169 | 000000003ff0 000500000006 R_X86_64_GLOB_DAT 0000000000000000 _ITM_registerTMCloneTa + 0 170 | 000000003ff8 000600000006 R_X86_64_GLOB_DAT 0000000000000000 __cxa_finalize@GLIBC_2.2.5 + 0 171 | 172 | 重定位节 '.rela.plt' at offset 0x540 contains 1 entry: 173 | 偏移量 信息 类型 符号值 符号名称 + 加数 174 | 000000004018 000200000007 R_X86_64_JUMP_SLO 0000000000000000 puts@GLIBC_2.2.5 + 0 175 | 176 | The decoding of unwind sections for machine type Advanced Micro Devices X86-64 is not currently supported. 177 | 178 | Symbol table '.dynsym' contains 7 entries: 179 | Num: Value Size Type Bind Vis Ndx Name 180 | 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 181 | 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab 182 | 2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.2.5 (2) 183 | 3: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5 (2) 184 | 4: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__ 185 | 5: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable 186 | 6: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (2) 187 | 188 | Symbol table '.symtab' contains 64 entries: 189 | Num: Value Size Type Bind Vis Ndx Name 190 | 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 191 | 1: 00000000000002a8 0 SECTION LOCAL DEFAULT 1 192 | 2: 00000000000002c4 0 SECTION LOCAL DEFAULT 2 193 | 3: 00000000000002e4 0 SECTION LOCAL DEFAULT 3 194 | 4: 0000000000000308 0 SECTION LOCAL DEFAULT 4 195 | 5: 0000000000000328 0 SECTION LOCAL DEFAULT 5 196 | 6: 00000000000003d0 0 SECTION LOCAL DEFAULT 6 197 | 7: 0000000000000452 0 SECTION LOCAL DEFAULT 7 198 | 8: 0000000000000460 0 SECTION LOCAL DEFAULT 8 199 | 9: 0000000000000480 0 SECTION LOCAL DEFAULT 9 200 | 10: 0000000000000540 0 SECTION LOCAL DEFAULT 10 201 | 11: 0000000000001000 0 SECTION LOCAL DEFAULT 11 202 | 12: 0000000000001020 0 SECTION LOCAL DEFAULT 12 203 | 13: 0000000000001040 0 SECTION LOCAL DEFAULT 13 204 | 14: 00000000000011d8 0 SECTION LOCAL DEFAULT 14 205 | 15: 0000000000002000 0 SECTION LOCAL DEFAULT 15 206 | 16: 0000000000002014 0 SECTION LOCAL DEFAULT 16 207 | 17: 0000000000002048 0 SECTION LOCAL DEFAULT 17 208 | 18: 0000000000003de8 0 SECTION LOCAL DEFAULT 18 209 | 19: 0000000000003df0 0 SECTION LOCAL DEFAULT 19 210 | 20: 0000000000003df8 0 SECTION LOCAL DEFAULT 20 211 | 21: 0000000000003fd8 0 SECTION LOCAL DEFAULT 21 212 | 22: 0000000000004000 0 SECTION LOCAL DEFAULT 22 213 | 23: 0000000000004020 0 SECTION LOCAL DEFAULT 23 214 | 24: 0000000000004030 0 SECTION LOCAL DEFAULT 24 215 | 25: 0000000000000000 0 SECTION LOCAL DEFAULT 25 216 | 26: 0000000000000000 0 FILE LOCAL DEFAULT ABS init.c 217 | 27: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c 218 | 28: 0000000000001070 0 FUNC LOCAL DEFAULT 13 deregister_tm_clones 219 | 29: 00000000000010a0 0 FUNC LOCAL DEFAULT 13 register_tm_clones 220 | 30: 00000000000010e0 0 FUNC LOCAL DEFAULT 13 __do_global_dtors_aux 221 | 31: 0000000000004030 1 OBJECT LOCAL DEFAULT 24 completed.7286 222 | 32: 0000000000003df0 0 OBJECT LOCAL DEFAULT 19 __do_global_dtors_aux_fin 223 | 33: 0000000000001130 0 FUNC LOCAL DEFAULT 13 frame_dummy 224 | 34: 0000000000003de8 0 OBJECT LOCAL DEFAULT 18 __frame_dummy_init_array_ 225 | 35: 0000000000000000 0 FILE LOCAL DEFAULT ABS helloworld.c 226 | 36: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c 227 | 37: 000000000000211c 0 OBJECT LOCAL DEFAULT 17 __FRAME_END__ 228 | 38: 0000000000000000 0 FILE LOCAL DEFAULT ABS 229 | 39: 0000000000003df0 0 NOTYPE LOCAL DEFAULT 18 __init_array_end 230 | 40: 0000000000003df8 0 OBJECT LOCAL DEFAULT 20 _DYNAMIC 231 | 41: 0000000000003de8 0 NOTYPE LOCAL DEFAULT 18 __init_array_start 232 | 42: 0000000000002014 0 NOTYPE LOCAL DEFAULT 16 __GNU_EH_FRAME_HDR 233 | 43: 0000000000004000 0 OBJECT LOCAL DEFAULT 22 _GLOBAL_OFFSET_TABLE_ 234 | 44: 00000000000011d0 5 FUNC GLOBAL DEFAULT 13 __libc_csu_fini 235 | 45: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab 236 | 46: 0000000000004020 0 NOTYPE WEAK DEFAULT 23 data_start 237 | 47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts@@GLIBC_2.2.5 238 | 48: 0000000000004030 0 NOTYPE GLOBAL DEFAULT 23 _edata 239 | 49: 00000000000011d8 0 FUNC GLOBAL HIDDEN 14 _fini 240 | 50: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_ 241 | 51: 0000000000004020 0 NOTYPE GLOBAL DEFAULT 23 __data_start 242 | 52: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__ 243 | 53: 0000000000004028 0 OBJECT GLOBAL HIDDEN 23 __dso_handle 244 | 54: 0000000000002000 4 OBJECT GLOBAL DEFAULT 15 _IO_stdin_used 245 | 55: 0000000000001160 101 FUNC GLOBAL DEFAULT 13 __libc_csu_init 246 | 56: 0000000000004038 0 NOTYPE GLOBAL DEFAULT 24 _end 247 | 57: 0000000000001040 47 FUNC GLOBAL DEFAULT 13 _start 248 | 58: 0000000000004030 0 NOTYPE GLOBAL DEFAULT 24 __bss_start 249 | 59: 0000000000001139 34 FUNC GLOBAL DEFAULT 13 main 250 | 60: 0000000000004030 0 OBJECT GLOBAL HIDDEN 23 __TMC_END__ 251 | 61: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable 252 | 62: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@@GLIBC_2.2 253 | 63: 0000000000001000 0 FUNC GLOBAL HIDDEN 11 _init 254 | 255 | Version symbols section '.gnu.version' contains 7 entries: 256 | 地址:0000000000000452 Offset: 0x000452 Link: 5 (.dynsym) 257 | 000: 0 (*本地*) 0 (*本地*) 2 (GLIBC_2.2.5) 2 (GLIBC_2.2.5) 258 | 004: 0 (*本地*) 0 (*本地*) 2 (GLIBC_2.2.5) 259 | 260 | Version needs section '.gnu.version_r' contains 1 entry: 261 | 地址:0x0000000000000460 Offset: 0x000460 Link: 6 (.dynstr) 262 | 000000: Version: 1 文件:libc.so.6 计数:1 263 | 0x0010: Name: GLIBC_2.2.5 标志:无 版本:2 264 | 265 | Displaying notes found in: .note.ABI-tag 266 | 所有者 Data size Description 267 | GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) 268 | OS: Linux, ABI: 3.2.0 269 | 270 | Displaying notes found in: .note.gnu.build-id 271 | 所有者 Data size Description 272 | GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) 273 | Build ID: 7b05d407cc9308c507c5aad8955ef0d3db19563d 274 | --------------------------------------------------------------------------------