etc~ scripts and random things |
| git clone https://github.com/djnnvx/etc.git |
| log | files | refs | archive |
beacon.h (2599B)
1 /* 2 * Beacon Object Files (BOF) 3 * ------------------------- 4 * A Beacon Object File is a light-weight post exploitation tool that runs 5 * with Beacon's inline-execute command. 6 * 7 * Cobalt Strike 4.1. 8 */ 9 10 /* data API */ 11 #pragma once 12 13 #ifdef BOF 14 typedef struct { 15 char * original; /* the original buffer [so we can free it] */ 16 char * buffer; /* current pointer into our buffer */ 17 int length; /* remaining length of data */ 18 int size; /* total size of this buffer */ 19 } datap; 20 21 DECLSPEC_IMPORT void BeaconDataParse(datap * parser, char * buffer, int size); 22 DECLSPEC_IMPORT int BeaconDataInt(datap * parser); 23 DECLSPEC_IMPORT short BeaconDataShort(datap * parser); 24 DECLSPEC_IMPORT int BeaconDataLength(datap * parser); 25 DECLSPEC_IMPORT char * BeaconDataExtract(datap * parser, int * size); 26 27 /* format API */ 28 typedef struct { 29 char * original; /* the original buffer [so we can free it] */ 30 char * buffer; /* current pointer into our buffer */ 31 int length; /* remaining length of data */ 32 int size; /* total size of this buffer */ 33 } formatp; 34 35 DECLSPEC_IMPORT void BeaconFormatAlloc(formatp * format, int maxsz); 36 DECLSPEC_IMPORT void BeaconFormatReset(formatp * format); 37 DECLSPEC_IMPORT void BeaconFormatFree(formatp * format); 38 DECLSPEC_IMPORT void BeaconFormatAppend(formatp * format, char * text, int len); 39 DECLSPEC_IMPORT void BeaconFormatPrintf(formatp * format, char * fmt, ...); 40 DECLSPEC_IMPORT char * BeaconFormatToString(formatp * format, int * size); 41 DECLSPEC_IMPORT void BeaconFormatInt(formatp * format, int value); 42 43 /* Output Functions */ 44 #define CALLBACK_OUTPUT 0x0 45 #define CALLBACK_OUTPUT_OEM 0x1e 46 #define CALLBACK_ERROR 0x0d 47 #define CALLBACK_OUTPUT_UTF8 0x20 48 49 DECLSPEC_IMPORT void BeaconPrintf(int type, char * fmt, ...); 50 DECLSPEC_IMPORT void BeaconOutput(int type, char * data, int len); 51 52 /* Token Functions */ 53 DECLSPEC_IMPORT BOOL BeaconUseToken(HANDLE token); 54 DECLSPEC_IMPORT void BeaconRevertToken(); 55 DECLSPEC_IMPORT BOOL BeaconIsAdmin(); 56 57 /* Spawn+Inject Functions */ 58 DECLSPEC_IMPORT void BeaconGetSpawnTo(BOOL x86, char * buffer, int length); 59 DECLSPEC_IMPORT void BeaconInjectProcess(HANDLE hProc, int pid, char * payload, int p_len, int p_offset, char * arg, int a_len); 60 DECLSPEC_IMPORT void BeaconInjectTemporaryProcess(PROCESS_INFORMATION * pInfo, char * payload, int p_len, int p_offset, char * arg, int a_len); 61 DECLSPEC_IMPORT void BeaconCleanupProcess(PROCESS_INFORMATION * pInfo); 62 63 /* Utility Functions */ 64 DECLSPEC_IMPORT BOOL toWideChar(char * src, wchar_t * dst, int max); 65 #endif