Created
January 26, 2023 13:30
-
-
Save shellcromancer/67c2b1b3fe3ba927bd3a40d7d0b5b997 to your computer and use it in GitHub Desktop.
Binja Snippet to create YARA string for selection
This file contains 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
import PySide6 | |
length = current_selection[1] - current_selection[0] | |
code_bytes = bv.read(here, length).hex() | |
tuples = [code_bytes[i:i+2] for i in range(0, len(code_bytes), 2)] | |
yara_str = f"$asm_{hex(here)} = {{{' '.join(tuples)}}}" | |
clip = PySide6.QtGui.QGuiApplication.clipboard() | |
clip.setText(yara_str) | |
log_info(f"Wrote \"{yara_str}\" to the clipboard.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment