https://github.com/csnewman/dextk Skip to content Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} csnewman / dextk Public * Notifications * Fork 0 * Star 17 Android dex file parser in Go License MIT license 17 stars 0 forks Activity Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights csnewman/dextk This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 1 tag Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/c] Use Git or checkout with SVN using the web URL. [gh repo clone csnewm] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @csnewman csnewman Add example ... c37a618 Dec 30, 2023 Add example c37a618 Git stats * 29 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time cmd/example Add example December 30, 2023 18:25 internal/gen Convert config map to array November 9, 2023 13:21 .golangci.yml Add class parsing October 2, 2023 15:46 LICENSE Initial commit October 1, 2023 12:52 README.md Add example December 30, 2023 18:25 cache.go Move reader cache to opts November 20, 2023 17:10 code.go Add instruction type to jump offset errors November 23, 2023 14:25 go.mod Move reader cache to opts November 20, 2023 17:10 go.sum Move reader cache to opts November 20, 2023 17:10 iter.go Add class iterator October 29, 2023 20:48 op.gen.go Convert config map to array November 9, 2023 13:21 op.go Convert config map to array November 9, 2023 13:21 op_fmt.go Add basic op high level parsing November 1, 2023 23:38 op_pseudo.go Add all missing instructions October 28, 2023 21:08 op_reader.go Convert config map to array November 9, 2023 13:21 opts.go Move reader cache to opts November 20, 2023 17:10 reader.go Move reader cache to opts November 20, 2023 17:10 types.go Support non-ascii strings November 9, 2023 12:00 utils.go Add utf8 precheck to optimise mutf8 decoding November 11, 2023 13:41 utils_test.go Rename to dextk October 25, 2023 20:19 View code dextk Features Example README.md dextk Android dex file parser in Go Features * String, classes and code parsing * Low memory usage * Mmap support * Designed to support stream processing (No requirement to load entire dex file into memory) Example go run ./cmd/example package main import ( "fmt" "log" "github.com/csnewman/dextk" "golang.org/x/exp/mmap" ) func main() { f, err := mmap.Open("classes.dex") if err != nil { log.Panicln(err) } defer f.Close() r, err := dextk.Read(f) if err != nil { log.Panicln(err) } ci := r.ClassIter() for ci.HasNext() { node, err := ci.Next() if err != nil { log.Panicln(err) } for _, method := range node.DirectMethods { fmt.Println(node.Name, ": ", method.Name) processMeth(r, method) } for _, method := range node.VirtualMethods { fmt.Println(node.Name, ": ", method.Name) processMeth(r, method) } } } func processMeth(r *dextk.Reader, m dextk.MethodNode) { if m.CodeOff == 0 { return } c, err := r.ReadCodeAndParse(m.CodeOff) if err != nil { log.Panic(err) } for _, o := range c.Ops { fmt.Println(" ", o) } } Output: android/support/v4/app/INotificationSideChannel$_Parcel : invoke-direct method=java/lang/Object::([]):V args=[0] return-void value=-1 [...] android/support/v4/app/INotificationSideChannel$_Parcel : readTypedObject invoke-virtual method=android/os/Parcel:readInt:([]):I args=[1] move-result dst=0 if-eqz a=0 b=-1 tgt=6 invoke-interface method=android/os/Parcelable$Creator:createFromParcel:([Landroid/os/Parcel;]):Ljava/lang/Object; args=[2 1] move-result-object dst=0 return-object value=0 const/4 dst=0 value='0' return-object value=0 [...] About Android dex file parser in Go Resources Readme License MIT license Activity Stars 17 stars Watchers 1 watching Forks 0 forks Report repository Releases 1 0.1: Initial release Latest Dec 30, 2023 Packages 0 No packages published Languages * Go 100.0% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.