Skip to content

Instantly share code, notes, and snippets.

@xire-
xire- / intrinsics_bug.py
Created February 14, 2022 10:19
Minimal architecture plugin to reproduce bug
from binaryninja import IntrinsicInfo
from binaryninja.types import Type
from binaryninja.log import log_info, log_error
from binaryninja.architecture import Architecture
from binaryninja.function import RegisterInfo, InstructionInfo, InstructionTextToken
from binaryninja.enums import InstructionTextTokenType, BranchType, LowLevelILFlagCondition
class TESTARCH(Architecture):
@xire-
xire- / payment_solver.py
Created March 20, 2018 16:38
payment solver
#!/usr/bin/env python3
# -*- coding: utf8 -*-
from collections import defaultdict
from itertools import permutations
class PaymentSolver:
def __init__(self, people):
# if X owe Y N euro,
# then Y owe X -N euro
@xire-
xire- / box_drawing_chars.txt
Created June 28, 2016 17:51
set of unicode characters used to draw boxes and blocks
┌─┬┐
│ ││
├─┼┤
└─┴┘
╔═╦╗ ╒═╤╕ ╓─╥╖
║ ║║ │ ││ ║ ║║
╠═╬╣ ╞═╪╡ ╟─╫╢
╚═╩╝ ╘═╧╛ ╙─╨╜
@xire-
xire- / decorator_example.py
Created June 28, 2016 10:17
template of a parametric decorator
from functools import wraps
class print_in_out:
def __init__(self, in_str, out_str):
self.in_str = in_str
self.out_str = out_str
def __call__(self, f):
@wraps(f)
def wrapped(*args, **kargs):
@xire-
xire- / wrapper_template.py
Last active January 16, 2017 11:28
Execute a given program with custom args and env vars. Can be used by gdb as exec wrapper.
#!/usr/bin/python2
import sys
from ctypes import cdll, c_char_p, cast
from ctypes.util import find_library
# to use with gdb:
# set exec-wrapper ./wrapper_template.py
# custom args and env vars
@xire-
xire- / getaddrs.c
Last active April 29, 2016 19:06
Prints the address of args, env vars and stored eip, ebp of the main frame
/*
gcc -m32 -o getaddrs getaddrs.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void
p_data_string(char* string) {