mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +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
76
GhidraBuild/IDAPro/Python/7xx/plugins/xml_exporter.py
Normal file
76
GhidraBuild/IDAPro/Python/7xx/plugins/xml_exporter.py
Normal file
|
@ -0,0 +1,76 @@
|
|||
#---------------------------------------------------------------------
|
||||
# xmlexp.py - IDA XML Exporter plugin
|
||||
#---------------------------------------------------------------------
|
||||
"""
|
||||
Plugin for IDA which exports a XML PROGRAM document file from a database.
|
||||
This file must be placed in the IDA plugins directory.
|
||||
The file idaxml.py must be placed in the IDA python directory.
|
||||
"""
|
||||
|
||||
import ida_auto
|
||||
import ida_idaapi
|
||||
import ida_kernwin
|
||||
import idaxml
|
||||
import idc
|
||||
|
||||
|
||||
class XmlExporterPlugin(ida_idaapi.plugin_t):
|
||||
"""
|
||||
XML Exporter plugin class
|
||||
"""
|
||||
flags = 0
|
||||
comment = "Export database as XML file"
|
||||
help = "Export database as XML <PROGRAM> document"
|
||||
wanted_name = "XML Exporter"
|
||||
wanted_hotkey = "Ctrl-Shift-x"
|
||||
|
||||
|
||||
def init(self):
|
||||
"""
|
||||
init function for XML Exporter plugin.
|
||||
|
||||
Returns:
|
||||
Constant PLUGIN_OK if this IDA version supports the plugin,
|
||||
else returns PLUGIN_SKIP if this IDA is older than the supported
|
||||
baseline version.
|
||||
"""
|
||||
if idaxml.is_ida_version_supported():
|
||||
return ida_idaapi.PLUGIN_OK
|
||||
else:
|
||||
return ida_idaapi.PLUGIN_SKIP
|
||||
|
||||
|
||||
def run(self, arg):
|
||||
"""
|
||||
run function for XML Exporter plugin.
|
||||
|
||||
Args:
|
||||
arg: Integer, non-zero value enables auto-run feature for
|
||||
IDA batch (no gui) processing mode. Default is 0.
|
||||
"""
|
||||
st = idc.set_ida_state(idc.IDA_STATUS_WORK)
|
||||
xml = idaxml.XmlExporter(arg)
|
||||
try:
|
||||
try:
|
||||
xml.export_xml()
|
||||
except idaxml.Cancelled:
|
||||
ida_kernwin.hide_wait_box()
|
||||
msg = "XML Export cancelled!"
|
||||
print "\n" + msg
|
||||
idc.warning(msg)
|
||||
except:
|
||||
ida_kernwin.hide_wait_box()
|
||||
msg = "***** Exception occurred: XML Exporter failed! *****"
|
||||
print "\n" + msg + "\n", sys.exc_type, sys.exc_value
|
||||
idc.warning(msg)
|
||||
finally:
|
||||
xml.cleanup()
|
||||
ida_auto.set_ida_state(st)
|
||||
|
||||
|
||||
def term(self):
|
||||
pass
|
||||
|
||||
|
||||
def PLUGIN_ENTRY():
|
||||
return XmlExporterPlugin()
|
Loading…
Add table
Add a link
Reference in a new issue