Still being worked on :)
To build YAP on Windows, you need: CMake, MinGW GCC/G++, Python3, NSIS, and Git
For Linux, the following packages are needed: git cmake nsis python3 g++-mingw-w64 gcc-mingw-w64
git clone https://github.com/undisassemble/yap.git
cd yap
git checkout 0.0.0 # Optionally checkout release version
git submodule update --init --recursive
cmake . -DCMAKE_BUILD_TYPE=Release # Or Debug if thats what you're into
cmake --build .
yap.h and yap.dll, which can be found in the SDK folder of your installation, or bin if built manuallyyap.dll is only required if using Packer functionsyap.dll staticallyyap.dllyap.dll is automatically unlinked during protection, avoid distributing it with your programGetProcAddress
#include <stdio.h>
#include "yap.h"
void protect();
void unprotect();
int main() {
printf("Hello World!\n");
// Right
YAP_SUBSTITUTION(1);
YAP_MUTATIONLEVEL(5);
printf("Obfuscated code\n");
YAP_SUBSTITUTION(0);
YAP_MUTATIONLEVEL(0);
// Wrong
protect();
printf("Unobfuscated code\n");
unprotect();
return 0;
}
// Because of how to reassembler assembles code, these don't protect anything*.
void protect() {
YAP_SUBSTITUTION(1);
YAP_MUTATIONLEVEL(5);
}
// *they actually protect whatever is written here, assuming when it's compiled these functions follow each other in memory.
void unprotect() {
YAP_SUBSTITUTION(0);
YAP_MUTATIONLEVEL(0);
}
__declspec(dllimport) bool __stdcall CheckForDebuggers(_In_ bool bIsMainThread = false,
_In_ bool bCheckRunningProcs = false);
Check for attached debuggers.
It is highly recommended that you use this in your main thread, as no protective threads are spawned by the packer.
__declspec(dllimport) void __stdcall ShowErrorAndExit(_In_ const char* pMessage = "Error");
Kills all other running threads, shows an error message with the specified message, and exits.
Parameters
__declspec(dllimport) HMODULE __stdcall GetSelf();
Retrieves the base address of the running executable. If using anti-dump, GetModuleHandle(NULL) will return NULL, use this instead.
ReturnsHandle to self.
#define YAP_MUTATIONLEVEL(level) YAP_OP(YAP_OP_REASM_MUTATION | (level & 0b1111111))
Changes the reassemblers mutation setting.
#define YAP_SUBSTITUTION(enabled) YAP_OP(YAP_OP_REASM_SUB | (enabled & 1))
Changes the reassemblers substitution setting.