From a6b145b4c8e75982123d2a9b721c77cdffb27dd2 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sun, 9 Nov 2025 20:45:55 -0500 Subject: [PATCH] feat: add extract_protocol tool to retrieve protocol signature from Overte's libnetworking.so --- tools/extract_protocol.cpp | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tools/extract_protocol.cpp diff --git a/tools/extract_protocol.cpp b/tools/extract_protocol.cpp new file mode 100644 index 0000000..b64c102 --- /dev/null +++ b/tools/extract_protocol.cpp @@ -0,0 +1,48 @@ +// Extract protocol signature from Overte's libnetworking.so +// Compile: g++ -o extract_protocol extract_protocol.cpp -L/opt/overte/lib -lnetworking -Wl,-rpath,/opt/overte/lib +// Run: LD_LIBRARY_PATH=/opt/overte/lib:$LD_LIBRARY_PATH ./extract_protocol + +#include +#include +#include +#include + +// Declare the external C++ mangled function from libnetworking.so +// Symbol: _Z31protocolVersionsSignatureBase64v +extern "C" { + // We don't know the exact return type, but it's likely a QString or similar + // Let's try to call the hex version instead + // Symbol: _Z28protocolVersionsSignatureHexv + void* _Z28protocolVersionsSignatureHexv(); + void* _Z31protocolVersionsSignatureBase64v(); + void* _Z25protocolVersionsSignaturev(); +} + +int main() { + std::cout << "Attempting to extract protocol signature from /opt/overte/lib/libnetworking.so" << std::endl; + + try { + // Call the mangled function + void* result = _Z31protocolVersionsSignatureBase64v(); + + // Qt QString structure (simplified - may not work): + // Assuming QString is returned by value or we get a pointer + // This is tricky without Qt headers... + + std::cout << "Got result pointer: " << result << std::endl; + + // Try the raw bytes version instead + void* raw_result = _Z25protocolVersionsSignaturev(); + std::cout << "Got raw result pointer: " << raw_result << std::endl; + + // Without Qt, this won't work properly + std::cout << "ERROR: This approach requires linking against Qt and including Qt headers" << std::endl; + std::cout << "Try using 'strings' command instead:" << std::endl; + std::cout << " strings /opt/overte/domain-server | grep -E '^[A-Za-z0-9+/]{22}==$'" << std::endl; + + } catch (...) { + std::cout << "Exception caught" << std::endl; + } + + return 0; +}