Baseer 0.2.0
Baseer is an advanced binary analysis tool designed to provide deep insights into any file.
Loading...
Searching...
No Matches
baseer.h File Reference

Core file handling and execution API for Baseer. More...

#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <stdbool.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include "linenoise.h"

Go to the source code of this file.

Classes

struct  inputs
 Struct representing command-line inputs. More...
struct  baseer_target_t
 Struct representing a file target in memory or streaming mode. More...

Macros

#define BASEER_VERSION_MAJOR   0
#define BASEER_VERSION_MINOR   2
#define BASEER_VERSION_MICRO   0
#define STRINGIFY(x)
#define TOSTRING(x)
#define BASEER_VERSION
#define BASEER_MAX_FILE_SIZE   1024 * 1024 * 4
#define RETURN_NULL_IF(con)
#define BASEER_BASE_OFFSET(b, i, sf)
#define COLOR_RESET   "\033[0m"
#define COLOR_BLACK   "\033[30m"
#define COLOR_GRAY   "\033[90m"
#define COLOR_RED   "\033[31m"
#define COLOR_GREEN   "\033[32m"
#define COLOR_YELLOW   "\033[33m"
#define COLOR_BLUE   "\033[34m"
#define COLOR_MAGENTA   "\033[35m"
#define COLOR_CYAN   "\033[36m"
#define COLOR_WHITE   "\033[37m"
#define COLOR_BBLACK   "\033[1;30m"
#define COLOR_BRED   "\033[1;31m"
#define COLOR_BGREEN   "\033[1;32m"
#define COLOR_BYELLOW   "\033[1;33m"
#define COLOR_BBLUE   "\033[1;34m"
#define COLOR_BMAGENTA   "\033[1;35m"
#define COLOR_BCYAN   "\033[1;36m"
#define COLOR_BWHITE   "\033[1;37m"
#define COLOR_BG_BLACK   "\033[40m"
#define COLOR_BG_RED   "\033[41m"
#define COLOR_BG_GREEN   "\033[42m"
#define COLOR_BG_YELLOW   "\033[43m"
#define COLOR_BG_BLUE   "\033[44m"
#define COLOR_BG_MAGENTA   "\033[45m"
#define COLOR_BG_CYAN   "\033[46m"
#define COLOR_BG_WHITE   "\033[47m"
#define MAX_INPUT_ARGS   20
#define DEFAULT_BLOCK_LENGTH   16
#define BLOCK_LENGTH   (get_block_length())

Typedefs

typedef struct baseer_target_t baseer_target_t
 Struct representing a file target in memory or streaming mode.
typedef bool(* baseer_callback_t) (baseer_target_t *, void *arg)
 Callback function type for file analysis.

Enumerations

enum  baseer_mode_t { BASEER_MODE_MEMORY , BASEER_MODE_STREAM , BASEER_MODE_BOTH }
 Enum representing file access modes.

Functions

baseer_target_tbaseer_open (char *file_path, baseer_mode_t mode)
 Open a file in specified mode (memory, streaming, or both)
void baseer_close (baseer_target_t *target)
 Close a file target and free associated resources.
void baseer_print (baseer_target_t *target)
 Print a hex dump of the file target.
bool baseer_execute (baseer_target_t *target, baseer_callback_t callback, void *arg)
 Execute a callback on a file target.

Detailed Description

Core file handling and execution API for Baseer.

Provides memory and streaming file access, as well as execution of analysis tools using a unified callback interface.

Macro Definition Documentation

◆ BASEER_BASE_OFFSET

#define BASEER_BASE_OFFSET ( b,
i,
sf )
Value:
(b) + ((i) * (sf))

◆ BASEER_MAX_FILE_SIZE

#define BASEER_MAX_FILE_SIZE   1024 * 1024 * 4

Max file size for memory mode

◆ BASEER_VERSION

#define BASEER_VERSION
Value:
TOSTRING(BASEER_VERSION_MAJOR) "." \
TOSTRING(BASEER_VERSION_MINOR) "." \
TOSTRING(BASEER_VERSION_MICRO)

◆ RETURN_NULL_IF

#define RETURN_NULL_IF ( con)
Value:
if ((con)) \
{ \
return NULL; \
}

◆ STRINGIFY

#define STRINGIFY ( x)
Value:
#x

◆ TOSTRING

#define TOSTRING ( x)
Value:
STRINGIFY(x)

Typedef Documentation

◆ baseer_callback_t

typedef bool(* baseer_callback_t) (baseer_target_t *, void *arg)

Callback function type for file analysis.

Parameters
targetPointer to the file target
argAdditional user argument
Returns
true on success, false on failure

Function Documentation

◆ baseer_close()

void baseer_close ( baseer_target_t * target)

Close a file target and free associated resources.

Parameters
targetPointer to the file target

◆ baseer_execute()

bool baseer_execute ( baseer_target_t * target,
baseer_callback_t callback,
void * arg )

Execute a callback on a file target.

Parameters
targetPointer to the file target
callbackCallback function
argAdditional argument
Returns
true on success, false on failure

◆ baseer_open()

baseer_target_t * baseer_open ( char * file_path,
baseer_mode_t mode )

Open a file in specified mode (memory, streaming, or both)

Parameters
file_pathPath to the file
modeAccess mode (MEMORY, STREAM, BOTH)
Returns
Pointer to baseer_target_t on success, NULL on failure

◆ baseer_print()

void baseer_print ( baseer_target_t * target)

Print a hex dump of the file target.

Parameters
targetPointer to the file target