For My Friend! :)

mail@pastecode.io avatar
unknown
python
2 years ago
690 B
5
Indexable
Never
#OSCommandInjection Sniffer
#@category Vulns
#@keybinding 
#@menupath 
#@toolbar

functions = ["doSystemCmd", "system", "exec", "execve"]

prgm = ghidra.program.flatapi.FlatProgramAPI(currentProgram)
listing = currentProgram.getListing()
fn = prgm.getFirstFunction()

while fn is not None:
 	if str(fn.getName()) in functions:
 		print("Function found: {}".format(fn.getName()))
 		print("Entry point: {}".format(fn.getEntryPoint()))
 		dummy = ghidra.util.task.TaskMonitor.DUMMY
 		called_by = fn.getCallingFunctions(dummy)

 		for caller in called_by:
 			print("{} is called by: {} at {}\n".format(fn.getName(), caller.getName(), caller.getEntryPoint()))
 	fn = prgm.getFunctionAfter(fn)