Skip to content

Instantly share code, notes, and snippets.

View njv299's full-sized avatar

Nathan Voss njv299

  • Finite State, Inc.
  • Prescott, AZ
View GitHub Profile
"""
fsk_message_service_test_harness.py
Loads the context of a process into Unicorn Engine,
loads a custom (mutated) inputs, and executes the
parser/handler routine.
Author:
Nathan Voss
"""
//--------------------
// From cgc_packet.h:
#define MAX_PACKET_LENGTH (48)
typedef struct PACKET_INFO_STRUCT
{
uint8_t packetData[MAX_PACKET_LENGTH];
uint32_t dataLen;
struct PACKET_INFO_STRUCT *pNextPacket;
@njv299
njv299 / cgc_packet parsing
Created November 7, 2017 20:27
afl-unicorn Advanced Example
//--------------------
// From cgc_packet.h:
#define MAX_PACKET_LENGTH (48)
typedef struct PACKET_INFO_STRUCT
{
uint8_t packetData[MAX_PACKET_LENGTH];
uint32_t dataLen;
struct PACKET_INFO_STRUCT *pNextPacket;
"""
Simple test harness for AFL's Unicorn Mode.
This loads the simple_target.bin binary (precompiled as MIPS code) into
Unicorn's memory map for emulation, places the specified input into
simple_target's buffer (hardcoded to be at 0x300000), and executes 'main()'.
If any crashes occur during emulation, this script throws a matching signal
to tell AFL that a crash occurred.
Run under AFL as follows:
@njv299
njv299 / simple_target.c
Last active October 31, 2017 21:57
Simple, toy example for testing afl-unicorn
/*
* Sample target file to test afl-unicorn fuzzing capabilities.
* This is a very trivial example that will crash pretty easily
* in several different exciting ways.
*
* Input is assumed to come from a buffer located at DATA_ADDRESS
* (0x00300000), so make sure that your Unicorn emulation of this
* puts user data there.
*
* Written by Nathan Voss <njvoss99@gmail.com>