mirror of
https://github.com/NohamR/RMHook.git
synced 2026-11-25 15:29:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85daf2902a | ||
|
|
0c4c72be2f | ||
|
|
93b011807c |
No files matched your search
@@ -2,3 +2,7 @@ build/
|
||||
.DS_Store
|
||||
/.vscode
|
||||
/research
|
||||
/aqt_venv
|
||||
/CMakeFiles
|
||||
/.qt
|
||||
Makefile
|
||||
+8
-1
@@ -49,7 +49,7 @@ set(LIBS
|
||||
|
||||
# Locate Qt libraries
|
||||
set(QT_LIB_TARGETS "")
|
||||
set(_qt_candidate_roots "$ENV{HOME}/Qt/6.10.0")
|
||||
set(_qt_candidate_roots "$ENV{HOME}/Qt/6.10.3/macos")
|
||||
|
||||
foreach(_qt_root ${_qt_candidate_roots})
|
||||
if(_qt_root AND EXISTS "${_qt_root}")
|
||||
@@ -129,6 +129,13 @@ if(BUILD_MODE_DEV)
|
||||
message(STATUS "Build mode: dev (reverse engineering)")
|
||||
endif()
|
||||
|
||||
# MQTT URI patching hook (legacy, disabled by default)
|
||||
option(RMHOOK_ENABLE_MQTT "Enable MQTT URI patching hook (legacy, requires rmfakecloud mode)" OFF)
|
||||
if(RMHOOK_ENABLE_MQTT)
|
||||
target_compile_definitions(reMarkable PRIVATE RMHOOK_ENABLE_MQTT=1)
|
||||
message(STATUS "MQTT hook: enabled (legacy)")
|
||||
endif()
|
||||
|
||||
target_link_libraries(reMarkable PRIVATE
|
||||
${LIBS}
|
||||
${QT_LIB_TARGETS}
|
||||
|
||||
@@ -21,7 +21,7 @@ RMHook hooks into the reMarkable Desktop app's network layer to redirect API cal
|
||||
## Compatibility
|
||||
|
||||
**Tested and working on:**
|
||||
- reMarkable Desktop v3.28.1 (released 2026-08-24)
|
||||
- reMarkable Desktop v3.29.0 (released 2026-10-15)
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/latest.png" width="45%" />
|
||||
@@ -154,6 +154,14 @@ Examples:
|
||||
./scripts/build.sh all # Build with all modes enabled
|
||||
```
|
||||
|
||||
### Optional: Legacy MQTT hook
|
||||
|
||||
The MQTT URI patching hook (`MQTTAsync_createWithOptions`) is kept for legacy use but is **disabled by default**. To enable it, pass the CMake option when building:
|
||||
|
||||
```bash
|
||||
cmake -DRMHOOK_ENABLE_MQTT=ON ..
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
You can stream the macOS console logs to see output from the hooks:
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 245 KiB After Width: | Height: | Size: 315 KiB |
@@ -247,6 +247,7 @@ static void (*original_qWebSocket_open)(
|
||||
QWebSocket *self,
|
||||
const QNetworkRequest &request) = NULL;
|
||||
|
||||
#ifdef RMHOOK_ENABLE_MQTT
|
||||
typedef void* MQTTAsync;
|
||||
typedef void* MQTTAsync_createOptions;
|
||||
|
||||
@@ -257,6 +258,7 @@ static int (*original_MQTTAsync_createWithOptions)(
|
||||
int persistence_type,
|
||||
void *persistence_context,
|
||||
MQTTAsync_createOptions *options) = NULL;
|
||||
#endif // RMHOOK_ENABLE_MQTT
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_MODE_QMLREBUILD
|
||||
@@ -314,11 +316,13 @@ static inline bool shouldPatchURL(const QString &host) {
|
||||
originalFunction:(void **)&original_qWebSocket_open
|
||||
logPrefix:@"[reMarkable]"];
|
||||
|
||||
#ifdef RMHOOK_ENABLE_MQTT
|
||||
[MemoryUtils hookSymbol:@"libpaho-mqtt3as.1.dylib"
|
||||
symbolName:@"_MQTTAsync_createWithOptions"
|
||||
hookFunction:(void *)hooked_MQTTAsync_createWithOptions
|
||||
originalFunction:(void **)&original_MQTTAsync_createWithOptions
|
||||
logPrefix:@"[reMarkable]"];
|
||||
#endif // RMHOOK_ENABLE_MQTT
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_MODE_QMLREBUILD
|
||||
@@ -463,6 +467,7 @@ extern "C" void hooked_qWebSocket_open(
|
||||
|
||||
// Patch a paho URI: "ssl://host.remarkable.com:port" -> "ssl://proxy:port"
|
||||
// Returns patched string, or empty if no patch needed.
|
||||
#ifdef RMHOOK_ENABLE_MQTT
|
||||
static std::string PatchMqttUri(const char* uri)
|
||||
{
|
||||
if (!uri) return {};
|
||||
@@ -510,7 +515,9 @@ static std::string PatchMqttUri(const char* uri)
|
||||
}
|
||||
return patched;
|
||||
}
|
||||
#endif // RMHOOK_ENABLE_MQTT
|
||||
|
||||
#ifdef RMHOOK_ENABLE_MQTT
|
||||
extern "C" int hooked_MQTTAsync_createWithOptions(
|
||||
MQTTAsync *handle,
|
||||
const char *serverURI,
|
||||
@@ -531,6 +538,7 @@ extern "C" int hooked_MQTTAsync_createWithOptions(
|
||||
|
||||
return original_MQTTAsync_createWithOptions(handle, serverURI, clientId, persistence_type, persistence_context, options);
|
||||
}
|
||||
#endif // RMHOOK_ENABLE_MQTT
|
||||
#endif // BUILD_MODE_RMFAKECLOUD
|
||||
|
||||
#ifdef BUILD_MODE_QMLREBUILD
|
||||
|
||||
Reference in new issue
Block a user