Skip to content

Instantly share code, notes, and snippets.

View kkirsche's full-sized avatar

Kevin Kirsche kkirsche

View GitHub Profile
@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",
# ]
# ///

How to pass the OSCP

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

Time yourself

@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 / aes256-gcm.go
Last active November 12, 2024 02:47
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 / 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"
@kkirsche
kkirsche / nmapxml_to_elasticsearch.py
Created August 22, 2016 23:42
Nmap XML to Elasticsearch
import os
import glob
from datetime import datetime
from elasticsearch import Elasticsearch
from libnmap.parser import NmapParser
dir_path = os.path.dirname(os.path.realpath(__file__))
es = Elasticsearch()