Skip to content

Instantly share code, notes, and snippets.

View hieplpvip's full-sized avatar

Bao-Hiep Le hieplpvip

View GitHub Profile

Install MSYS and MinGW-w64

  • Download MSYS2 and install it.

Update MSYS2:

pacman -Syy
pacman -Syu
@hieplpvip
hieplpvip / unflatten.py
Created May 25, 2021 07:38
Flattened Base64 Recovery
#!/usr/bin/env python2
# Author: Caleb Stewart
# Date: January 20th, 2019
# This code, given a lowercased Base64 string, will determine the correct and original Base64 encoding
from pwn import *
import sys
import argparse
def all_case_combos(inp):
#!/bin/sh
vmware-hgfsclient | while read folder; do
vmwpath="/mnt/hgfs/${folder}"
echo "[i] Mounting ${folder} (${vmwpath})"
sudo mkdir -p "${vmwpath}"
sudo umount -f "${vmwpath}" 2>/dev/null
sudo vmhgfs-fuse -o allow_other -o auto_unmount ".host:/${folder}" "${vmwpath}"
done
sleep 2s
@hieplpvip
hieplpvip / psycopg2_macos.md
Last active November 8, 2020 13:53
Install psycopg2 on macOS
brew install postgresql
LDFLAGS=`pg_config --ldflags` pip install psycopg2
@hieplpvip
hieplpvip / clear_log.sh
Created October 8, 2020 03:03
Clear log files
#!/bin/bash
find . -type f -name '*.log' -exec truncate --size 0 "{}" \;
@hieplpvip
hieplpvip / seedutil.md
Created September 23, 2020 13:37 — forked from pookjw/seedutil.md
Enroll macOS Beta Seed without profile installation

seedutil

Enroll macOS Beta Seed without profile installation

Usage

$ sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil 
usage: seedutil enroll SEED_PROGRAM
    seedutil unenroll

seedutil current

@hieplpvip
hieplpvip / mactex-uninstaller-generator.sh
Last active January 28, 2022 14:33
MacTeX Uninstaller Generator
#!/bin/bash
# Based on https://tug.org/mactex/uninstalling.html
# Redirect stdout
exec > mactex-uninstaller.sh
echo "#!/bin/bash"
echo
echo 'if [ "$(id -u)" != "0" ]; then'
@hieplpvip
hieplpvip / dump_kernel_log.sh
Created September 13, 2020 19:13
Dump macOS kernel log
#!/bin/bash
function dumpKernelLog(){
bt=$(sysctl -n kern.boottime | sed 's/^.*} //')
bTm=$(echo "$bt" | awk '{print $2}')
bTd=$(echo "$bt" | awk '{print $3}')
bTt=$(echo "$bt" | awk '{print $4}')
bTy=$(echo "$bt" | awk '{print $5}')
@hieplpvip
hieplpvip / elsaid.sh
Created September 5, 2020 06:20
Converting an EISAID number to text/EISAID string (and back)
#!/bin/bash
if [[ "$1" == "" ]]; then
echo "usage: eisaid.sh 0x[eisa-number], or eisaid.sh [eisaid-string]"
exit 0
fi
if [[ "$1" == 0x* ]]; then
let vendor="$1 & 0xFFFF"
let device="$1 >> 16"
@hieplpvip
hieplpvip / codesign_gdb.md
Last active April 25, 2022 03:06
Codesign GDB on macOS Catalina

If you are getting this in GDB on macOS while trying to run a program:

Unable to find Mach task port for process-id 57573: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
  1. Open Keychain Access
  2. In menu, open Keychain Access > Certificate Assistant > Create a certificate
  3. Give it a name (e.g. gdbc)