Skip to content

Instantly share code, notes, and snippets.

Avatar

Zachary Cutlip zcutlip

View GitHub Profile
View new, missing, changed planets.txt
Date/time: 2021-03-02T18:47:39.428075-08:00
Information source: https://en.wikipedia.org/wiki/List_of_Star_Wars_planets_and_moons
Planets added:
Aleen
Endor (Sanctuary)
Esseles
Jestefad
Sissubo
@zcutlip
zcutlip / fahmonitor.lua
Created Jun 14, 2020
Hammerspoon module to pause/unpause Folding@Home
View fahmonitor.lua
screenSleep = false
screenSaver = false
screenLock = false
--[[
A module to pause/unpause Folding@Home depending on screensaver, screen lock, and
screen sleep state.
Folding@Home's "only when idle" mode does not pause/unpause the client at obvious times
or for obvious reasons. Instead, This module uses screen state as in indicator that the
user is/isn't interacting with the system.
@zcutlip
zcutlip / color_bb.py
Last active Feb 14, 2020
Ghidra Script to Colorize all Basic Blocks for a Provided list of Addresses
View color_bb.py
from java.awt import Color
from ghidra.util.task import ConsoleTaskMonitor
from ghidra.program.model.block import BasicBlockModel
from docking.options.editor import GhidraColorChooser
"""
Ghidra script to colorize all basic blocks identified by the input file.
Prompts for a file to use as input. This script will attempt to sanity check
that a basic block actually does start at each provided address.
@zcutlip
zcutlip / function_bb.py
Created Feb 12, 2020
Ghidra Script to List all Basic Block Addresses for a Function
View function_bb.py
import os
from ghidra.program.model.block import BasicBlockModel
from ghidra.util.task import ConsoleTaskMonitor
"""
Ghidra script to identify the addresses of all basic blocks within a function
Prompts for name of a function, and name of an output file. Locates all basic block addreses
and writes them to the output file.
"""
@zcutlip
zcutlip / example.md
Created Feb 4, 2020
Using py-object-file to Parse a Mach-O
View example.md

Using py-object-file to Parse a Mach-O

First, instantiate a Mach object, passing it the path to a mach-o binary:

m = Mach("/usr/lib/libobjc.A.dylib")

The Mach class treats all mach-o binaries as if they're fat binaries with at least once slice. So to work with your mach-o you first have to get its slice, even if it's not a fat binary. You can either to this by architecture name or slice index:

@zcutlip
zcutlip / lldb-hand-rolled-headers.md
Last active Jan 25, 2021
Importing Hand-Rolled C Header Files in LLDB
View lldb-hand-rolled-headers.md

Importing Hand-Rolled C Header Files in LLDB

Scenario

  • We're debugging a dylib, libhello.dylib
  • The dylib is linked from hello
  • The exported function is helloworld()
  • We do not have source, but have reversed a struct from the library and created a hand-crafted header file

Header File

@zcutlip
zcutlip / adding-a-vmware-static-dhcp.md
Created Nov 8, 2019
Automatically adding a static DHCP reservation to VMWare's dhcpd.conf and to /etc/hosts
View adding-a-vmware-static-dhcp.md
(0) $ python3 -m vmware_static_dhcp.vmware_static_dhcp --help
usage: vmware_static_dhcp.py [-h] --hw-addr HW_ADDR --ip-addr IP_ADDR
                             --hostname HOSTNAME
                             updated_hosts_path updated_dhcpd_conf_path

positional arguments:
  updated_hosts_path    Path to updated hosts file
  updated_dhcpd_conf_path
                        Path to update dhcpd.conf file.
@zcutlip
zcutlip / deletebranch.sh
Last active Oct 28, 2019
(Relatively) safely delete a git branch from local and remote
View deletebranch.sh
#!/bin/sh
# File: deletebranch.sh
# Author: Zachary Cutlip <uid000@gmail.com>
# Purpose: (Relatively) safely delete specified branch from local and origin in one pass
quit(){
if [ $# -gt 1 ];
then
echo $1