-
Notifications
You must be signed in to change notification settings - Fork 30
/
Cantordust.java
64 lines (53 loc) · 2.15 KB
/
Cantordust.java
1
2
3
4
5
6
7
8
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
63
64
// CantorDust
// @author Battelle Memorial Institute
// @category Binary Visualization
// @keybinding alt C
// @toolbar resources/icons/icon.png
import java.awt.Dimension;
import javax.swing.*;
import resources.MainInterface;
import resources.GhidraSrc;
// import ghidra.app.script.GhidraScriptUtil;
public class Cantordust extends GhidraSrc {
public resources.MainInterface mainInterface;
public String currentDirectory;
public String name;
public JFrame frame;
@Override
protected void run() throws Exception {
this.currentDirectory = sourceFile.getAbsolutePath();
this.currentDirectory = currentDirectory.substring(0, currentDirectory.length()-15);
if(currentProgram==null){
printf("Open a file to examine with CantorDust before continuing!\n");
return;
}
this.name = currentProgram.getName();
this.frame = new JFrame();
this.frame.setTitle(String.format("..cantor.dust.. : %s", name));
// potentially could be used for cleanup replacement. currently deprecated...
// print(""+GhidraScriptUtil.getExplodedCompiledSourceBundlePaths());
this.mainInterface = new resources.MainInterface(getData(), this, frame);
this.frame.getContentPane().add(mainInterface);
this.frame.setSize(resources.MainInterface.getWindowWidth(), resources.MainInterface.getWindowHeight());
this.frame.setMinimumSize(new Dimension(resources.MainInterface.getWindowWidth(), resources.MainInterface.getWindowHeight()));
this.frame.setVisible(true);
this.frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
}
@Override
public String getName(){
return currentProgram.getName();
}
@Override
public String getCurrentDirectory(){
return this.currentDirectory;
}
@Override
public MainInterface getMainInterface(){
return this.mainInterface;
}
@Override
public void changeTitle(String s){
this.frame.setTitle(String.format("Cantordust : %s",s));
this.frame.repaint();
}
}