Skip to content

Instantly share code, notes, and snippets.

@dnet
dnet / unzipwrapper.py
Created November 27, 2015 11:52
Partial implementation of the interface provided by zipfile.ZipFile using the unzip command
from subprocess import Popen, PIPE
from tempfile import TemporaryFile
from os import devnull
class ZipFile(object):
def __init__(self, filename):
self.filename = filename
open(filename).close()
def __enter__(self):
@dnet
dnet / Decode ARM64 CFString.py
Created February 1, 2016 21:30
ARM64 CFString decoder script for Hopper
import struct, re
doc = Document.getCurrentDocument()
sg = doc.getCurrentSegment()
addr = doc.getCurrentAddress()
i1 = sg.getInstructionAtAddress(addr)
if i1.getInstructionString() == 'adrp':
@dnet
dnet / extract.py
Created August 31, 2016 09:23
Extracting main icon from 64-bit PE (Windows EXE) files in Python 2.x using 7z (p7zip)
#!/usr/bin/env python
import subprocess, tempfile, struct, shutil, os
HDR_FMT = '<hhh'
HDR_LEN = struct.calcsize(HDR_FMT)
def extract_64bit_ico(exefn, icofn):
d = tempfile.mkdtemp()
gis = os.path.join(d, '.rsrc', 'GROUP_ICON')
@dnet
dnet / ssh-yubisign.py
Created March 13, 2021 22:46
Quick and dirty OpenSSH agent to OpenPGPpy bridge
#!/usr/bin/env python3
import base64
import getpass
import os
import socket
import struct
import sys
import OpenPGPpy # requires https://github.com/dnet/OpenPGPpy/commit/d97a2184a1c1e40599ad1db30b06d33bb7178e59