Skip to content

Instantly share code, notes, and snippets.

View kkirsche's full-sized avatar

Kevin Kirsche kkirsche

View GitHub Profile
@kkirsche
kkirsche / ConventionalCommitsEmoji.md
Last active June 17, 2021 18:03 — forked from parmentf/ConventionalCommitsEmoji.md
Emoji for Conventional Commits
Type Emoji code
build 📦 :package:
chore 🔧 :wrench:
ci 👷 :construction_worker:
docs 📚 :books:
feat :sparkles:
fix 🐛 :bug:
perf 🚀 :rocket:
refactor 🔨 :hammer:
@kkirsche
kkirsche / python-convert-dictionary-to-object
Created June 20, 2017 21:59 — forked from typerandom/python-convert-dictionary-to-object
Convert a dictionary to an object (recursive).
class DictionaryUtility:
"""
Utility methods for dealing with dictionaries.
"""
@staticmethod
def to_object(item):
"""
Convert a dictionary to an object (recursive).
"""
def convert(item):
#!/usr/bin/env python3
from os import system, fsencode, fsdecode, listdir
from multiprocessing import Pool
def gobust(fp):
f_name = fp.split('/')[-1].split('.txt')[0]
system('gobuster -u http://URLHERE -w {fp} -x txt,php -o gobuster-80-{f_name}.txt'.format(fp=fp, f_name=f_name))
@kkirsche
kkirsche / exit_codes.py
Created December 29, 2020 06:06
Exit Codes Python
from enum import IntEnum
class ExitCode(IntEnum):
"""The following exit codes are defined and can be used with SystemExit, although they
are not required. These are typically used for system programs written in Python,
such as a mail server’s external command delivery program.
* EX_OK: Exit code that means no error occurred.
* EX_USAGE: Exit code that means the command was used incorrectly, such as when the wrong number of arguments are given.
* EX_DATAERR: Exit code that means the input data was incorrect.
@kkirsche
kkirsche / procmon.sh
Created March 8, 2018 20:55
Process monitoring
#!/bin/bash
# Loop by line
IFS=$'\n'
old_process=$(ps -eo command)
while true; do
new_process=$(ps -eo command)
diff <(echo "$old_process") <(echo "$new_process") | grep [\<\>]
@kkirsche
kkirsche / magic.py
Last active May 20, 2020 13:43
Padding Oracle
# -*- coding: utf-8 -*-
from paddingoracle import BadPaddingException, PaddingOracle
from base64 import b64encode, b64decode
from urllib import quote, unquote
import requests
import socket
import time
class PadBuster(PaddingOracle):
@kkirsche
kkirsche / cat-danger.py
Created January 8, 2020 21:57
The danger of just trusting the cat command
#!/usr/bin/env python3
hidden_cmd = "echo 'You forgot to check `cat -A`!' > oops"
visible_cmd = "echo 'Hello world!'"
if __name__ == "__main__":
with open("demo.sh", "w") as f:
txt = "#!/bin/sh\n"
txt += hidden_cmd + ";" + visible_cmd + " #\r" + visible_cmd + " " * (len(hidden_cmd) + 3) + "\n"
f.write(txt)
@kkirsche
kkirsche / base64-to-hex.py
Created October 25, 2017 14:22
Decode base64 and convert to hex format, like shellcode
#!/usr/bin/env python
from base64 import b64decode
from urllib import unquote
base64_strs = ['xU5LNJhXeo9B6o4Ri%2FxFHodARXWqgtNufNrYzqG05nGOLNboDgJtkw%3D%3D',
'%2BjAd73J7RAZgLxAUkIG5l0cMPLQEBAtZRMP3WdXr1%2BMYdrg2cZKaow%3D%3D']
for bstr in base64_strs:
unquoted_bstr = unquote(bstr)
@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 / arkham-week1.py
Last active October 1, 2019 14:30
Arkham Walkthrough
#!/usr/bin/env python3
from requests import post
from base64 import b64encode, b64decode
from hashlib import sha1
from pyDes import des, ECB, PAD_PKCS5
import hmac
def create_payload():