Skip to content

Instantly share code, notes, and snippets.

View nganhkhoa's full-sized avatar

Nguyễn Anh Khoa nganhkhoa

View GitHub Profile
@nganhkhoa
nganhkhoa / MachO.py
Created October 7, 2021 08:12
LLDB python scripts
import lldb
import struct
class Header():
def __init__(self, b):
fmt = "<IIIIIIII"
fields = struct.unpack(fmt, b)
( self.magic
, self.cputype
, self.cpusubtype
@nganhkhoa
nganhkhoa / CFString Displayer.py
Last active June 29, 2021 09:36
Binary Ninja Plugins
import binaryninja as bn
def endianness(bv: bn.BinaryView):
if bv.endianness.value == 0:
return "little"
else:
return "big"
def read_pointer(bv: bn.BinaryView, addr):
buffer = bv.read(addr, bv.address_size)
from z3 import *
flag = [BitVec(f'flag_{i:02}', 8) for i in range()]
s = Solver()
s.add()
s.check()
m = s.model()
@nganhkhoa
nganhkhoa / jni_all.h
Created July 24, 2020 05:25 — forked from Jinmo/jni_all.h
Useful when reversing JNI on IDA Pro
/*
* Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
@nganhkhoa
nganhkhoa / stop-using-jwts.md
Created December 3, 2019 15:47 — forked from samsch/stop-using-jwts.md
Stop using JWTs

Stop using JWTs!

TLDR: JWTs should not be used for keeping your user logged in. They are not designed for this purpose, they are not secure, and there is a much better tool which is designed for it: regular cookie sessions.

If you've got a bit of time to watch a presentation on it, I highly recommend this talk: https://www.youtube.com/watch?v=pYeekwv3vC4 (Note that other topics are largely skimmed over, such as CSRF protection. You should learn about other topics from other sources. Also note that "valid" usecases for JWTs at the end of the video can also be easily handled by other, better, and more secure tools. Specifically, PASETO.)

A related topic: Don't use localStorage (or sessionStorage) for authentication credentials, including JWT tokens: https://www.rdegges.com/2018/please-stop-using-local-storage/

The reason to avoid JWTs comes down to a couple different points:

  • The JWT specification is specifically designed only for very short-live tokens (~5 minute or less). Sessions
@nganhkhoa
nganhkhoa / .bashrc_profile
Last active May 24, 2019 15:35
My new .vimrc, purging my old big vimrc
###########################################################################
# THIS IS A PERSONAL BASHRC AND SHOULD BE SOURCED BY THE ORIGINAL .BASHRC #
###########################################################################
export PRE_PATH=`echo $PATH`
# Predefiend {{{
# source $HOME/z.sh # use z.lue instead, see below
export APP_DIR="$HOME/APP"
export SECURITY_DIR="$HOME/SECURITY"
@nganhkhoa
nganhkhoa / DES.cr
Last active February 13, 2019 06:34
Implementation of DES in Crystal
require "bit_array"
IP_table = [
[58, 50, 42, 34, 26, 18, 10, 2],
[60, 52, 44, 36, 28, 20, 12, 4],
[62, 54, 46, 38, 30, 22, 14, 6],
[64, 56, 48, 40, 32, 24, 16, 8],
[57, 49, 41, 33, 25, 17, 9 , 1],
[59, 51, 43, 35, 27, 19, 11, 3],
[61, 53, 45, 37, 29, 21, 13, 5],
@nganhkhoa
nganhkhoa / README.md
Created January 25, 2019 16:17
HCMUT Blockchain Labs Wordpress page

Quick start

Prepare

  • Put theme in data/wordpress/wp-content/themes.
  • Put plugin in data/wordpress/wp-content/plugins.
  • Copy your old wp-content/uploads to data/wordpress/wp-content/uploads.
  • Search every string in mysql/wordpress.sql for the link of the server and replace it with your server.
  • Change the username and password of database, and database of wordpress, in docker-compose.yml.
@nganhkhoa
nganhkhoa / openssl_commands.md
Created July 9, 2018 14:00 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl