| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,22 @@ | |||
| 1 | + //?type=gendec-ast | ||
| 2 | + import com.pnfsoftware.jeb.core.Version; | ||
| 3 | + import com.pnfsoftware.jeb.core.units.code.asm.decompiler.ast.opt.AbstractCOptimizer; | ||
| 4 | + | ||
| 5 | + /** | ||
| 6 | + * A sample gendec AST optimizer plugin. | ||
| 7 | + * | ||
| 8 | + * @author Nicolas Falliere | ||
| 9 | + * | ||
| 10 | + */ | ||
| 11 | + public class COptSampleJava extends AbstractCOptimizer { | ||
| 12 | + | ||
| 13 | + public COptSampleJava() { | ||
| 14 | + super(); | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + @Override | ||
| 18 | + public int perform() { | ||
| 19 | + logger.debug("COptSampleJava: the optimizer is running"); | ||
| 20 | + return 0; | ||
| 21 | + } | ||
| 22 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,31 @@ | |||
| 1 | + #?type=gendec-ast | ||
| 2 | + from com.pnfsoftware.jeb.core.units.code.asm.decompiler.ast.opt import AbstractCOptimizer | ||
| 3 | + | ||
| 4 | + ''' | ||
| 5 | + Skeleton for an Java Abstract Syntax Tree (AST) optimizer plugin for gendec, JEB's generic decompiler. | ||
| 6 | + This Python plugin is executed during the decompilation pipeline of a method. | ||
| 7 | + | ||
| 8 | + How to use: | ||
| 9 | + - Drop this file in your JEB's coreplugins/scripts/ sub-directory | ||
| 10 | + - Make sure to have the setting `.LoadPythonPlugins = true` in your JEB's bin/jeb-engines.cfg file | ||
| 11 | + | ||
| 12 | + For additional information regarding dexdec AST optimizer plugins, refer to: | ||
| 13 | + - the Manual (www.pnfsoftware.com/jeb/manual) | ||
| 14 | + - the API documentation: TODO | ||
| 15 | + ''' | ||
| 16 | + class COptSamplePython(AbstractCOptimizer): | ||
| 17 | + # note: Python script optimizers are singleton instances! | ||
| 18 | + # the engine will instantiate and provide a single instance for all decompilation threads | ||
| 19 | + # therefore, if you are using object attributes, make sure to provide support for concurrency | ||
| 20 | + # (this restriction does not apply to Java script optimizers, as well as full-blown jar optimizers; | ||
| 21 | + # each decompilation thread has its own unique instance of such optimizer objects) | ||
| 22 | + # for this reason (as well as others), moderately complex AST optimizers should be written in Java | ||
| 23 | + | ||
| 24 | + def __init__(self): | ||
| 25 | + self.logger.debug('COptSamplePython: instantiated') | ||
| 26 | + | ||
| 27 | + def perform(self): | ||
| 28 | + self.logger.debug('COptSamplePython: executed') | ||
| 29 | + | ||
| 30 | + # if a value >0 is returned, the decompiler will assume that AST is being transformed and this AST optimizer will be called again | ||
| 31 | + return 0 # no optimization is performed | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + //?type=dexdec-ir | ||
| 1 | 2 | import java.util.List; | |
| 2 | 3 | ||
| 3 | 4 | import javax.crypto.SecretKey; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + //?type=dexdec-ir | ||
| 1 | 2 | import com.pnfsoftware.jeb.core.units.code.android.ir.AbstractDOptimizer; | |
| 2 | 3 | import com.pnfsoftware.jeb.core.units.code.android.ir.DexDecEvaluationException; | |
| 3 | 4 | import com.pnfsoftware.jeb.core.units.code.android.ir.IDVisitor; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + //?type=dexdec-ir | ||
| 1 | 2 | import com.pnfsoftware.jeb.core.units.code.android.ir.AbstractDOptimizer; | |
| 2 | 3 | import com.pnfsoftware.jeb.core.units.code.android.ir.IDVisitor; | |
| 3 | 4 | import com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + //?type=dexdec-ir | ||
| 1 | 2 | import com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock; | |
| 2 | 3 | import com.pnfsoftware.jeb.core.units.code.android.ir.AbstractDOptimizer; | |
| 3 | 4 | import com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + #?type=dexdec-ir | ||
| 1 | 2 | from com.pnfsoftware.jeb.core.units.code.android.ir import AbstractDOptimizer, IDEmulatorHooks | |
| 2 | 3 | ''' | |
| 3 | 4 | dexdec IR plugin showing how to set up an emulator hooks for internal dex methods. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + //?type=dexdec-ir | ||
| 1 | 2 | import java.util.List; | |
| 2 | 3 | ||
| 3 | 4 | import com.pnfsoftware.jeb.core.units.code.android.ir.AbstractDOptimizer; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + #?type=dexdec-ir | ||
| 1 | 2 | from com.pnfsoftware.jeb.core.units.code.android.ir import AbstractDOptimizer, IDSandboxHooks | |
| 2 | 3 | from com.pnfsoftware.jeb.util.base import Wrapper | |
| 3 | 4 | ''' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + //?type=dexdec-ir | ||
| 1 | 2 | import com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock; | |
| 2 | 3 | import com.pnfsoftware.jeb.core.units.code.android.ir.AbstractDOptimizer; | |
| 3 | 4 | import com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments