Skip to content

Instantly share code, notes, and snippets.

@utkonos
Created January 17, 2024 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save utkonos/0235d0b89d0feef2650ced1eba8fd5c8 to your computer and use it in GitHub Desktop.
Save utkonos/0235d0b89d0feef2650ced1eba8fd5c8 to your computer and use it in GitHub Desktop.
Paste clipboard to automatic symbol name.
"""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