Skip to content

Instantly share code, notes, and snippets.

View vuonghv's full-sized avatar

Vuong Hoang vuonghv

View GitHub Profile
@vuonghv
vuonghv / db.sh
Last active November 18, 2018 17:21
Simple Key-Value Store
#!/bin/bash
db_set() {
echo "$1:$2" >> database
}
db_get() {
grep "$1:" database | sed -e "s/^$1://" | tail -n 1
}
@vuonghv
vuonghv / pydasm.c
Created November 4, 2016 07:44
Defining New Types using Python's C API
/*
* pydasm -- Python module wrapping libdasm
* 2016 Vuong Hoang <vuonghv.cs@gmail.com>
*/
#include <Python.h>
#include <structmember.h>
#include "../libdasm.h"
#define INSTRUCTION_STR_BUFFER_LENGTH 256
@vuonghv
vuonghv / start_address.py
Last active September 27, 2016 09:13
Get the start address of a Thread in windows
from ctypes import c_ulong, windll, byref, sizeof, c_void_p
ntdll = windll.ntdll
DWORD = c_ulong
HANDLE = c_void_p
# Defines THREADINFOCLASS enumeration
ThreadBasicInformation = 0
@vuonghv
vuonghv / install_pydbg.md
Last active October 5, 2022 00:53
Install pydbg and pydasm packages on Windows

Install PyDbg on Windows

  1. Download unofficial pydbg binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pydbg
  2. Install the packages: pip install pydbg-1.2-cp27-none-win32.whl

Install Paimei on Windows

  1. Download paimei source code: git clone https://github.com/OpenRCE/paimei
  2. cd paimei
  3. python setup.py install
@vuonghv
vuonghv / colortrans.py
Created July 27, 2016 07:51 — forked from MicahElliott/colortrans.py
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@vuonghv
vuonghv / thrpool_assert.h
Created July 15, 2016 01:59
Some helpful macros in C
/*
* The MACROs in this file strengthen assert() of standar assert.h
* by printing the value of its arguments when assert() failed.
*
* Author: Vuong Hoang <vuonghv.cs@gmail.com>
*/
#ifndef _THRPOOL_ASSERT_H
#define _THRPOOL_ASSERT_H
#include <assert.h>