Skip to content

Instantly share code, notes, and snippets.

@psifertex
psifertex / 1_Snippet_Instructions.txt
Last active April 9, 2024 11:10
my current collection of snippets
Welcome to Jordan's grab-bag of common Binary Ninja Snippets.
These snippest are meant to run with the Binary Ninja Snippets Plugin
(http://github.com/Vector35/snippets) though they can all also be pasted
directly into the python console or turned into stand-alone plugins if needed.
To install the entire collection at once, just install the Snippets plugin via
the plugin manager (CMD/CTL-SHIFT-M), confirm the Snippet Editor works
(Tool/Snippets/Snippet Editor), and unzip this bundle (Download ZIP above) into
your Snippets folder.
H4sIAAAAAAAAAzWQTUsCH4sIAAAAAAAAAzWQTUsCH4sIAAAAAAAAAzWQTUsCH4sIAAAAAAAAAzWQTUs
URSG70QDMQRX123O0j9gURSG70QDMQRX123O0j9gURSG70QDMQRX123O0j9gURSG70QDMQRX123O0j9
DBKUpGRE7SSi1Vh30qhGDBKUpGRE7SSi1Vh30qhGBKUpGRE7SSi1Vh30qhOGBKUpGRE7SSi1Vh30qhO
nCmxVYWbPvwH/YVqFYiLnCmxVYWbPvwH/YVqYiLnCmxVYWbPvwH/YVqYiLnCmKxVYWbPvwH/YVqYiLn
TM2PVkm0CAp1eXfWKnd1TM2PVkm0CAp1efWKnd1TM2PVkm0CAp1efWKnd1TM2PVkvm0CAp1efWKnd1T
7rG5cN/znufcGQ5vohQ+7rG5cN/znufGQ5vohQ+7rG5cN/znufGQ5vohQ+7rG5cN/zSnufGQ5vohQ+7
1RirbDLG5Dy6MhpWVZIo1RirbDLG5y6MhpWnVZIo1RirbDLG5y6MhpWnVZIo1RrbDLG5ty6MhpWnVZI
hXfVaBo919t6UmN0eEBfhXfVaBo99t6UmN0peEfhXfVaBo99t6UmN0peEfhVXfaBo99t6dUmN0peEfh
Q8tD0ubDV5tH+h1NBpHYQ8tD0ubV5tH+h1NOBpYQ8tD0ubV5tH+h1NOBpYQF8t0ubV5tH+vh1NOBpYQ
3Pz4on5Cav/9iPpJ+Y0f3Pz4onCav/9iPpJE+Yf3Pz4onjCav/9ipJE+Yf3XPzonjCav/9ifpJE+Yf3
#############################################################################
##
## Copyright (C) 2017 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the Qt for Python examples of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:BSD$
## You may use this file under the terms of the BSD license as follows:
hs.hotkey.bind({"cmd", "alt", "ctrl", "shift"}, "4", function()
local timeStamp = string.gsub(os.date("%Y-%m-%d_%T"), ":", ".")
local fileName = os.getenv("HOME") .. "/Desktop/ss-" .. timeStamp .. ".png"
local windowId = hs.window.frontmostWindow():id()
hs.task.new("/usr/sbin/screencapture", nil, {"-l" .. windowId, fileName }):start()
end)
@psifertex
psifertex / export-settings.py
Created September 6, 2019 02:24
Automatic Settings Documentation in Binary Ninja
import json
from PySide2.QtGui import QGuiApplication
settings = json.loads(binaryninja.Settings().serialize_schema())
table = """|Category|Setting|Default|Type|Description|
|---|---|---|---|---|
"""
for category in settings:
for setting in settings[category]['settings']:
title = settings[category]['settings'][setting]['title']
@psifertex
psifertex / string-annotator.py
Created September 4, 2019 21:52
inline string annotator for binary ninja
annotation=""
for instruction in current_basic_block.get_disassembly_text():
if instruction.address >= current_selection[0] and instruction.address < current_selection[1]:
address = instruction.address
value = instruction.tokens[-1].value
operand = instruction.tokens[-1].operand
type = IntegerDisplayType.CharacterConstantDisplayType
current_function.set_int_display_type(address, value, operand, type)
annotation += chr(instruction.tokens[-1].value)
log_info("Adding comment for string: %s" % annotation)
@psifertex
psifertex / keybindings.json
Last active October 11, 2022 19:23
simple VIM style motion keys for Binary Ninja
{
"Back" : "Escape; Back; Ctrl+[; Meta+O",
"Forward" : "Forward; Ctrl+[; Meta+I",
"Change Type..." : "Shift+Y; ",
"Close Window" : "Ctrl+W; X",
"Command Palette" : "Ctrl+P; Space",
"Copy" : "Ctrl+C; Y",
"Disassembly Graph" : "G, L",
"Display as\\Binary" : "D",
"Display as\\Default" : "D",
@psifertex
psifertex / cla.txt
Last active November 3, 2022 13:29
Binary Ninja API CLA
### Contribution License Agreement
This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”), and conveys certain license rights to Vector 35 Inc and its affiliates (“Vector35”) for Your contributions to Vector35 open source projects. This Agreement is effective as of the latest signature date below.
**Definitions**
“Code” means the computer software code, whether in human-readable or machine-executable form, that is delivered by You to Vector35 under this Agreement.
“Project” means any of the projects owned or managed by Vector35 and offered under a license approved by the Open Source Initiative (www.opensource.org).
@psifertex
psifertex / settings.json
Created September 3, 2018 03:37
Example binary ninja settings
{
"python" :
{
"interpreter": "/usr/local/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib"
}
}
{
"python" :
{
"interpreter" : "/usr/local/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib"
}
}