Skip to content

Instantly share code, notes, and snippets.

@bannsec
bannsec / pwntools-r2-gdb
Last active November 18, 2018 23:46
pwntools-r2
#!/usr/bin/env python3
"""
This enables use of radare2 for pwntools
Steps to enable
1. Download and save as "pwntools-gdb" somewhere in your PATH
2. chmod u+x pwntools-gdb
3. In your gdbscript, start lines with hashtag "#" that you want to get executed by radare2. For instance, to set a breakpoint automatically, you would use gdbscript="#r2.cmd('db sym.amin')"
4. Update line 60 if you're not a screen user..
"""
@bannsec
bannsec / .gdbinit
Created February 5, 2018 17:38
GDB PIE Breakpoint Script
#
# Add this to your .gdbinit script to create a pie breakpoint helper. Once added, you can create a PIE breakpoint by the following
# breakpoint_pie file_name offset
# file_name == string name of the file. This can be the main binary, a library, etc.
# offset == Offset to set breakpoint at. This could be an integer or a symbol name if that symbol is resolvable. For instance "main".
#
python
import re
import os
@bannsec
bannsec / dump_win_key.vbs
Created January 31, 2018 13:17
Dump Windows Product Key
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
@bannsec
bannsec / Creating ssh-key from yubikey
Last active December 24, 2017 22:33
Couple commands to export your ssh-key from a yubikey
# Assuming you already generated the private key using some other method, this will extract and create a ssh-key OpenSSH format that can be used for authenticating to openssh.
# This is most useful for ECC keys for right now, as ssh-keygen does not read it correctly.
# Lists out what keys you have on the device. Note the "ID" of the key you want
pkcs15-tool --list-public-keys
# Dump it out
pkcs15-tool --read-public-key <id> > my_key.pub