MCPcopy Index your code
hub / github.com/CySHell/ClassyPP

github.com/CySHell/ClassyPP @1.7

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.7 ↗ · + Follow
148 symbols 358 edges 28 files 13 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ClassyPP

Microsoft Visual Studio C++ Class information extraction.

Description:

This plugin aims to aid in reverse engineering binaries compiled with MSVC and written in C++. Such binaries often contain extremely useful information about the classes and types used within it - Information that is invaluable to reverse engineering efforts.

This plugin performs 3 main actions:

RTTI Inspection

Search the executable for RTTI (Real-Time Type information) structures, and define the actual symbols with types within the BinaryView, including demangled class names.

-BEFORE-

RTTI Inspection - Before

-AFTER-

RTTI Inspection - After

Resolve and Define Virtual-Function tables

Any C++ class will have its own vfTable within the executable. Identifying this vfTable is crucial in order to understand what functions belong to what class.

This plugin takes this process one step further - Using Graph theory algorithms it will approximate which class owns which function within a given vfTable. This is important because not all derived classes override functions within their base class, which means that the derived class vfTable might contain functions that belong to the base class, and often times functions belonging to several different base classes.

-BEFORE-

vfTable - Before

-AFTER-

vfTable - After

Detect and Define Constructor\Destructor functions

Base on information obtained in the preceeding steps, it is possible to locate suspected constructor and Destructor functions for the various detected classes. The plugin will either annotate the suspected constructor\destructor with a comment or change the name of the function to reflect the detection.

Define class types for known Classes

Using information extracted from the MSVC compiler (CL) regarding the memory layout of compiled classes it is possible to define the actual class type as it apears in memory - This type can later be applied to any function using the "This" pointer. Version 1.0 of this plugin contains memory layout information from many classes of the following libraries: - standard lib - Protobuf - Standard Template Library - CryptoPP The plugin will autoamtically define any class type in its database if the corresponding class is found to be resident in the executable.

class definition

Installation

This plugin installs as a normal binja plugin - just clone it into the plugins' directory. Edit the Config.py file for values suitable to your environment.

Limitations:

- Supports MSVC compiled binaries Only
- x86 32\64 bit architecture only
- Currently no support for Multiple Virtual Inheritence (Support for this will be added in the future)

Acknowledgment

This plugin uses the Demumble project in order to demangle C++ symbols - https://github.com/nico/demumble.

License

This plugin is released under an MIT license.

Core symbols most depended-on inside this repo

GetClassDescriptorFromChd
called by 3
RttiInformation/ClassHierarchyInference/ClassHierarchyDeduction.py
standardize_int_size
called by 3
RttiInformation/ClassMemoryLayout/LayoutParser.py
UpdateCompleteObjectLocatorsList
called by 2
RttiInformation/ClassContext.py
Define_TypeDescriptor
called by 2
RttiInformation/TypeCreation.py
GetVtableAddr
called by 2
RttiInformation/CompleteObjectLocator.py
populate_class_layout
called by 2
RttiInformation/ClassMemoryLayout/LayoutParser.py
GetUserInputs
called by 1
StartInspection.py
CleanupPlugin
called by 1
StartInspection.py

Shape

Method 70
Function 66
Class 12

Languages

Python100%

Modules by API surface

RttiInformation/CompleteObjectLocator.py19 symbols
RttiInformation/ClassMemoryLayout/LayoutParser.py16 symbols
RttiInformation/BaseClassDescriptor.py16 symbols
RttiInformation/ClassHierarchyInference/ClassHierarchyDeduction.py13 symbols
ClassDataStructureDetection/Constructors/DetectConstructor.py13 symbols
RttiInformation/ClassContext.py11 symbols
RttiInformation/VirtualTableInference/VirtualFunctionTable.py10 symbols
RttiInformation/ClassHierarchyDescriptor.py10 symbols
StartInspection.py9 symbols
RttiInformation/BaseClass.py7 symbols
RttiInformation/TypeCreation.py6 symbols
RttiInformation/BaseClassArray.py4 symbols

For agents

$ claude mcp add ClassyPP \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact