MCPcopy Index your code
hub / github.com/csnewman/dextk

github.com/csnewman/dextk @v0.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.0 ↗ · + Follow
1,304 symbols 1,798 edges 26 files 0 documented · 0% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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 :  <init>
   invoke-direct method=java/lang/Object:<init>:([]):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
[...]

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 908
Struct 339
Function 51
Interface 3
TypeAlias 2
FuncType 1

Languages

Go100%

Modules by API surface

op.gen.go896 symbols
op_fmt.go150 symbols
code.go98 symbols
reader.go33 symbols
op_pseudo.go30 symbols
iter.go17 symbols
op.go12 symbols
op_reader.go9 symbols
internal/java/writer.go8 symbols
utils.go7 symbols
types.go7 symbols
internal/decompiler/decompiler.go6 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add dextk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page