Skip to content

Instantly share code, notes, and snippets.

View alexander-hanel's full-sized avatar
😶

Alexander Hanel alexander-hanel

😶
View GitHub Profile
@alexander-hanel
alexander-hanel / notes.md
Last active April 23, 2021 23:58
Go 1.16 File Update Notes

New moduledata format

type moduledata struct {
	pcHeader     *pcHeader
	funcnametab  []byte
	cutab        []uint32
	filetab      []byte
	pctab        []byte
	pclntable []byte
@alexander-hanel
alexander-hanel / gogo.py
Last active March 19, 2022 18:15
GoLang Argument Parsing and Backtracing
DEBUG = True
def get_basic_block(ea):
"""get basic blocks of address"""
f = idaapi.get_func(ea)
fc = idaapi.FlowChart(f)
for block in fc:
if block.start_ea <= ea:
if block.end_ea > ea:
return block.start_ea, block.end_ea
@alexander-hanel
alexander-hanel / readme.md
Last active August 9, 2022 19:00
Golang SSA Generation on Windows
@alexander-hanel
alexander-hanel / pe_ham_brute.py
Created November 10, 2020 17:24
Brute force XOR encrypted executables using hamming distance
"""
Author:
Alexander Hanel
Name:
pe_ham_brute.py
Purpose:
- POC that searches for n-grams and uses them as the XOR key.
- Also uses hamming distance to guess key size. Check out cryptopals Challenge 6
for more details https://cryptopals.com/sets/1/challenges/6
Example:
# pip3 install pygore
# modified version of code from https://go-re.tk/pygore/
import glob
import pygore
from hashlib import md5
def go_hash(data):
return md5(b','.join(data)).hexdigest()
for _file in glob.glob("*"):
if _file.endswith(".py") or _file.endswith(".txt"):
continue
@alexander-hanel
alexander-hanel / nopme.py
Last active January 16, 2024 08:02
IDAPYTHON script for patching bytes that match a regex pattern with NOPs.
import idautils
import re
import struct
"""
Example 1
.text:3500108D 60 pusha
.text:3500108E 66 B8 65 4B mov ax, 4B65h
.text:35001092
@alexander-hanel
alexander-hanel / example.py
Created September 3, 2020 17:21
get offset from hexrays output
ea = idaapi.get_screen_ea()
cfunc = idaapi.decompile(ea)
for cc, item in enumerate(cfunc.treeitems):
if item.ea != BADADDR:
if cfunc.treeitems.at(cc).ea == here():
print(cc)
@alexander-hanel
alexander-hanel / ida_regex.py
Created July 28, 2020 17:16
IDAPython Regex Example
import idautils
import re
import struct
"""
String Storage
Example 1
.text:004344F5 8D 05 47 3E 50 00 lea eax, stru_503E47