Created
January 17, 2024 01:02
-
-
Save utkonos/0235d0b89d0feef2650ced1eba8fd5c8 to your computer and use it in GitHub Desktop.
Paste clipboard to automatic symbol name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Paste clipboard to automatic symbol name. | |
Binary Ninja plugin for pasting the contents of the clipboard to the name of an automatically detected library function | |
symbol or data symbol. This retains the amber color of library functions in the Symbol pane. | |
""" | |
from binaryninja.enums import SymbolType | |
from binaryninja.plugin import PluginCommand | |
from binaryninja.types import Symbol | |
import PySide6 | |
def set_library(bv, addr): | |
"""Paste the clipboard to the selected library function symbol name.""" | |
clip = PySide6.QtGui.QGuiApplication.clipboard() | |
name = clip.text() | |
bv.define_auto_symbol(Symbol(SymbolType.LibraryFunctionSymbol, addr, name)) | |
def set_data(bv, addr): | |
"""Paste the clipboard to the selected data symbol name.""" | |
clip = PySide6.QtGui.QGuiApplication.clipboard() | |
name = clip.text() | |
bv.define_auto_symbol(Symbol(SymbolType.DataSymbol, addr, name)) | |
description = 'Paste the clipboard to the selected library function symbol name.' | |
PluginCommand.register_for_address('Paste library function symbol name', description, set_library) | |
description = 'Paste the clipboard to the selected data symbol name.' | |
PluginCommand.register_for_address('Paste data symbol name', description, set_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment