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.
from PySide6.QtWidgets import QApplication, QMainWindow, QMessageBox, QPushButton
from PySide6.QtCore import Qt
import sys
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("QT Test")
button = QPushButton("Test Dialog")
button.clicked.connect(self.button_click)
@psifertex
psifertex / ghopen.sh
Created January 12, 2024 04:07
Open Ghidra with default analysis options
#!/bin/bash
GHIDRAPATH=~/Downloads/ghidra
# https://stackoverflow.com/posts/23002317/revisions
function abspath() {
# generate absolute path from relative path
# $1 : relative filename
# return : absolute path
if [ -d "$1" ]; then
# dir
@psifertex
psifertex / binexport_binja.zsh
Last active December 2, 2023 02:23
BinExport build script for Binary Ninja (macOS + Linux Only)
#!/usr/bin/env zsh
# Note:
# CMake, Clang, clang-format, Ninja, git and sed are required to build
#
# Note that currently there is a bug (https://github.com/google/binexport/issues/117)
# that requires applying this patch, remove when resolved
#
if [ -d ~/Downloads ]
@psifertex
psifertex / zeal.sh
Last active August 24, 2023 16:34
macos zeal build
#!/bin/zsh
echo "file://${HOME}/ports"|sudo tee -a /opt/local/etc/macports/sources.conf
mkdir -p ${HOME}/ports/devel/zeal
cat > ${HOME}/ports/devel/zeal/Portfile << **
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup cmake 1.1
PortGroup github 1.0
@psifertex
psifertex / fixmuls.py
Created July 17, 2023 21:29
small snippet written on the July 14 2023 Binary Ninja live stream
def myvisit(opName, op, opType, parentInstruction):
if (op.operation == MediumLevelILOperation.MLIL_MULU_DP) and isinstance(op.right, Constant) and isinstance(op.left, Constant):
nextInstruction = op.function[op.instr_index + 1]
leftVal = op.left.value.value
rightVal = op.right.value.value
upper = leftVal * rightVal >> 32
lower = leftVal * rightVal & 0xffffffff
if isinstance(nextInstruction, SetVar):
nextVar = nextInstruction.src.operands[0]
if hasattr(nextVar, "name"):
Once there was a brilliant engineer named Alice who was determined to push the limits of technology. She had been working on a project to build a time dilation chamber, which would allow her to experience time at a different rate than the outside world.
Alice had been struggling with the project for months, but she was determined to see it through to the end. She poured over the technical specifications, ran countless simulations, and consulted with other experts in the field.
Finally, Alice had an idea. She decided to use a GPT-powered chat-bot to help her design the chamber. She spent hours talking with the chat-bot, bouncing ideas back and forth and asking for advice and clarification.
To her amazement, the chat-bot was able to provide her with detailed and accurate answers to even the most complex questions. With its help, Alice was able to overcome the obstacles that had been holding her back and make significant progress on the project.
In just a week of real-time, Alice was able to design and build
@psifertex
psifertex / code.py
Last active November 9, 2022 03:50
wip co2 sensor based on a bunch of adafruit stemma qt compatible boards
import time
import sys
import board
import neopixel
import busio
import digitalio
import displayio
import terminalio
from adafruit_display_text import label
from adafruit_displayio_sh1107 import SH1107, DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650
@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 / 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",