Swapped EXPLOIT_PHASE_SETUP/SPRAY to match gaster execution order. Aligned version to 0.2.0 in both tr4mpass.h and start.sh. Log now checks isatty(stderr) before emitting ANSI colors. Makefile warns when pkg-config cannot find required libraries. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
53 lines
1.4 KiB
C
53 lines
1.4 KiB
C
/* exploit.h -- Common exploit types and lifecycle API */
|
|
|
|
#ifndef EXPLOIT_H
|
|
#define EXPLOIT_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include "device/device.h"
|
|
#include "device/chip_db.h"
|
|
|
|
/* Exploit phase constants */
|
|
#define EXPLOIT_PHASE_INIT 0
|
|
#define EXPLOIT_PHASE_RESET 1
|
|
#define EXPLOIT_PHASE_SETUP 2
|
|
#define EXPLOIT_PHASE_SPRAY 3
|
|
#define EXPLOIT_PHASE_PATCH 4
|
|
#define EXPLOIT_PHASE_DONE 5
|
|
|
|
/*
|
|
* exploit_ctx_t -- shared context for any DFU exploit.
|
|
*
|
|
* Holds the device, chip info, current exploit phase, and the assembled
|
|
* payload buffer (ROP chain + shellcode concatenated).
|
|
*/
|
|
typedef struct {
|
|
device_info_t *dev;
|
|
const chip_info_t *chip;
|
|
int phase; /* EXPLOIT_PHASE_* */
|
|
uint8_t *payload_buf;
|
|
size_t payload_len;
|
|
} exploit_ctx_t;
|
|
|
|
/*
|
|
* exploit_init -- Populate ctx from device info. Looks up chip_info via
|
|
* cpid, verifies checkm8 vulnerability, allocates payload buffer.
|
|
* Returns 0 on success, -1 on failure.
|
|
*/
|
|
int exploit_init(exploit_ctx_t *ctx, device_info_t *dev);
|
|
|
|
/*
|
|
* exploit_deliver -- Execute the exploit stages (reset, spray, setup, patch).
|
|
* The specific exploit is selected based on chip type (currently only checkm8).
|
|
* Returns 0 on success, -1 on failure.
|
|
*/
|
|
int exploit_deliver(exploit_ctx_t *ctx);
|
|
|
|
/*
|
|
* exploit_cleanup -- Free payload buffer and zero the context.
|
|
*/
|
|
void exploit_cleanup(exploit_ctx_t *ctx);
|
|
|
|
#endif /* EXPLOIT_H */
|