{"id":373,"date":"2015-09-28T13:56:47","date_gmt":"2015-09-28T21:56:47","guid":{"rendered":"https:\/\/www.pnfsoftware.com\/blog\/?p=373"},"modified":"2018-12-19T13:37:59","modified_gmt":"2018-12-19T21:37:59","slug":"setting-up-jeb2-to-parse-odex-files","status":"publish","type":"post","link":"https:\/\/www.pnfsoftware.com\/blog\/setting-up-jeb2-to-parse-odex-files\/","title":{"rendered":"Setting up JEB2 to parse optimized DEX (odex) files"},"content":{"rendered":"<p><em>This blog assumes that\u00a0<a href=\"https:\/\/www.pnfsoftware.com\/jeb2\">JEB version 2.1.0<\/a> or above is used along with the <a href=\"https:\/\/github.com\/pnfsoftware\/jeb2-plugin-oat\/releases\">OAT plugin 1.0.2<\/a>\u00a0or above.<\/em><\/p>\n<p>Parsing support for optimized DEX files\u00a0was added to JEB2 to allow the analysis of non-deodex&#8217;ed files. Since ODEX files are target-dependant, the executing Dalvik VM is no longer restricted to regular opcodes. ODEX files may make use of &#8220;illegal&#8221; opcodes, optimized opcodes, or even the once regular but now dead extended\u00a0opcodes. Whenever possible, parsing will take place, and instructions displayed in the assembly view.<\/p>\n<p>In the screenshot\u00a0below, note that <strong>opcode \u00a043h<\/strong> (illegal for non-optimized code) is used, as well as <strong>iput-wide-volatile<\/strong> (optimized opcode for field access).<\/p>\n<p><a href=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/09\/f2139276038e8a7354aa21dd3208b03a.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/09\/f2139276038e8a7354aa21dd3208b03a.png\" alt=\"\" width=\"394\" height=\"264\" \/><\/a><\/p>\n<p>In that second screenshot, notice the use of a <strong>non-standard jumbo opcode<\/strong>.<\/p>\n<p><a href=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/09\/2369e314bdcc9b27ec92507fb1908f5c.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/09\/2369e314bdcc9b27ec92507fb1908f5c.png\" alt=\"\" width=\"653\" height=\"127\" \/><\/a><\/p>\n<p>If you are analyzing an extracted ODEX file (one whose header bytes start with <strong>&#8220;dey\\n&#8221;<\/strong>), then all versions of JEB2 shall be able to process it. The Project tree will look like the following (<strong>project &gt; artifact &gt; odex unit &gt; dex unit<\/strong>):<\/p>\n<p><a href=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/09\/05c14778a0ed5bdcc560adfa8ac7a42f.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/09\/05c14778a0ed5bdcc560adfa8ac7a42f.png\" alt=\"\" width=\"723\" height=\"250\" \/><\/a><\/p>\n<p>If you are analyzing an OAT file (DEX file precompiled to native and ready to run within the ART runtime), then you will need one additional plugin: the <strong>OAT plugin<\/strong>. This plugin can be registered on Business and Enterprise versions of JEB2. (<em>Note: older versions of JEB 2.0, mainly versions 2.0.12 and above, require the third-party <strong>ELF plugin<\/strong> as well.<\/em>)<\/p>\n<p>Installation steps:<\/p>\n<ol>\n<li>Visit\u00a0our <a href=\"https:\/\/github.com\/pnfsoftware\">public GitHub account<\/a><\/li>\n<li>Download the <a href=\"https:\/\/github.com\/pnfsoftware\/jeb2-plugin-oat\/releases\">latest package of the OAT plugin<\/a><\/li>\n<li>Drop the JAR file in the coreplugins\u00a0folder within your JEB2 installation directory<\/li>\n<li>Restart JEB2. The lines &#8220;Plugin loaded &#8230; OATPlugin&#8221; should be visible in the console<\/li>\n<\/ol>\n<figure style=\"width: 419px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/09\/c9c3e2c7737da5294b3c7af71ac0f583.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/09\/c9c3e2c7737da5294b3c7af71ac0f583.png\" alt=\"\" width=\"419\" height=\"317\" \/><\/a><figcaption class=\"wp-caption-text\">The OAT plugin is loaded (the ELF third-party plugin is no longer required with JEB 2.1+)<\/figcaption><\/figure>\n<p>Now, you may open an OAT file. The project view should be similar to the following (<strong>project &gt; artifact &gt; elf unit &gt; oat unit &gt; dex or odex unit<\/strong>):<\/p>\n<p><a href=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/09\/4aeb7b051351f7c8d0654179d13213f1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/09\/4aeb7b051351f7c8d0654179d13213f1.png\" alt=\"\" width=\"1167\" height=\"683\" \/><\/a><\/p>\n<p>Here is another example of an ELF file containing an OAT section, containing 2 optimized DEX files:<\/p>\n<figure style=\"width: 681px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/12\/929b6b65c770f1b1dfa95ab89be55dc7.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.pnfsoftware.com\/blog\/wp-content\/uploads\/2015\/12\/929b6b65c770f1b1dfa95ab89be55dc7.png\" alt=\"\" width=\"681\" height=\"411\" \/><\/a><figcaption class=\"wp-caption-text\">An ELF\/OAT file containing 2 DEX files<\/figcaption><\/figure>\n<p>That is it for this blog post. We are planning to release more documentation and tutorials about our APIs In the coming days. In the meantime, remember to check our open-source plugins on GitHub, they are great starting points for anyone interested in writing their own parsers or back-end plugins.\u00a0Stay tuned, and happy analysis.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog assumes that\u00a0JEB version 2.1.0 or above is used along with the OAT plugin 1.0.2\u00a0or above. Parsing support for optimized DEX files\u00a0was added to JEB2 to allow the analysis of non-deodex&#8217;ed files. Since ODEX files are target-dependant, the executing Dalvik VM is no longer restricted to regular opcodes. ODEX files may make use of &hellip; <a href=\"https:\/\/www.pnfsoftware.com\/blog\/setting-up-jeb2-to-parse-odex-files\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Setting up JEB2 to parse optimized DEX (odex) files<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,8],"tags":[],"class_list":["post-373","post","type-post","status-publish","format-standard","hentry","category-android","category-jeb2"],"_links":{"self":[{"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/posts\/373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/comments?post=373"}],"version-history":[{"count":0,"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/posts\/373\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/media?parent=373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/categories?post=373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/tags?post=373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}