cobf
PE imports obfuscator
utils.hpp File Reference

Go to the source code of this file.

Enumerations

enum  cobf_error {
  cobf_error::COBF_NO_ERROR, cobf_error::COBF_CANNOT_OPEN_FILE, cobf_error::COBF_CANNOT_CREATE_FILE, cobf_error::COBF_CANNOT_GET_SIZE,
  cobf_error::COBF_CANNOT_READ_FILE, cobf_error::COBF_INVALID_DOS_HDR, cobf_error::COBF_INVALID_NT_HDRS, cobf_error::COBF_UNSUPPORTED_PE,
  cobf_error::COBF_INVALID_SECTION_HDR, cobf_error::COBF_INVALID_IMPORTS_DIR, cobf_error::COBF_CANNOT_PARSE_IMPORTS, cobf_error::COBF_CANNOT_WRITE_FILE,
  cobf_error::COBF_CANNOT_CLEAR, cobf_error::COBF_CANNOT_CREATE_SECTION, cobf_error::COBF_CANNOT_ADD_ENTRY, cobf_error::COBF_CANNOT_DISABLE_RELOCS,
  cobf_error::COBF_INVALID_IAT_SECTION, cobf_error::COBF_CANNOT_REMOVE_DBG_SYMS, cobf_error::COBF_MODULE_NOT_FOUND, cobf_error::COBF_PE_LOADED,
  cobf_error::COBF_PE_UNLOADED, cobf_error::COBF_SYMS_NOT_FOUND
}
 

Functions

void cobf_format_message (cobf_error err_msg, char *buffer, unsigned int size)
 Format the error to a message. More...
 

Detailed Description

This file contains the utilities used by the library.

Definition in file utils.hpp.

Enumeration Type Documentation

◆ cobf_error

enum cobf_error
strong

Errors reported by the library.

Enumerator
COBF_NO_ERROR 

The operation was successfull.

COBF_CANNOT_OPEN_FILE 

Cannot open the file from the disk.

COBF_CANNOT_CREATE_FILE 

Cannot create the file to the disk.

COBF_CANNOT_GET_SIZE 

Cannot get the file size.

COBF_CANNOT_READ_FILE 

Cannot read the file data.

COBF_INVALID_DOS_HDR 

The dos header cannot be verified.

COBF_INVALID_NT_HDRS 

The nt headers cannot be verified.

COBF_UNSUPPORTED_PE 

The PE type is not supported.

COBF_INVALID_SECTION_HDR 

The sections header cannot be verified.

COBF_INVALID_IMPORTS_DIR 

The imports directory cannot be verified.

COBF_CANNOT_PARSE_IMPORTS 

Unable to parse all of the imported symbols.

COBF_CANNOT_WRITE_FILE 

Cannot write to the file.

COBF_CANNOT_CLEAR 

Cannot close the file handle.

COBF_CANNOT_CREATE_SECTION 

Cannot create a new section for the shellcode.

COBF_CANNOT_ADD_ENTRY 

Cannot add the entry of the shellcode as a callback.

COBF_CANNOT_DISABLE_RELOCS 

Cannot remove the relocations from the PE.

COBF_INVALID_IAT_SECTION 

Cannot get the section of the import table.

COBF_CANNOT_REMOVE_DBG_SYMS 

Cannot remove the symbols table.

COBF_MODULE_NOT_FOUND 

The module was not found.

COBF_PE_LOADED 

The PE is already loaded.

COBF_PE_UNLOADED 

The PE is already unloaded.

COBF_SYMS_NOT_FOUND 

The symbol(s) couldn't be found.

Definition at line 15 of file utils.hpp.

Function Documentation

◆ cobf_format_message()

void cobf_format_message ( cobf_error  err_msg,
char *  buffer,
unsigned int  size 
)

Format the error to a message.

Parameters
[in]err_msgThe error to convert.
[in]bufferThe buffer to receive the data.
[in]sizeThe size of the buffer.

Definition at line 15 of file utils.cpp.