-
Notifications
You must be signed in to change notification settings - Fork 4
/
solve_3.java
45 lines (35 loc) · 1.22 KB
/
solve_3.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
//get references to function calls
//@author
//@category GhidraGolf
//@keybinding
//@menupath
//@toolbar
import java.util.ArrayList;
import ghidra.app.script.GhidraScript;
import ghidra.program.model.listing.*;
import ghidra.program.model.symbol.*;
import ghidra.program.model.address.*;
public class solve_3 extends GhidraScript {
@Override
protected void run() throws Exception {
String functionName = "flag";
Address entryPoint;
Reference[] refs = new Reference[100];
FunctionManager fm = getCurrentProgram().getFunctionManager();
FunctionIterator functions = fm.getFunctions(true);
for (Function function : functions) {
if (function.getName().equals(functionName)) {
/*
entryPoint = ????; // get the entry point of the function
refs = ?????; // get the references to entryPoint
*/
entryPoint = function.getEntryPoint();
refs = (getReferencesTo(entryPoint));
break;
}
}
for (Reference reference : refs) {
println("Reference to address: " + reference.getFromAddress());
}
}
}