Skip to content

Instantly share code, notes, and snippets.

Avatar
😶

Alexander Hanel alexander-hanel

😶
View GitHub Profile
@alexander-hanel
alexander-hanel / go_source_code_comments.py
Created Aug 10, 2022
Extract Go source code function comments and add them to an IDB
View go_source_code_comments.py
import idautils
import subprocess
import os
import re
import json
import sys
GOBIN = r"C:\Program Files\Go"
@alexander-hanel
alexander-hanel / go_comment.py
Created Aug 9, 2022
Add Function Comments to Exportable Functions in Go
View go_comment.py
import idautils
import subprocess
import os
GOBIN = r"C:\Program Files\Go\bin"
def extract_name(func_name):
sp = func_name.split(".")
# if the start of a function is not upper case it is not exportable
@alexander-hanel
alexander-hanel / explore_binary_ninja.py
Last active Aug 24, 2022
Explore Binary Ninja's Python API
View explore_binary_ninja.py
import logging
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
file_name = ""
try:
import binaryninja
logging.debug("BinaryNinja has been imported")
View heart_sergei.py
import idautils
import string
DEBUG = True
if DEBUG:
import hexdump
SEGMENT = True
def get_to_xrefs(ea):
@alexander-hanel
alexander-hanel / README.md
Last active Apr 20, 2022
Cryptopals Rust Solutions
View README.md

Cryptopals

link

Set 1

Challenge 1: Convert hex to base64

use std::str;
extern crate base64;
@alexander-hanel
alexander-hanel / README.md
Last active Apr 20, 2022
Rust Ownership and Borrow Notes
View README.md

Rust Ownership Notes

Rather than relying on garbage collection or user memory allocation (via allocate/free memory), Rust relys on the compiler to ensure memory is managed through ownership.

Ownership is a set of rules that governs how a Rust program manages memory.

Ownership helps with organizing how data is stored in the heap, minimizing duplication of data in the heap and cleaning up the heap. Data types (e.g. Scalar types) are not stored in the heap. Data types (e.g. integers) can be easily pushed/stored and popped/removed on the stack. Rust enforces single ownership.

Ownership Rules

@alexander-hanel
alexander-hanel / README.md
Last active Apr 14, 2022
intro to opaque predicates notes
View README.md

opaque predicates

In computer programming, an opaque predicate is a predicate—an expression that evaluates to either "true" or "false"—for which the outcome is known by the programmer a priori, but which, for a variety of reasons, still needs to be evaluated at run time

Source

Opaque predicates appears to have been first used by Christian Collberg & Clark Thomborson back in 1997 source. The technique is discussed in their paper A Taxonomy of Obfuscating Transformations.

Notes from A Taxonomy of Obfuscating Transformations

View README.md
View IconExample.py
import ida_kernwin
"""
mostly stolen from https://github.com/idapython/ examples/ex_actions.py
"""
class IconExample(ida_kernwin.action_handler_t):
def __init__(self, passed):
ida_kernwin.action_handler_t.__init__(self)
@alexander-hanel
alexander-hanel / ctypes_from_buffer.py
Last active Sep 3, 2021
ctypes from buffer example
View ctypes_from_buffer.py
class COFFSYMBOLTABLE(ctypes.Structure):
"""
Described in [PE-COFF] 5.4. Coff Symbol Table
"""
_pack_ = 1
_fields_ = [
("zeroes", ctypes.c_uint), ("offset", ctypes.c_uint), ("value", ctypes.c_uint),
("section_number", ctypes.c_short), ("type", ctypes.c_ushort), ("storage_class", ctypes.c_ubyte),
("number_aux_symbols", ctypes.c_ubyte)
]