mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
Candidate release of source code.
This commit is contained in:
parent
db81e6b3b0
commit
79d8f164f8
12449 changed files with 2800756 additions and 16 deletions
|
@ -0,0 +1,18 @@
|
|||
# Example of being imported by a Ghidra Python script/module
|
||||
# @category: Examples.Python
|
||||
|
||||
# The following line will fail if this module is imported from external_module_caller.py,
|
||||
# because only the script that gets directly launched by Ghidra inherits fields and methods
|
||||
# from the GhidraScript/FlatProgramAPI.
|
||||
try:
|
||||
print currentProgram.getName()
|
||||
except NameError:
|
||||
print "Failed to get the program name"
|
||||
|
||||
# The Python module that Ghidra directly launches is always called __main__. If we import
|
||||
# everything from that module, this module will behave as if Ghidra directly launched it.
|
||||
from __main__ import *
|
||||
|
||||
# The below method call should now work
|
||||
print currentProgram.getName()
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue