Skip to content

Instantly share code, notes, and snippets.

View thomaspatzke's full-sized avatar

Thomas Patzke thomaspatzke

View GitHub Profile
@thomaspatzke
thomaspatzke / CSRFToken.py
Created February 3, 2015 14:01
Burp extension: extract CSRF tokens from responses of selected Burp tools and update them with a custom session handling rule.
from burp import (IBurpExtender, IBurpExtenderCallbacks, ISessionHandlingAction, IHttpListener)
import re
class BurpExtender(IBurpExtender, ISessionHandlingAction, IHttpListener):
def registerExtenderCallbacks(self, callbacks):
self.callbacks = callbacks
self.helpers = callbacks.getHelpers()
callbacks.setExtensionName("Session CSRF Token Handling")
self.callbacks.registerSessionHandlingAction(self)
self.callbacks.registerHttpListener(self)
@thomaspatzke
thomaspatzke / Burp-SessionHandlingActionReplaceIDInResponse.py
Created February 2, 2015 11:19
This is a template for a Burp extension that can be used as session handling macro action. It pulls an identifier (here: last part of location header from redirection response) from the first macro response and puts it in the given place of the current request (here: last URL path component). Adapt as needed at the places marked with "CONFIG" co…
from burp import (IBurpExtender, ISessionHandlingAction)
import re
class BurpExtender(IBurpExtender, ISessionHandlingAction):
def registerExtenderCallbacks(self, callbacks):
self.callbacks = callbacks
self.helpers = callbacks.getHelpers()
callbacks.setExtensionName("Path Parameter Session Handling Action")
self.callbacks.registerSessionHandlingAction(self)
self.out = callbacks.getStdout()
@thomaspatzke
thomaspatzke / .vimrc
Last active December 4, 2018 08:50
My .vimrc
set nocompatible
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'davidhalter/jedi-vim'
Plugin 'vim-latex/vim-latex'
Plugin 'vim-syntastic/syntastic'
Plugin 'scrooloose/nerdtree'
@thomaspatzke
thomaspatzke / extract_post_parameters_from_burpexport-without_xmlstarlet.sh
Created January 19, 2015 13:24
Extract POST parameter (here javax.faces.ViewState) from files with saved HTTP requests
grep javax.faces.ViewState POSTs.xml | perl -mURI::Escape -ne '/javax\.faces\.ViewState=(.*?)&/; print URI::Escape::uri_unescape($1); print "\n"' | sort -u
@thomaspatzke
thomaspatzke / find_unique.sh
Created January 7, 2015 13:59
Generate a list of files with unique content
find -type f -exec sha256sum {} \; | sort | perl -ne '($h, $f) = /^(\S+)\s+(.*)$/; if (defined $ph && $ph ne $h || !defined $ph) { print "$f\n" } $ph = $h; $pf = $f;'
@thomaspatzke
thomaspatzke / extract_post_parameters_from_burpexport.sh
Last active August 29, 2015 14:11
Extract particular HTTP request parameter value (POST) from Burp XML save file without Base64 request/response encoding. Here I extract the NavigationTarget parameter of a SAP Portal application.
xmlstarlet sel -t -m '//items/item[contains(./request,"NavigationTarget")]' -v 'substring-before(substring-after(./request, "NavigationTarget="), "&")' -n Crawl-*.xml | perl -mURI::Escape -ne 'print URI::Escape::uri_unescape($_);' | sort -u
@thomaspatzke
thomaspatzke / keybase.md
Last active August 29, 2015 14:07
keybase.md

Keybase proof

I hereby claim:

  • I am thomaspatzke on github.
  • I am thomaspatzke (https://keybase.io/thomaspatzke) on keybase.
  • I have a public key whose fingerprint is ADDB 3A1A 80DE 4D0E 79B9 58AD 5F1A A4D8 C753 A286

To claim this, I am signing this object:

@thomaspatzke
thomaspatzke / gist:e3dbbc7eba710874e7e3
Created September 12, 2014 11:29
Convert something into URL encoding
| hd | perl -ne 's/^\d+\s+//d; s/\s+\|.*?$//g; s/([\da-f]+)\s+/%$1/g; print;'
@thomaspatzke
thomaspatzke / mysapsso-decoder.py
Last active June 7, 2023 14:54
Decoder/Encoder for MYSAPSSO2 Cookies/SAP SSO tokens
#!/usr/bin/python3
# mysapsso.py - Decoding MYSAPSSO2 cookies
import sys
import fileinput
import urllib.parse
import base64
import binascii
import re
import struct
@thomaspatzke
thomaspatzke / openssl-heartbleed-server.py
Created April 9, 2014 15:10
Very quick&dirty TLS server for testing if client implementations are affected by the Heartbleed vulnerability, before crypto (key exchange etc.) is established.
#!/usr/bin/python3
# openssl-heartbleed-server.py
# Check TLS clients for OpenSSL Heartbleed vulnerability.
import socketserver
import struct
import random
class HeartbleedServer(socketserver.BaseRequestHandler):