Skip to content

Instantly share code, notes, and snippets.

View dweinstein's full-sized avatar

David Weinstein dweinstein

View GitHub Profile
/*
* SEP firmware split tool
*
* Copyright (c) 2017 xerub
*/
#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@tuupola
tuupola / protomower.sh
Last active June 29, 2021 21:52
Extract protocol buffer messages from binary data
#!/bin/bash
#
# Try to decode hidden protocol buffers message from binary
size=$(wc -c < $1)
for ((i=1; i<=$size; i++))
do
# Skip $i bytes and decode
dd if=$1 bs=1 skip=$i | protoc --decode_raw
@dweinstein
dweinstein / guess-encoding.js
Last active October 21, 2016 01:12
Guess encoding of zip based on `_zip_guess_encoding` from libzip
'use strict';
const ZIP_ENCODING_UNKNOWN = 0;
const ZIP_ENCODING_ASCII = 1;
const ZIP_ENCODING_UTF8_KNOWN = 2;
const ZIP_ENCODING_UTF8_GUESSED = 3;
const ZIP_ENCODING_CP437 = 4;
const ZIP_ENCODING_ERROR = 5;
module.exports.zipEncodings = {
@dweinstein
dweinstein / 0README.md
Last active October 9, 2016 15:36
Template for organizing Frida agents. Should make it easier for community to be able to reuse code. Example device side agents and how to potentially organize them.

SUMMARY

The idea here is to organize multiple agent scripts into modules that can be combined into an aggregated agent.

frida agents generally live under e.g., an ./lib/agents directory in a top level project.

TODO

For each agent script we need a top level runner and then we use frida-compile to build into a single agent script that we can load.

@oleavr
oleavr / 00-README.md
Last active June 16, 2023 02:11
Frida devkit examples

frida-gum-example.c

$ clang -Wall -Os -pipe -g3 frida-gum-example.c -o frida-gum-example -L. -lfrida-gum -lresolv -Wl,-dead_strip -Wl,-no_compact_unwind
$ ./frida-gum-example
[*] open("/etc/hosts")
[*] close(3)
[*] open("/etc/fstab")
[*] close(-1)
[*] listener got 4 calls

[*] listener still has 4 calls

@f1sherman
f1sherman / forwarding-example.md
Last active March 12, 2021 00:21
Port Forwarding Example in OS X El Capitan

Add the following to /etc/pf.anchors/myname:

rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 4000
rdr pass on lo0 inet proto tcp from any to any port 443 -> 127.0.0.1 port 4001

Add the following to /etc/pf-myname.conf:

rdr-anchor "forwarding"
load anchor "forwarding" from "/etc/pf.anchors/myname"

#Loading Tweaks in the Simulator

With the latest updates to the simulator, this turns out to be pretty simple:

You need to be using kirb/theos

In order not to require MobileSubstrate to be loaded and your tweak to be compiled for i386/x86_64, add

In your makefile:

@oleavr
oleavr / _FridaCommonJSIntegration.md
Last active January 8, 2024 16:21
How to consume npm modules from Frida agent scripts

Install Node.js 5.x, then:

npm install frida co uuid

and run:

node app.js
@heapwolf
heapwolf / stacktrace.hpp
Last active August 29, 2016 15:29
a simple zero-touch, header only stack-trace provider for c++
#ifndef STACK_TRACE_H
#define STACK_TRACE_H
#include <iostream>
#include <signal.h>
#include <string>
#include <dlfcn.h>
#include <cxxabi.h>
#include <regex>
#include <execinfo.h>
BKAccelerometer_server
BKAccelerometer_server_routine
SBAcquireApplicationTerminationAssertion
SBActivateAssistantWithContext
SBAddAlertItemsSuppressionAssertion
SBAddBiometricUnlockSuppressionAssertion
SBAddDownloadingIconForDisplayIdentifier
SBAddDownloadingIconForDisplayIdentifierWithSoftwareType
SBAddThermalWarningSuppressionAssertion
SBAddWallpaperAnimationSuspensionAssertion