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 February 23, 2024 14:56
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 / Install Composer to use MAMP's PHP.md
Last active January 30, 2024 02:30
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:

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 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()
@kkirsche
kkirsche / inetAton-inet6Aton.go
Last active October 25, 2022 15:18
inet_aton and inet6_aton in Golang
package nessusProcessor
import (
"encoding/hex"
"math/big"
"net"
)
// Inet_Aton converts an IPv4 net.IP object to a 64 bit integer.
func Inet_Aton(ip net.IP) int64 {
@kkirsche
kkirsche / tomlpath.py
Last active September 14, 2022 19:28
TOML Path — A simple utility class to retrieve a specific key path in a TOML file
from os import PathLike
from functools import reduce
from operator import getitem
try:
# Python 3.11+
from tomllib import load, loads
except ImportError:
from tomli import load, loads
from typing import Any, BinaryIO, Iterable, Mapping, TypeAlias, TypeGuard, Union
@kkirsche
kkirsche / write-blob.go
Last active August 24, 2022 13:24
Writing Git Blob Objects
package main
import (
"bytes"
"compress/zlib"
"crypto/sha1"
"encoding/hex"
"fmt"
"io"
"os"