// Welcome to TaaprWare V3

//#define USE_PIPE
#define USE_CONSOLE
#define RAISE_IDENTITY 8 // Change the number or comment it out
#include <stdio.h>
#include <iostream>

uintptr_t state;

void refresh_state() {
	printf("Getting lua state\n");
	printf("Getting TaskScheduler...\n");
	Sleep(100);
	objects::task_scheduler* scheduler = functions::getscheduler();
	printf("Iterating through jobs...\n");
	Sleep(100);
	objects::instance* datamodel = new objects::instance;
	// Simplicity, skids
	for (std::shared_ptr<objects::job> job : scheduler->jobs) {
		printf("Job %p: ", job.get()); // In the case that printing the job name crashes Roblox we can see which job was responsible
		printf("%s\n", job->name.c_str());
		if (job->name == "WaitingHybridScriptsJob") {
			printf("Found WaitingHybridScriptsJob\n");
			datamodel = reinterpret_cast<objects::instance*>(job->datamodel_minus_4 + 4);
		} 
	}
	printf("DataModel: %p\n", datamodel);
	printf("Getting ScriptContext...\n");
	Sleep(100);
	objects::instance* scriptcontext = new objects::instance;
	for (std::shared_ptr<objects::instance> instance : *(datamodel->children)) {
		// Always check ClassName, skids
		if (*(instance->class_descriptor->class_name) == "ScriptContext") {
			scriptcontext = instance.get();
		}
	}
	printf("ScriptContext: %p\n", scriptcontext);
	Sleep(100);
	// This is how scripts start, skids (except TaaprWareV3 doesn't create a thread)
	state = offsets::scriptcontext::get_scriptstate(reinterpret_cast<uintptr_t>(scriptcontext));
	printf("Lua state: %X\n", state);
	Sleep(100);
#ifdef RAISE_IDENTITY
	// This navigates to L->userdata aka extra space
	// Then navigates to userdata->identity
	// Userdata/extra space is every Roblox-related attribute to lua states
	*reinterpret_cast<int*>(*reinterpret_cast<uintptr_t*>(state + 0x48) + 0x18) = RAISE_IDENTITY;
	printf("Raised identity to %d\n", RAISE_IDENTITY);
#endif
	Sleep(100);
}

class : public Luau::BytecodeEncoder {
	std::uint8_t encodeOp(const std::uint8_t opcode) {
		return opcode * 227;
	}
} encoder{};
void execute(std::string source) {
	uintptr_t old_top = *reinterpret_cast<uintptr_t*>(state + offsets::state::top);
	Luau::CompileOptions options{};
	options.coverageLevel = 0;
	options.debugLevel = 1;
	options.optimizationLevel = 1;
	std::string compiled = Luau::compile("spawn(function() " + source + " end)", options, {}, &encoder);
	bool success = decompressed_luavm_load(state, compiled);
	if (success) {
		printf("Running function\n");
		// If you're a beginner, luavm_load pushes a function onto the lua state's stack
		// task.defer (or any other function like it) takes a function from the stack and runs it
		functions::task_defer(state);
		printf("Execution success\n");
	} else {
		printf("Not running function because luavm_load failed\n");
		printf("Execution failed\n");
	}
	*reinterpret_cast<uintptr_t*>(state + offsets::state::top) = old_top; // Return the stack to normal so that other exploit scripts AND other Roblox scripts are able to run correctly
}

int main() {
	printf("TaaprWare V3 has begun!\n");
	Sleep(100);
	refresh_state();
	// Do whatever you want with the lua state!
#ifdef USE_PIPE
	std::unique_ptr<char[]> buffer(new char[65536]);
	DWORD read_size;
	HANDLE pipe = CreateNamedPipeW(
		L"\\\\.\\pipe\\TaaprWareV3",
		PIPE_ACCESS_DUPLEX | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE,
		PIPE_WAIT,
		1,
		65536,
		65536,
		NMPWAIT_USE_DEFAULT_WAIT,
		NULL
	);
	if (pipe == INVALID_HANDLE_VALUE) {
		printf("[ERROR] Failed to create pipe! Error code: %d\n", GetLastError());
		return;
	}
	PurgeComm(pipe, PURGE_RXCLEAR | PURGE_TXCLEAR);
	while (ConnectNamedPipe(pipe, NULL) != FALSE) {
		std::vector<char> source;
		while (ReadFile(pipe, buffer.get(), 65536, &read_size, NULL) != FALSE) {
			source.insert(source.end(), buffer.get(), buffer.get() + read_size);
			if (read_size < 65536) {
				break;
			}
		}
		PurgeComm(pipe, PURGE_RXCLEAR | PURGE_TXCLEAR);
		execute(std::string(source.begin(), source.end()));
		DisconnectNamedPipe(pipe);
	}
#else
	while (true) {
		printf("Not using pipe, enter script below (no newlines):\n");
		std::string source;
		std::getline(std::cin, source);
		execute(source);
	}
#endif
	printf("Goodbye!\n");
}

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
		// The classic detected console bypass that all skids use, disable it if you want
#ifdef USE_CONSOLE
		DWORD original_protection;
		VirtualProtect(&FreeConsole, sizeof(uint8_t), PAGE_EXECUTE_READWRITE, &original_protection);
		*(uint8_t*)(&FreeConsole) = 0xC3;
		VirtualProtect(&FreeConsole, sizeof(uint8_t), original_protection, NULL);
		AllocConsole();
		FILE* stream;
		freopen_s(&stream, "CONIN$", "r", stdin);
		freopen_s(&stream, "CONOUT$", "w", stdout);
#endif
		CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)(main), NULL, 0, NULL);
    }
    return TRUE;
}
 

C++ Online Compiler

Write, Run & Share C++ code online using OneCompiler's C++ online compiler for free. It's one of the robust, feature-rich online compilers for C++ language, running on the latest version 17. Getting started with the OneCompiler's C++ compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as C++ and start coding!

Read inputs from stdin

OneCompiler's C++ online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.

#include <iostream>
#include <string>
using namespace std;

int main() 
{
    string name;
    cout << "Enter name:";
    getline (cin, name);
    cout << "Hello " << name;
    return 0;
}

About C++

C++ is a widely used middle-level programming language.

  • Supports different platforms like Windows, various Linux flavours, MacOS etc
  • C++ supports OOPS concepts like Inheritance, Polymorphism, Encapsulation and Abstraction.
  • Case-sensitive
  • C++ is a compiler based language
  • C++ supports structured programming language
  • C++ provides alot of inbuilt functions and also supports dynamic memory allocation.
  • Like C, C++ also allows you to play with memory using Pointers.

Syntax help

Loops

1. If-Else:

When ever you want to perform a set of operations based on a condition If-Else is used.

if(conditional-expression) {
   //code
}
else {
   //code
}

You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.

2. Switch:

Switch is an alternative to If-Else-If ladder.

switch(conditional-expression){    
case value1:    
 // code    
 break;  // optional  
case value2:    
 // code    
 break;  // optional  
......    
    
default:     
 code to be executed when all the above cases are not matched;    
} 

3. For:

For loop is used to iterate a set of statements based on a condition.

for(Initialization; Condition; Increment/decrement){  
  //code  
} 

4. While:

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while (condition) {  
// code 
}  

5. Do-While:

Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.

do {  
 // code 
} while (condition); 

Functions

Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity. Function gets run only when it is called.

How to declare a Function:

return_type function_name(parameters);

How to call a Function:

function_name (parameters)

How to define a Function:

return_type function_name(parameters) {  
 // code
}