Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Kirsche kkirsche

View GitHub Profile
@kkirsche
kkirsche / Install Composer to use MAMP's PHP.md
Last active March 3, 2023 12:08
How to install Composer globally using MAMP's PHP
View Install Composer to use MAMP's PHP.md

##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 February 19, 2023 10:52
AES-256 GCM Encryption Example in Golang
View aes256-gcm.go
package example_test
import (
"crypto/aes"
"crypto/cipher"
"hex"
"io"
)
// AES-GCM should be used because the operation is an authenticated encryption
@kkirsche
kkirsche / nmapxml_to_elasticsearch.py
Created August 22, 2016 23:42
Nmap XML to Elasticsearch
View nmapxml_to_elasticsearch.py
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 / asdf-update-all
Last active December 16, 2022 15:53
ASDF Auto Updater
View asdf-update-all
#!/usr/bin/env python
from shlex import split
from subprocess import CompletedProcess, run # noqa
from typing import cast
from packaging.version import InvalidVersion, parse
from requests import get
@kkirsche
kkirsche / inetAton-inet6Aton.go
Last active October 25, 2022 15:18
inet_aton and inet6_aton in Golang
View inetAton-inet6Aton.go
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 {
View how-to-oscp-final.md

How to pass the OSCP

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

Time yourself

@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
View tomlpath.py
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
View write-blob.go
package main
import (
"bytes"
"compress/zlib"
"crypto/sha1"
"encoding/hex"
"fmt"
"io"
"os"
@kkirsche
kkirsche / rsync.py
Last active August 12, 2022 12:38
rsync algorithm in Python
View rsync.py
#!/usr/bin/env python
# based on
# https://tylercipriani.com/blog/2017/07/09/the-rsync-algorithm-in-python/
from collections.abc import Generator
from hashlib import md5
from io import BufferedReader, TextIOWrapper
from logging import DEBUG, INFO, basicConfig, getLogger
from os import PathLike
@kkirsche
kkirsche / backdoor.py
Last active June 16, 2022 12:34
Backdoor a PE file
View backdoor.py
#!/usr/bin/env python2
import mmap
import os
import pefile
def align(val_to_align, alignment):
return ((val_to_align + alignment - 1) / alignment) * alignment