Example #1
0
def accept_file(li, filename):
    """
    Check if the file is of supported format

    @param li: a file-like object which can be used to access the input data
    @param n : format number. The function will be called with incrementing
                number until it returns zero
    @return: 0 - no more supported formats
                string "name" - format name to display in the chooser dialog
                dictionary { 'format': "name", 'options': integer }
                options: should be 1, possibly ORed with ACCEPT_FIRST (0x8000)
                to indicate preferred format
    """
    if not idaxml.is_ida_version_supported():
        return 0
    # read 16K bytes to allow for the DTD
    data = li.read(0x4000)
    # look for start of <PROGRAM> element
    start = data.find("<PROGRAM")
    if start >= 0:
        s = data.find("<PROCESSOR ")
        p = data[s + 11:]
        e = p.find("/>")
        proc = p[:e]
        ida_kernwin.info("Processor specified in the XML file is:\n" + proc +
                         "\n\nYou must select and set the compatible " +
                         "IDA processor type.")
        return {'format': "XML PROGRAM file", 'options': 0x8001}
    return 0
Example #2
0
 def init(self):
     """
     init function for XML Importer 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
Example #3
0
 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