示例#1
0
    def Show(self):
        """
        Creates the form and brings it to the front.
        """

        try:
            input_md5 = idc.retrieve_input_file_md5()
        except:
            input_md5 = idc.GetInputMD5()

        if input_md5 is None:
            return
        else:
            name = "{}".format(config['name'])

            try:
                options = PluginForm.WCLS_CLOSE_LATER |\
                        PluginForm.WCLS_SAVE |\
                        PluginForm.WOPN_RESTORE
            except:
                options = PluginForm.FORM_CLOSE_LATER |\
                          PluginForm.FORM_SAVE |\
                          PluginForm.FORM_RESTORE

            return PluginForm.Show(self, name, options=options)
示例#2
0
def find_input_file():
    """
    Description:
        Check whether or not IDA knows where the original file used to create the IDB is.
        If IDA doesn't know, check the IDA's directory for the file.

    Output:
        Returns True if the input file was located, False if it was not.
    """
    global INPUT_FILE_PATH
    ida_path = INPUT_FILE_PATH
    if not os.path.exists(ida_path):
        # If IDA does not know, check if the (correct) file is sitting next to the IDB.
        local_path = os.path.join(idautils.GetIdbDir(),
                                  idc.get_root_filename())
        if (os.path.exists(local_path) and hashlib.md5(
                open(local_path, "rb").read()).hexdigest().upper()
                == idc.retrieve_input_file_md5()):
            INPUT_FILE_PATH = local_path
            logger.debug("Guessed the input file path: " + INPUT_FILE_PATH)
            logger.debug("IDA thought it was:          " + ida_path)
            return True
        else:
            return False
    else:
        return True
示例#3
0
def GetInputFileMD5():
    """
    Return the MD5 hash of the input binary file

    @return: MD5 string or None on error
    """
    return idc.retrieve_input_file_md5()
示例#4
0
 def Show(self):
     if idc.retrieve_input_file_md5() is None:
         return
     else:
         return PluginForm.Show(
             self,
             NAME,
             options=(PluginForm.WCLS_CLOSE_LATER | PluginForm.WOPN_RESTORE
                      | PluginForm.WCLS_SAVE))
示例#5
0
    def PopulateForm(self):
        layout = QVBoxLayout()
        label = QtWidgets.QLabel()
        label.setText("Proposed function names for sample %s" %
                      idc.retrieve_input_file_md5())

        self.funcinfos_table = SkelFunctionInfosList(self.settings_filename)

        layout.addWidget(label)
        layout.addWidget(self.funcinfos_table)
        self.setLayout(layout)
示例#6
0
    def PopulateForm(self):
        layout = QVBoxLayout()
        label = QtWidgets.QLabel()
        label.setText("Proposed function names for sample %s" %
                      idc.retrieve_input_file_md5())

        self.funcinfos_table = SkelFunctionInfosList(self.settings_filename)

        layout.addWidget(label)
        layout.addWidget(self.funcinfos_table)
        self.setLayout(layout)
示例#7
0
 def get_sample_id(self):
     """
         Query the server for the sample ID
     """
     endpoint = "/api/1.0/samples/"
     endpoint += lower(idc.retrieve_input_file_md5())
     endpoint += "/"
     try:
         data = self.poli_get(endpoint)
         if data["sample_id"] is not None:
             return data["sample_id"]
         else:
             return False
     except BaseException:  # 404?
         return False
示例#8
0
    def PopulateForm(self):
        layout = QVBoxLayout()
        label = QtWidgets.QLabel()
        label.setText("Notes about sample %s" % idc.retrieve_input_file_md5())

        self.editor = QtWidgets.QTextEdit()

        self.editor.setFontFamily(self.skel_settings.notepad_font_name)
        self.editor.setFontPointSize(self.skel_settings.notepad_font_size)

        text = self.skel_conn.get_abstract()
        self.editor.setPlainText(text)

        # editor.setAutoFormatting(QtWidgets.QTextEdit.AutoAll)
        self.editor.textChanged.connect(self._OnTextChange)

        layout.addWidget(label)
        layout.addWidget(self.editor)
        self.setLayout(layout)
示例#9
0
    def PopulateForm(self):
        layout = QVBoxLayout()
        label = QtWidgets.QLabel()
        label.setText("Notes about sample %s" % idc.retrieve_input_file_md5())

        self.editor = QtWidgets.QTextEdit()

        self.editor.setFontFamily(self.skel_settings.notepad_font_name)
        self.editor.setFontPointSize(self.skel_settings.notepad_font_size)

        text = self.skel_conn.get_abstract()
        self.editor.setPlainText(text)

        # editor.setAutoFormatting(QtWidgets.QTextEdit.AutoAll)
        self.editor.textChanged.connect(self._OnTextChange)

        layout.addWidget(label)
        layout.addWidget(self.editor)
        self.setLayout(layout)
示例#10
0
 def binary_hash(self) -> str:
     return idc.retrieve_input_file_md5().hex()