Skip to content

Instantly share code, notes, and snippets.

View yellowbyte's full-sized avatar

Yu-Jye Tung yellowbyte

View GitHub Profile
@s-ff
s-ff / Makefile
Created August 30, 2021 11:14
Makefile template to assemble with NASM to x86-64 with libc
AS=nasm
ASFLAGS=-f elf64 -g -F dwarf
LD=ld
LDFLAGS=-dynamic-linker /lib64/ld-linux-x86-64.so.2 -lc -m elf_x86_64
RM=rm -rf
SOURCES=$(wildcard *.asm)
OBJECTS=$(SOURCES:.asm=.o)
TARGET=out
%.o: %.asm
@MattPD
MattPD / analysis.draft.md
Last active June 22, 2024 07:19
Program Analysis Resources (WIP draft)
@sdasgup3
sdasgup3 / alltutoroals.md
Last active December 23, 2022 07:53
Few things I am inerested in!

I've been working on optimizing the YARA compiler to generate better bytecode for loops. The goal is to skip as much of loops as possible by not iterating further once the loop condition is met. Here's the rule I'm using. Completely contrived and excessive, but it's to show the performance improvement:

wxs@wxs-mbp yara % cat rules/test.yara
rule a {
  condition:
    for any i in (0..100000000): (i == 1)
}
wxs@wxs-mbp yara %
@sdasgup3
sdasgup3 / allProofs.z3
Last active August 26, 2020 06:37
My Z3 proof snippets
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;popcnt expl ;;;;;;;;;;;;;;;;;;;;;;;;;;;
(declare-const V (_ BitVec 64))
(declare-const I1 (_ BitVec 64))
(declare-const I2 (_ BitVec 64))
(assert
(not
(=
@sdasgup3
sdasgup3 / max_stack_height.cpp
Created May 24, 2018 00:46
Implements a function pass to approximate the max stack height of each McSema lifted function.
//===-- max_stack_height.cpp - Static analysis for stack height approximation --------------------------------------==//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This implements a function pass to approximate the max stack height of each function.
@ivg
ivg / cyclomatic.py
Created September 27, 2017 12:20
Computes cyclomatic complexity of all functions in a binary
import bap
import networkx as nx
def build_cfg(sub):
G = nx.DiGraph()
entry = sub.blks[0].id.number
G.add_node(entry)
for blk in sub.blks:
for jmp in blk.jmps:
if jmp.constr == 'Goto' and jmp.target.constr == 'Direct':
@withzombies
withzombies / install-api.py
Created September 21, 2016 04:21
Install the Binary Ninja Python API
#!/usr/bin/env python
import os
import sys
import os.path
import site
try:
import binaryninja
print "Binary Ninja API Installed"
@magnetikonline
magnetikonline / README.md
Last active June 22, 2024 13:35
Bash string manipulation cheatsheet.

Bash string manipulation cheatsheet

Assignment
Assign value to variable if variable is not already set, value is returned.

Combine with a : no-op to discard/ignore return value.
${variable="value"}
: ${variable="value"}
@menzenski
menzenski / helloworld.asm
Created February 4, 2015 15:24
Hello World in Assembly language (x86-64 Unix-like operating systems, NASM syntax)
; MacOS X: /usr/local/bin/nasm -f macho64 *.s && ld -macosx_version_min 10.7 *.o
; Solaris/FreeBSD/DragonFly: nasm -f elf64 -D UNIX *.s && ld *.o
; NetBSD: nasm -f elf64 -D UNIX -D NetBSD *.s && ld *.o
; OpenBSD: nasm -f elf64 -D UNIX -D OpenBSD *.s && ld -static *.o
; OpenIndiana: nasm -f elf64 -D UNIX *.s && ld -m elf_x86_64 *.o
; Linux: nasm -f elf64 *.s && ld *.o
%ifdef NetBSD
section .note.netbsd.ident
dd 7,4,1