├── .gitignore
├── MakeFridaDebug.iml
├── README.md
├── bin
└── com
│ └── frida
│ └── debug
│ ├── MakeFridaDebug$1.class
│ ├── MakeFridaDebug.class
│ ├── ScriptManager.class
│ ├── ShortCutHandler.class
│ ├── frida
│ ├── FridaManager.class
│ ├── StdOutManager$1.class
│ └── StdOutManager.class
│ ├── ui
│ ├── MainView.class
│ ├── MainViewManager$1.class
│ ├── MainViewManager$10.class
│ ├── MainViewManager$11.class
│ ├── MainViewManager$2.class
│ ├── MainViewManager$3.class
│ ├── MainViewManager$4.class
│ ├── MainViewManager$5.class
│ ├── MainViewManager$6.class
│ ├── MainViewManager$7.class
│ ├── MainViewManager$8.class
│ ├── MainViewManager$9$1.class
│ ├── MainViewManager$9$2.class
│ ├── MainViewManager$9.class
│ └── MainViewManager.class
│ └── util
│ └── Util.class
├── build.xml
├── out
└── JebMakeFridaDebug.jar
└── src
└── com
└── frida
└── debug
├── MakeFridaDebug.java
├── ScriptManager.java
├── frida
└── FridaManager.java
├── ui
├── MainView.java
└── MainViewManager.java
└── util
└── Util.java
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .DS_Store
3 |
--------------------------------------------------------------------------------
/MakeFridaDebug.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MakeFridaDebug
2 | you can use frida in jeb !
3 |
4 | # Demo Video
5 |
6 | https://youtu.be/KCkQDSBQn5k
7 |
8 | # shortcut
9 |
10 | * ctrl + shift + f : add to frida hook list
11 | * ctrl + s : save the edit hook code
12 | * ctrl + k : clear log
13 |
14 |
15 |
16 | * This is not a finished version, so there may be bugs and dirty code
17 |
18 | happy reversing !
19 |
--------------------------------------------------------------------------------
/bin/com/frida/debug/MakeFridaDebug$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/MakeFridaDebug$1.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/MakeFridaDebug.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/MakeFridaDebug.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ScriptManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ScriptManager.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ShortCutHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ShortCutHandler.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/frida/FridaManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/frida/FridaManager.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/frida/StdOutManager$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/frida/StdOutManager$1.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/frida/StdOutManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/frida/StdOutManager.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainView.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainView.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$1.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$10.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$10.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$11.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$11.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$2.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$3.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$4.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$5.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$6.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$6.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$7.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$7.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$8.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$8.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$9$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$9$1.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$9$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$9$2.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager$9.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager$9.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/ui/MainViewManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/ui/MainViewManager.class
--------------------------------------------------------------------------------
/bin/com/frida/debug/util/Util.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/bin/com/frida/debug/util/Util.class
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/out/JebMakeFridaDebug.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adm1nkyj/MakeFridaDebug/dcc2a004ed402b72334c4ff6ede2c3758155dc23/out/JebMakeFridaDebug.jar
--------------------------------------------------------------------------------
/src/com/frida/debug/MakeFridaDebug.java:
--------------------------------------------------------------------------------
1 | package com.frida.debug;
2 |
3 | import com.frida.debug.ui.*;
4 | import com.pnfsoftware.jeb.core.*;
5 | import com.pnfsoftware.jeb.core.units.code.android.IDexDecompilerUnit;
6 | import com.pnfsoftware.jeb.core.units.code.android.IDexUnit;
7 | import com.pnfsoftware.jeb.core.units.code.android.dex.IDexClass;
8 | import com.pnfsoftware.jeb.core.units.code.android.dex.IDexMethod;
9 | import com.pnfsoftware.jeb.core.units.code.android.dex.IDexType;
10 | import com.pnfsoftware.jeb.core.units.codeobject.ICodeObjectUnit;
11 | import com.pnfsoftware.jeb.rcpclient.JebApp;
12 | import com.pnfsoftware.jeb.rcpclient.PublicContext;
13 | import com.pnfsoftware.jeb.rcpclient.RcpClientContext;
14 | import com.pnfsoftware.jeb.rcpclient.extensions.ConsoleViewer;
15 | import com.pnfsoftware.jeb.rcpclient.extensions.app.model.IMPartManager;
16 | import com.pnfsoftware.jeb.rcpclient.handlers.JebBaseHandler;
17 | import com.pnfsoftware.jeb.rcpclient.parts.*;
18 | import com.pnfsoftware.jeb.util.logging.GlobalLog;
19 | import com.pnfsoftware.jeb.util.logging.ILogger;
20 |
21 | import java.util.*;
22 | import java.util.List;
23 |
24 | import com.pnfsoftware.jeb.rcpclient.extensions.app.*;
25 | import org.eclipse.swt.widgets.*;
26 |
27 | import com.pnfsoftware.jeb.rcpclient.extensions.binding.KeyShortcutsManager;
28 |
29 | public class MakeFridaDebug extends AbstractEnginesPlugin {
30 | private static final ILogger logger = GlobalLog.getLogger(MakeFridaDebug.class);
31 | private JebApp appContext = null;
32 | private TerminalPartManager terminalPartManager = null;
33 | private RcpClientContext rcpContext = null;
34 | private IEnginesContext enginesContext = null;
35 | private MainView mainView = null;
36 | @Override
37 | public IPluginInformation getPluginInformation() {
38 | return new PluginInformation("Make Frida Debug",
39 | "make help to frida debug", "yongjin kim",
40 | new Version(1,0));
41 | }
42 | @Override
43 | public List extends IOptionDefinition> getExecutionOptionDefinitions() {
44 | return null;
45 | }
46 | public IEnginesContext getEnginesContext(){
47 | return this.enginesContext;
48 | }
49 | public RcpClientContext getRcpContext(){
50 | return this.rcpContext;
51 | }
52 | public JebApp getJebApp(){
53 | return this.appContext;
54 | }
55 | public TerminalPartManager getTerminalPartManager(){
56 | return this.terminalPartManager;
57 | }
58 |
59 | @Override
60 | public void dispose() {
61 | }
62 | public MainView getMainView(){
63 | return this.mainView;
64 | }
65 | @Override
66 | public void load(IEnginesContext context) {
67 | this.enginesContext = context;
68 | this.rcpContext = RcpClientContext.getInstance();
69 | this.appContext = (JebApp)rcpContext.getApp();
70 |
71 | mainView = new MainView(this);
72 | Display.getDefault().asyncExec(new Runnable() {
73 | @Override
74 | public void run() {
75 | rcpContext.getKeyAccelaratorManager().registerHandler(new ShortCutHandler(MakeFridaDebug.this, "noid", "noname", "notooltip", "noicon"));
76 | }
77 | });
78 |
79 | Display.getDefault().asyncExec(mainView);
80 |
81 | System.out.println("loaded plugin");
82 | }
83 |
84 | @Override
85 | public void execute(IEnginesContext context) {
86 | PublicContext ctx = new PublicContext(this.rcpContext);
87 |
88 | String current_addr = ctx.getFocusedAddress();
89 | IDexUnit codeUnit = ((IDexDecompilerUnit)ctx.getFocusedUnit().getParent()).getCodeUnit();
90 | IDexClass iClass = codeUnit.getClass(current_addr.split("->")[0]);
91 | IDexMethod iMethod = codeUnit.getMethod(current_addr);
92 |
93 | String currentClassName = iClass.getSignature(true);
94 | String originalClassName = iClass.getSignature(false);
95 |
96 | String currentMethodName = iMethod.getName(true);
97 | String originalMethodName = iMethod.getName(false);
98 |
99 | List argument_list = iMethod.getParameterTypes();
100 |
101 | if(originalMethodName.equals("")) {
102 | originalMethodName = "$init";
103 | }
104 |
105 | String args = "";
106 | String args_var = "";
107 | int i = 1;
108 | if(argument_list.size() > 0) {
109 | for (IDexType argument : argument_list) {
110 | String arg = this.toCanonicalName(argument.getSignature(false));
111 | args += String.format("'%s',", arg);
112 | args_var += String.format("arg%d,", i);
113 | i += 1;
114 | }
115 | args = args.substring(0, args.length()-1);
116 | args_var = args_var.substring(0, args_var.length()-1);
117 |
118 | }
119 | Boolean isVoidMethod = iMethod.getReturnType().getSignature().equals("V");
120 | Boolean isOverloadMethod = this.isOverloadMethod(iClass, iMethod);
121 |
122 | String overload = "";
123 | String hookCode = "";
124 | String var = randStr(8);
125 | if(isOverloadMethod){
126 | overload = String.format(".overload(%s)", args);
127 | }
128 |
129 | String defaultCode = String.format("\tconsole.log('%s / %s hooked');", toCanonicalName(currentClassName), currentMethodName);
130 |
131 | defaultCode += String.format("\n\t%s%s.%s.call(this%s);", isVoidMethod ? "" : "return ", var, originalMethodName, args_var.length()>0 ? String.format(", %s", args_var) : "");
132 | String template = String.format("var %s = Java.use('%s');\n", var, toCanonicalName(originalClassName));
133 | template += String.format("%s.%s%s.implementation = function(%s){\n", var, originalMethodName, overload, args_var);
134 | template += defaultCode + "\n}";
135 |
136 | this.mainView.getManager().addToHookTable(String.format("%s / %s hooked", toCanonicalName(currentClassName), currentMethodName), iMethod.getAddress(), template);
137 |
138 | }
139 | public Boolean isOverloadMethod(IDexClass iDexClass, IDexMethod iMethod) {
140 | List methodList = (List) iDexClass.getMethods();
141 | for(IDexMethod method : methodList){
142 | if(method.getName(false).equals(iMethod.getName(false))){
143 | return true;
144 | }
145 | }
146 | return false;
147 | }
148 | public String randStr(int length){
149 | int leftLimit = 97; // numeral 'a'
150 | int rightLimit = 122; // letter 'z'
151 | int targetStringLength = length;
152 | Random random = new Random();
153 |
154 | String generatedString = random.ints(leftLimit,rightLimit + 1)
155 | .filter(i -> (i <= 57 || i >= 65) && (i <= 90 || i >= 97))
156 | .limit(targetStringLength)
157 | .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
158 | .toString();
159 |
160 | return generatedString;
161 | }
162 | public String toCanonicalName(String mname) {
163 | mname = mname.replace('/', '.');
164 | HashMap table = new HashMap();
165 | table.put("C", "char");
166 | table.put("I", "int");
167 | table.put("B", "byte");
168 | table.put("Z", "boolean");
169 | table.put("F", "float");
170 | table.put("D", "double");
171 | table.put("S", "short");
172 | table.put("J", "long");
173 | table.put("V", "void");
174 | table.put("L", mname.length() > 2 ? mname.substring(1,mname.length()-1) : "none");
175 | table.put("[", mname);
176 |
177 | String result = table.get(mname.substring(0,1));
178 | return result;
179 | }
180 | @Override
181 | public void execute(IEnginesContext iEnginesContext, Map map) {
182 | System.out.println("execute2");
183 | }
184 |
185 | public static void main(String[] args){
186 | System.out.println("frida debug load");
187 | }
188 | }
189 | class ShortCutHandler extends JebBaseHandler{
190 | MakeFridaDebug context = null;
191 | public ShortCutHandler(MakeFridaDebug context, String id, String name, String tooltip, String icon) {
192 | super(id, name, tooltip, icon);
193 | setAccelerator(393286); // ctrl+shift+f
194 | this.context = context;
195 | }
196 |
197 | @Override // com.pnfsoftware.jeb.rcpclient.handlers.JebBaseHandler, com.pnfsoftware.jeb.rcpclient.extensions.binding.ActionEx
198 | public boolean canExecute() {
199 | return true;
200 | }
201 |
202 | @Override // com.pnfsoftware.jeb.rcpclient.handlers.JebBaseHandler, com.pnfsoftware.jeb.rcpclient.extensions.binding.ActionEx
203 | public void execute() {
204 | RcpClientContext context = RcpClientContext.getInstance();
205 | if (context == null) {
206 | throw new RuntimeException("The UI context cannot be retrieved");
207 | }
208 | this.context.execute(context.getEnginesContext());
209 | }
210 | }
211 |
212 |
--------------------------------------------------------------------------------
/src/com/frida/debug/ScriptManager.java:
--------------------------------------------------------------------------------
1 | package com.frida.debug;
2 |
3 | import com.frida.debug.frida.FridaManager;
4 | import java.io.*;
5 | import java.io.FileOutputStream;
6 | import java.util.HashMap;
7 | import java.util.Map;
8 | import java.util.Map.Entry;
9 |
10 | public class ScriptManager {
11 | private static HashMap hookCodeList = new HashMap();
12 | private static ScriptManager instance = null;
13 | public static String scriptCode = "";
14 | public static String utilScript = "";
15 | public static ScriptManager getInstance(){
16 | if(instance == null){
17 | instance = new ScriptManager();
18 | }
19 | return instance;
20 | }
21 | public static String getUtilScript(){
22 | return utilScript;
23 | }
24 | public static void setUtilScript(String script){
25 | utilScript = script;
26 | }
27 | public static HashMap getHookCodeList(){
28 | return hookCodeList;
29 | }
30 | public static String get(int index) {
31 | return hookCodeList.get(index);
32 | }
33 |
34 | public static void put(int index, String hookCode) {
35 | hookCodeList.put(index, hookCode);
36 | reloadScript();
37 | }
38 | public static void del(int index) {
39 | hookCodeList.remove(index);
40 | reloadScript();
41 | }
42 | public static void reloadScript() {
43 | // String scriptPath = FridaManager.scriptPath;
44 | // System.out.println(scriptPath);
45 | scriptCode = "Java.perform(function() {\n\n";
46 | if(utilScript.length() > 0){
47 | scriptCode += utilScript + "\n";
48 | }
49 | for(Entryentry : hookCodeList.entrySet()){
50 | scriptCode += entry.getValue() + "\n";
51 | }
52 | // System.out.println(scriptCode);
53 | scriptCode += "\n});";
54 |
55 | try {
56 | File file = new File(FridaManager.scriptPath);
57 | FileOutputStream fio = new FileOutputStream(file);
58 | fio.write(scriptCode.getBytes());
59 | fio.close();
60 | }
61 | catch (Exception e){
62 | return;
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/com/frida/debug/frida/FridaManager.java:
--------------------------------------------------------------------------------
1 | package com.frida.debug.frida;
2 |
3 | import com.frida.debug.util.Util;
4 | import org.eclipse.swt.widgets.Display;
5 | import org.eclipse.swt.widgets.Text;
6 |
7 | import java.io.*;
8 |
9 | public class FridaManager extends Thread{
10 | public static FridaManager fridaManager = null;
11 | public String attachPid = "";
12 | public static String scriptPath = "";
13 | public Text resultTextBox = null;
14 | private StdOutManager stdOutManager = null;
15 | public static Boolean stopFlag = false;
16 |
17 | @Override
18 | public State getState(){
19 | return State.NEW;
20 | }
21 | public FridaManager(){
22 | scriptPath = String.format("%s/%s", System.getProperty("java.io.tmpdir"), "fridacode_"+ Util.randStr(8)+".js");
23 | System.out.println(scriptPath);
24 | try {
25 | File file = new File(scriptPath);
26 | FileOutputStream fio = new FileOutputStream(file);
27 | fio.write("Java.perform(function(){})".getBytes());
28 | fio.close();
29 | }
30 | catch (Exception e){
31 | System.out.println(e.getMessage());
32 | }
33 | }
34 | public void setAttachPid(String pid){
35 | this.attachPid = pid;
36 | }
37 | public void setResultTextBox(Text textBox){
38 | this.resultTextBox = textBox;
39 | }
40 |
41 | @Override
42 | public void run(){
43 | this.stopFlag = false;
44 | System.out.println("attach to " + this.attachPid);
45 | String[] cmd = {"frida", "-U", "-p", this.attachPid, "-l", scriptPath};
46 | ProcessBuilder builder = null;
47 | Process process = null;
48 | try {
49 | builder = new ProcessBuilder(cmd);
50 | process = builder.start();
51 | // OutputStream stdin = process.getOutputStream();
52 | InputStream stdout = process.getInputStream();
53 | // InputStream stderr = process.getErrorStream();
54 | // this.stdin = stdin;
55 | BufferedReader reader = new BufferedReader(new InputStreamReader(stdout));
56 | stdOutManager = new StdOutManager(reader, resultTextBox);
57 | stdOutManager.setDaemon(true);
58 | stdOutManager.start();
59 | process.waitFor();
60 | }
61 | catch(IOException e) {
62 | System.out.println(e.getMessage());
63 | } catch (InterruptedException e) {
64 | System.out.println("stop");
65 | process.destroy();
66 | this.stopFlag = true;
67 |
68 | return;
69 | }
70 | }
71 |
72 |
73 | }
74 | class StdOutManager extends Thread{
75 | private BufferedReader reader = null;
76 | private Text resultTextBox = null;
77 | public StdOutManager(BufferedReader reader, Text resultTextBox){
78 | this.reader= reader;
79 | this.resultTextBox = resultTextBox;
80 | }
81 | @Override
82 | public void run() {
83 | String result = "";
84 | while (true) {
85 | try {
86 | if(FridaManager.stopFlag){
87 | return;
88 | }
89 | if (this.reader.ready()) {
90 | result += (char) this.reader.read();
91 | } else {
92 | if (result.length() > 0) {
93 | String finalResult = result;
94 | result = "";
95 | Display.getDefault().asyncExec(new Runnable() {
96 | @Override
97 | public void run() {
98 | String prevText = resultTextBox.getText();
99 |
100 | String tmp = prevText + finalResult;
101 | resultTextBox.setText(tmp);
102 | }
103 | });
104 |
105 | }
106 | }
107 | } catch (Exception e) {
108 | break;
109 | }
110 | }
111 | return;
112 |
113 |
114 | }
115 | }
--------------------------------------------------------------------------------
/src/com/frida/debug/ui/MainView.java:
--------------------------------------------------------------------------------
1 | package com.frida.debug.ui;
2 |
3 | import com.frida.debug.MakeFridaDebug;
4 | import com.pnfsoftware.jeb.rcpclient.extensions.app.*;
5 |
6 | public class MainView implements Runnable {
7 | MakeFridaDebug context = null;
8 | Part fridaConsole = null;
9 | private MainViewManager mainViewManager = null;
10 | public MainView(MakeFridaDebug context){
11 | this.context = context;
12 | }
13 |
14 | private void initConsoleView() {
15 | this.fridaConsole = this.context.getJebApp().folderConsoles.addPart();
16 | this.fridaConsole.setElementId("frida.console.debug");
17 | this.fridaConsole.setManager(this.context.getTerminalPartManager());
18 | this.fridaConsole.setLabel("Frida Console");
19 | mainViewManager = new MainViewManager(this.context.getRcpContext(), this.context);
20 | this.fridaConsole.setManager(mainViewManager);
21 | Folder folder = (Folder) this.fridaConsole.getParentElement();
22 | folder.showPart(this.fridaConsole);
23 | }
24 | public MainViewManager getManager(){
25 | return this.mainViewManager;
26 | }
27 | @Override
28 | public void run() {
29 | this.initConsoleView();
30 | }
31 |
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/src/com/frida/debug/ui/MainViewManager.java:
--------------------------------------------------------------------------------
1 | package com.frida.debug.ui;
2 |
3 | import com.frida.debug.MakeFridaDebug;
4 | import com.frida.debug.ScriptManager;
5 | import com.frida.debug.frida.FridaManager;
6 | import com.frida.debug.util.Util;
7 | import com.pnfsoftware.jeb.client.api.ButtonGroupType;
8 | import com.pnfsoftware.jeb.client.api.IconType;
9 | import com.pnfsoftware.jeb.core.units.code.ICodeUnit;
10 | import com.pnfsoftware.jeb.core.units.code.android.adb.*;
11 | import com.pnfsoftware.jeb.rcpclient.PublicContext;
12 | import com.pnfsoftware.jeb.rcpclient.RcpClientContext;
13 | import com.pnfsoftware.jeb.rcpclient.actions.GraphicalActionExecutor;
14 | import com.pnfsoftware.jeb.rcpclient.extensions.app.model.IMPart;
15 | import com.pnfsoftware.jeb.rcpclient.parts.AbstractPartManager;
16 | import org.eclipse.swt.SWT;
17 | import org.eclipse.swt.custom.SashForm;
18 | import org.eclipse.swt.events.*;
19 | import org.eclipse.swt.layout.GridData;
20 | import org.eclipse.swt.layout.GridLayout;
21 | import org.eclipse.swt.widgets.*;
22 |
23 | import java.util.ArrayList;
24 | import java.util.Arrays;
25 | import java.util.List;
26 | public class MainViewManager extends AbstractPartManager {
27 | public Table hookTable = null;
28 | public Text codeTextBox = null;
29 | public Text resultTextBox = null;
30 | public MakeFridaDebug mainContext = null;
31 | public RcpClientContext rcpClientContext = null;
32 | public Combo deviceCombo = null;
33 | public Combo processListCombo = null;
34 | public List adbDeviceList = null;
35 | public List processList = null;
36 | public static AdbDevice currentDevice = null;
37 | public static AdbProcess currentProcess = null;
38 | public FridaManager fridaManager = null;
39 | public MainViewManager(RcpClientContext context, MakeFridaDebug mainContext) {
40 | super(context);
41 | this.rcpClientContext = context;
42 | this.mainContext = mainContext;
43 | }
44 |
45 | @Override
46 | public boolean createView(Composite composite, IMPart imPart) {
47 | Composite mainComposite = composite;
48 | GridLayout fill = new GridLayout(1, false);
49 | fill.marginTop = 10;
50 | mainComposite.setLayout(fill);
51 |
52 | Composite headComposite = new Composite(mainComposite, 0);
53 | // headComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
54 | headComposite.setLayout(new GridLayout(10, false));
55 |
56 | Label label1 = new Label(headComposite, 0);
57 | label1.setText("Device : ");
58 | this.adbDeviceList = Util.getAdbDeviceList();
59 | String items[] = new String[this.adbDeviceList.size()];
60 | for(int i=0; i getAdbDeviceList() {
12 | AdbWrapperFactory adbWrapperFactory = null;
13 | try {
14 | adbWrapperFactory = new AdbWrapperFactory();
15 | adbWrapperFactory.initialize();
16 | return adbWrapperFactory.listDevices();
17 | }
18 | catch(IOException e){
19 | return null;
20 | }
21 | }
22 | public static String randStr(int length){
23 | int leftLimit = 97; // numeral 'a'
24 | int rightLimit = 122; // letter 'z'
25 | int targetStringLength = length;
26 | Random random = new Random();
27 |
28 | String generatedString = random.ints(leftLimit,rightLimit + 1)
29 | .filter(i -> (i <= 57 || i >= 65) && (i <= 90 || i >= 97))
30 | .limit(targetStringLength)
31 | .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
32 | .toString();
33 |
34 | return generatedString;
35 | }
36 | static public String getCurrentPackageName(RcpClientContext rcpClientContext){
37 | try {
38 | String packageName = rcpClientContext.getMainProject().getLiveArtifact(0).getMainUnit().getName();
39 | return packageName;
40 | }
41 | catch(Exception e){
42 | return "";
43 | }
44 | }
45 | static public List getProcessList(AdbDevice adbDevice){
46 | if(adbDevice == null){
47 | return null;
48 | }
49 | try{
50 | AdbWrapper adbWrapper = (new AdbWrapperFactory()).createWrapper(adbDevice.getSerial());
51 | return adbWrapper.listProcesses();
52 | }
53 | catch(IOException e){
54 | return null;
55 | }
56 |
57 | }
58 | }
59 |
--------------------------------------------------------------------------------