Skip to content

Instantly share code, notes, and snippets.

@huyphan
huyphan / awsv4sign.js
Created January 5, 2023 10:43
Helper library to allow Grafana K6 to sign SigV4 requests to API Gateway
/** Modified version of https://github.com/s0rc3r3r01/awsv4sign/blob/master/awsv4sign.js to make it work with API Gateway */
/* eslint-__ENV node */
/* eslint no-use-before-define: [0, "nofunc"] */
"use strict";
var crypto = require("k6/crypto");
//v4Sign takes a standard http request object and returns the request signed with AWS V4 Signature
function v4Sign(req, awsCredentials, options) {
'''
Generating Python script that replays HTTP requests captured by mitmproxy/mitmdump.
Usage:
$ mitmdump -s /tmp/replay_script_generator.py 2>&1 >/dev/null
'''
import pprint
import sys
pp = pprint.PrettyPrinter(indent=4)
@huyphan
huyphan / README.md
Last active March 20, 2017 21:49
Organizing exploit development and debugging process with Tmux

Idea

  • Having a single script to automatically run the binary, attach gdb, re-set breakpoints every time you restart your debugging session.
  • The main idea is to run your debugging processes on different Tmux panes and let the controller script (also running on another tmux pane) send keystrokes to automate activities on those panes.

Prerequisites

  • tmux
  • If you run your tmux session as non-root user, the system configuration /proc/sys/kernel/yama/ptrace_scope should be set to 0 (i.e. running echo 0 > /proc/sys/kernel/yama/ptrace_scope as root) to allow attaching gdb to an existing process as non-root user.

Usage

Keybase proof

I hereby claim:

  • I am huyphan on github.
  • I am hphan (https://keybase.io/hphan) on keybase.
  • I have a public key whose fingerprint is 0311 B2AA FF4F E772 470D 09DA 2E4D 544B 7047 A53C

To claim this, I am signing this object:

@huyphan
huyphan / 0_reuse_code.js
Created December 30, 2015 03:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@huyphan
huyphan / gist:9609bd1ead8b5c64a6ae
Created August 22, 2014 05:04
Reviewboard + Nginx + UWSGI
# NGINX CONFIGURATION
upstream reviewboard_uwsgi {
server localhost:8005;
}
server {
....
@huyphan
huyphan / gist:4abb4f8edd6ce1cac528
Created June 10, 2014 08:33
Spark 1.0 + Hadoop 2.0 + Elasticsearch
$ ADD_JARS=../elasticsearch-hadoop-2.1.0.BUILD-SNAPSHOT/dist/elasticsearch-hadoop-2.1.0.BUILD-SNAPSHOT.jar bin/spark-shell
### COMMAND ###
val tweet = Map("user" -> "kimchy", "post_date" -> "2009-11-15T14:12:12", "message" -> "trying out Elastic Search")
val tweets = sc.makeRDD(Seq(tweet))
import org.apache.hadoop.io.{MapWritable, Text, NullWritable}
def toWritable(in: Map[String, String]) = {
val m = new MapWritable
for ((k, v) <- in)
#include <iostream>
#include <cstdint>
using namespace std;
typedef uint8_t CHAR;
typedef uint16_t WORD;
typedef uint32_t DWORD;
typedef int8_t BYTE;
@huyphan
huyphan / defcon-2014-quals-100lines-bruteforce.cpp
Last active July 21, 2016 04:46
defcon-2014-quals-100lines-bruteforce
#include <iostream>
#include <cstdint>
using namespace std;
typedef uint8_t CHAR;
typedef uint16_t WORD;
typedef uint32_t DWORD;
typedef int8_t BYTE;
@huyphan
huyphan / buildlog
Created April 28, 2014 05:36
Error when building NAKL
Build target NAKL
ProcessInfoPlistFile /Users/nmstech/Library/Developer/Xcode/DerivedData/NAKL-dpardqrwpmjiuhgivowjjbhyjpab/Build/Products/Debug/NAKL.app/Contents/Info.plist NAKL/NAKL-Info.plist
cd "/Users/nmstech/Desktop/XUAN CUONG/huyphan-NAKL-e2c5b08"
builtin-infoPlistUtility /Users/nmstech/Desktop/XUAN\ CUONG/huyphan-NAKL-e2c5b08/NAKL/NAKL-Info.plist -genpkginfo /Users/nmstech/Library/Developer/Xcode/DerivedData/NAKL-dpardqrwpmjiuhgivowjjbhyjpab/Build/Products/Debug/NAKL.app/Contents/PkgInfo -expandbuildsettings -platform macosx -o /Users/nmstech/Library/Developer/Xcode/DerivedData/NAKL-dpardqrwpmjiuhgivowjjbhyjpab/Build/Products/Debug/NAKL.app/Contents/Info.plist
ProcessPCH /Users/nmstech/Library/Developer/Xcode/DerivedData/NAKL-dpardqrwpmjiuhgivowjjbhyjpab/Build/Intermediates/PrecompiledHeaders/NAKL-Prefix-eqokzgkoqclrkxaingnrhyfxcfrx/NAKL-Prefix.pch.pch NAKL/NAKL-Prefix.pch normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Users/nmstech/Desktop/XUAN CUONG/huyphan-