Skip to content

Instantly share code, notes, and snippets.

View kkirsche's full-sized avatar

Kevin Kirsche kkirsche

View GitHub Profile
@kkirsche
kkirsche / aes256-gcm.go
Last active July 6, 2026 06:32
AES-256 GCM Encryption Example in Golang
package example_test
import (
"crypto/aes"
"crypto/cipher"
"hex"
"io"
)
// AES-GCM should be used because the operation is an authenticated encryption
@kkirsche
kkirsche / clig.py
Created February 18, 2026 00:17
CLI Guidelines
"""
clig.py — Reusable toolkit implementing https://clig.dev guidelines.
Covers:
- TTY detection (stdout/stderr color/formatting awareness)
- Styled output (info, success, warning, error) to correct streams
- Structured exit codes
- Spinner / progress feedback for long ops
- Suggestions on typo / unknown subcommand
- Stdin-is-TTY guard

How to pass the OSCP

  1. Recon
  2. Find vuln
  3. Exploit
  4. Escalate
  5. Document it

Time yourself

@kkirsche
kkirsche / main.py
Last active September 5, 2025 14:26
Semantic Search Example
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "sentence-transformers",
# "sqlite-vec",
# "numpy",
# ]
# ///
@kkirsche
kkirsche / Install Composer to use MAMP's PHP.md
Last active November 30, 2024 11:56
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@kkirsche
kkirsche / int_to_rgba.go
Created July 21, 2016 01:07
Integer to RGBA in Golang — Similar to C/C++
package main
import "fmt"
func main() {
red := int(0xFF0000FF)
green := int(0x00FF00FF)
blue := int(0x0000FFFF)
redHex, greenHex, blueHex, alphaHex := calcColor(red)
@kkirsche
kkirsche / ascii-shellcode-encoder.py
Created October 2, 2018 13:14 — forked from mgeeky/ascii-shellcode-encoder.py
ASCII Shellcode encoder for Exploit Development purposes, utilizing Jon Erickson's substract arguments finding algorithm.
#!/usr/bin/python
#
# Shellcode to ASCII encoder leveraging rebuilding on-the-stack technique,
# and using Jon Erickson's algorithm from Phiral Research Labs `Dissembler`
# utility (as described in: Hacking - The Art of Exploitation).
#
# Basically one gives to the program's output a binary encoded shellcode,
# and it yields on the output it's ASCII encoded form.
#
# This payload will at the beginning align the stack by firstly moving
@kkirsche
kkirsche / main.py
Last active December 11, 2023 16:34
Versioning Troubleshooting
#!/usr/bin/env python
# BEGIN: history_meta.py
# https://docs.sqlalchemy.org/en/14/_modules/examples/versioned_history/history_meta.html
"""Versioned mixin class and other utilities."""
from __future__ import annotations
import datetime
from collections.abc import Callable, Generator
from typing import TypeAlias, Any
@kkirsche
kkirsche / backdoor.py
Last active July 25, 2023 19:12
Backdoor a PE file
#!/usr/bin/env python2
import mmap
import os
import pefile
def align(val_to_align, alignment):
return ((val_to_align + alignment - 1) / alignment) * alignment
@kkirsche
kkirsche / asdf-update-all
Last active July 11, 2023 15:01
ASDF Auto Updater
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
if ! command -v jq &> /dev/null
then
echo "jq could not be found"