Skip to content

Instantly share code, notes, and snippets.

Avatar
😶

Alexander Hanel alexander-hanel

😶
View GitHub Profile
@alexander-hanel
alexander-hanel / reconstruct_source_code.py
Created March 17, 2023 15:45
reconstruct structure using functions populated via PDB
View reconstruct_source_code.py
import re
IGNORE_KEYWORDS = []
def get_data():
with open("demangled_functions.txt", "r") as f:
data_lines = [line.rstrip() for line in f]
return data_lines
def parse(declarations):
@alexander-hanel
alexander-hanel / README.md
Created December 27, 2022 21:22
The Fundamentals of Sharing for Malware Analyst
View README.md

Originally created on 2016-11-06

The Fundamentals of Sharing for Malware Analyst

In most organizations malware analysts are tasked to produce a deliverable derived from static or dynamic analysis. The deliverable could be to extract indicators, understand functionality, write a report or something similar. During this process the analyst will create a number of files and artifacts. These files could be IDBs, memory dumps, yara signature, decoder scripts, pcaps, notes, etc. Once the task has been completed the analyst submits their deliverable and then moves on. In many organizations the files and artifacts are not stored in a way that are accessible to others, which is a shame. Having the data and analysis accessible to others has many positive benefits.

  1. Promotes sharing of processes and knowledge between analyst.
  2. Removes duplication of labor by allowing analyst to build off of previous research and analysis.
  3. Intellectual property and artifacts are not lost when an analyst leaves the organiz
@alexander-hanel
alexander-hanel / notes.md
Created November 16, 2022 17:32
Program Analysis Topics And References
View notes.md

Program Analysis

Status: in progress

Logic

  • Intro to Formal Logic — Peter smith
  • Intermediate Logic - David Bostock
  • Natural Logic — Neil Tennant
  • A mathematical intro to logic — Herber Enderton
  • Logic and Structure — Dirk van Dalen
View bn-cheat.md
@alexander-hanel
alexander-hanel / go_source_code_comments.py
Created August 10, 2022 15:40
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 August 9, 2022 21:51
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 August 24, 2022 19:15
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 April 20, 2022 04:12
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 April 20, 2022 19:30
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