Skip to content

Instantly share code, notes, and snippets.

View williballenthin's full-sized avatar

Willi Ballenthin williballenthin

View GitHub Profile
@williballenthin
williballenthin / fls_with_find.sh
Created October 29, 2013 13:48
List active files on a file system in the [Bodyfile v3 format](http://wiki.sleuthkit.org/index.php?title=Body_file) using the common shell utility `find`.
find . -printf "0|%p|%i|%m|%U|%G|%s|%A@|%T@|%C@|0\n"
@williballenthin
williballenthin / skype-irc-adapter.py
Last active January 2, 2016 18:59
An IRC server that translates messages to/from a running instance of Skype.
#!/usr/bin/python
# TODOs
# Add support for:
# - WHOIS/WHO/WHOWAS
# - AWAY
# - creating chats
# - TOPIC (setting)
import logging
@williballenthin
williballenthin / decode_DateCreated.py
Created January 15, 2014 20:24
Decodes the DateCreated and DateLastCreated timestamp structures. See structure description here: http://cfed-ttf.blogspot.com/2009/08/decoding-datecreated-and.html
import sys
from datetime import datetime
import struct
buf = sys.stdin.read().rstrip("\r\n")
y, mo, w, d, h, mi, s, _ = struct.unpack("<HHHHHHHH", buf)
print datetime(y, mo, d, h, mi, s).isoformat("T") + "Z"
@williballenthin
williballenthin / gist:8514312
Created January 20, 2014 03:11
User defined list-mft output format example
Git/INDXParse - [master●] » python list_mft.py /evidence/case001/CMFT --prefix "C:" --format "{{ record.inode }}, {{ prefix }}{{ record.path }}, {{ record.is_active }}, {{ record.standard_information.accessed }}, {{ record.filename_information.created }}, {{ record.size }}" | head
0, C:\$MFT, 1, 2005-04-30 21:04:47.484373, 2005-04-30 21:04:47.484373, 181895168
1, C:\$MFTMirr, 1, 2005-04-30 21:04:47.484373, 2005-04-30 21:04:47.484373, 4096
2, C:\$LogFile, 1, 2005-04-30 21:04:47.484373, 2005-04-30 21:04:47.484373, 67108864
3, C:\$Volume, 1, 2005-04-30 21:04:47.484373, 2005-04-30 21:04:47.484373, 0
4, C:\$AttrDef, 1, 2005-04-30 21:04:47.484373, 2005-04-30 21:04:47.484373, 2560
5, C:, 1, 2012-03-19 13:18:46.741314, 2005-04-30 21:04:47.484373, 0
6, C:\$Bitmap, 1, 2005-04-30 21:04:47.484373, 2005-04-30 21:04:47.484373, 2442136
7, C:\$Boot, 1, 2005-04-30 21:04:47.484373, 2005-04-30 21:04:47.484373, 8192
8, C:\$BadClus, 1, 2005-04-30 21:04:47.484373, 2005-04-30 21:04:47.484373
@williballenthin
williballenthin / rip-with-templates.md
Last active August 29, 2015 13:58
Example output from RegRipper with user defined template support.

By default, rip.pl continues to use a default tempate

In subsequent examples, the template name is "legacy".

» perl rip.pl -r samples/XP/system -p appcompatcache                           
Launching appcompatcache v.20130425
appcompatcache v.20130425
(System) Parse files from System hive Shim Cache
@williballenthin
williballenthin / flare-on-6__extract_buffer.py
Last active February 25, 2023 17:26
IDAPython script to extract contents of global byte array in the FLARE-On Challenge #6
from idaapi import *
GEN_REG = 0x1
MEM_REF = 0x2
BASE_INDEX = 0x3
BASE_INDEX_DISP = 0x4
IMMED = 0x5
def doone(ea):
xrefs = []
@williballenthin
williballenthin / flare-on-6__solve_sc.py
Created October 4, 2014 01:47
IDAPython script to solve the expected byte sequence in the FLARE-On Challenge #6
"""
The shellcode in Challege 6 compares the string in RDI
against a bunch of conditions. This script extracts the
conditions and solves the constraints, yielding the
expected string.
"""
from idaapi import *
from williutils import *
@williballenthin
williballenthin / fuse-filter-by-ctime.py
Created October 28, 2014 15:49
FUSE module that exposes a copy of a source directory, but only entries whose `ctime` has changed in the past 10 minutes. Requires `fusepy`.
#!/usr/bin/env python
from __future__ import with_statement
import datetime
from errno import EACCES
from os.path import realpath
from sys import argv, exit
from threading import Lock
"""
mutablenamedtuple is like collections.namedtuple, but the fields
may be modified. This makes it basically a record type.
Desired usage:
F = mutablenamedtuple("F", ["foo", "bar", "baz"])
f = F(1, bar=2, baz=3)
f.baz = 9
print(f)
--> "F(foo=1, bar=2, baz=9)"