mirror of
https://github.com/NohamR/RMHook.git
synced 2026-11-25 23:06:39 +00:00
Compare commits
7
Commits
bde78170be
...
v1.3.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85daf2902a | ||
|
|
0c4c72be2f | ||
|
|
93b011807c | ||
|
|
e00ab1d5ed | ||
|
|
a74031f228 | ||
|
|
9089839f9b | ||
|
|
8f95c65ba9 |
No files matched your search
@@ -2,3 +2,7 @@ build/
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
/.vscode
|
/.vscode
|
||||||
/research
|
/research
|
||||||
|
/aqt_venv
|
||||||
|
/CMakeFiles
|
||||||
|
/.qt
|
||||||
|
Makefile
|
||||||
+8
-1
@@ -49,7 +49,7 @@ set(LIBS
|
|||||||
|
|
||||||
# Locate Qt libraries
|
# Locate Qt libraries
|
||||||
set(QT_LIB_TARGETS "")
|
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})
|
foreach(_qt_root ${_qt_candidate_roots})
|
||||||
if(_qt_root AND EXISTS "${_qt_root}")
|
if(_qt_root AND EXISTS "${_qt_root}")
|
||||||
@@ -129,6 +129,13 @@ if(BUILD_MODE_DEV)
|
|||||||
message(STATUS "Build mode: dev (reverse engineering)")
|
message(STATUS "Build mode: dev (reverse engineering)")
|
||||||
endif()
|
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
|
target_link_libraries(reMarkable PRIVATE
|
||||||
${LIBS}
|
${LIBS}
|
||||||
${QT_LIB_TARGETS}
|
${QT_LIB_TARGETS}
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ A dynamic library injection tool for the reMarkable Desktop macOS application, e
|
|||||||
|
|
||||||
RMHook hooks into the reMarkable Desktop app's network layer to redirect API calls from reMarkable's official cloud services to your own [rmfakecloud](https://github.com/ddvk/rmfakecloud) server. This allows you to maintain full control over your documents and data.
|
RMHook hooks into the reMarkable Desktop app's network layer to redirect API calls from reMarkable's official cloud services to your own [rmfakecloud](https://github.com/ddvk/rmfakecloud) server. This allows you to maintain full control over your documents and data.
|
||||||
|
|
||||||
### Windows Port
|
## Other platforms
|
||||||
|
|
||||||
Looking for a Windows version? Check out **[RMHook-Win](https://github.com/NohamR/RMHook-Win)**: A Windows port of RMHook for the reMarkable Desktop application.
|
- **[RMHook-Win](https://github.com/NohamR/RMHook-Win)**: Windows Desktop
|
||||||
|
- **[RMHook-iOS](https://github.com/NohamR/RMHook-iOS)**: iOS
|
||||||
|
- **[RMHook-Android](https://github.com/NohamR/RMHook-Android)**: Android
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -19,11 +21,11 @@ Looking for a Windows version? Check out **[RMHook-Win](https://github.com/Noham
|
|||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
**Tested and working on:**
|
**Tested and working on:**
|
||||||
- reMarkable Desktop v3.27.1 (released 2026-06-07)
|
- reMarkable Desktop v3.29.0 (released 2026-10-15)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="docs/latest.png" width="40%" />
|
<img src="docs/latest.png" width="45%" />
|
||||||
<img src="docs/rm.png" width="50%" />
|
<img src="docs/rm.png" width="45%" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Installation and usage
|
## Installation and usage
|
||||||
@@ -114,47 +116,6 @@ The config file (`~/Library/Preferences/rmfakecloud.config`) supports the follow
|
|||||||
|
|
||||||
If the config file doesn't exist, it will be created automatically with default values on first launch.
|
If the config file doesn't exist, it will be created automatically with default values on first launch.
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### App won't launch
|
|
||||||
- Ensure the code signature was properly applied
|
|
||||||
- Check that `xattr -cr` was run to clear quarantine attributes
|
|
||||||
- Verify the dylib is in `Contents/Resources/` folder
|
|
||||||
|
|
||||||
### Document sync issues
|
|
||||||
- Ensure your rmfakecloud server is running and accessible
|
|
||||||
- Verify the storage path migration was completed
|
|
||||||
|
|
||||||
## How it works
|
|
||||||
RMHook uses [tinyhook](https://github.com/Antibioticss/tinyhook/) to hook into Qt framework functions at runtime:
|
|
||||||
1. **QNetworkAccessManager::createRequest** - Intercepts HTTP/HTTPS requests
|
|
||||||
2. **QWebSocket::open** - Patches WebSocket connections
|
|
||||||
3. **MQTTAsync_createWithOptions** - Modifies MQTT URIs for screen sharing features
|
|
||||||
|
|
||||||
When the app attempts to connect to reMarkable's servers (e.g., `internal.cloud.remarkable.com`), the hooks redirect these requests to your configured host and port.
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
- xovi-rmfakecloud: [asivery/xovi-rmfakecloud](https://github.com/asivery/xovi-rmfakecloud) - Original hooking information
|
|
||||||
- rm-xovi-extensions: [asivery/rm-xovi-extensions](https://github.com/asivery/rm-xovi-extensions) - Extension framework for reMarkable, used as reference for hooking Qt functions
|
|
||||||
- [qt-resource-rebuilder](https://github.com/asivery/rm-xovi-extensions/tree/master/qt-resource-rebuilder)
|
|
||||||
- [xovi-message-broker](https://github.com/asivery/rm-xovi-extensions/tree/master/xovi-message-broker)
|
|
||||||
- tinyhook: [Antibioticss/tinyhook](https://github.com/Antibioticss/tinyhook/) - Function hooking framework
|
|
||||||
- rmfakecloud: [ddvk/rmfakecloud](https://github.com/ddvk/rmfakecloud) - Self-hosted reMarkable cloud
|
|
||||||
- optool: [alexzielenski/optool](https://github.com/alexzielenski/optool) - Mach-O binary modification tool
|
|
||||||
- zstd: [facebook/zstd](https://github.com/facebook/zstd) - Compression library
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
||||||
|
|
||||||
## Disclaimer
|
|
||||||
|
|
||||||
This project is not affiliated with, endorsed by, or sponsored by reMarkable AS. Use at your own risk. This tool modifies the reMarkable Desktop application and may violate the application's terms of service.
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Contributions are welcome! Please feel free to submit issues or pull requests.
|
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
1. **Clone the repository:**
|
1. **Clone the repository:**
|
||||||
@@ -192,3 +153,60 @@ Examples:
|
|||||||
./scripts/build.sh dev # Build with dev/reverse engineering hooks
|
./scripts/build.sh dev # Build with dev/reverse engineering hooks
|
||||||
./scripts/build.sh all # Build with all modes enabled
|
./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:
|
||||||
|
```bash
|
||||||
|
log stream --predicate 'process == "reMarkable"' --level debug
|
||||||
|
```
|
||||||
|
|
||||||
|
## How it works
|
||||||
|
|
||||||
|
RMHook uses [tinyhook](https://github.com/Antibioticss/tinyhook/) to hook into Qt framework functions at runtime:
|
||||||
|
1. **QNetworkAccessManager::createRequest** - Intercepts HTTP/HTTPS requests
|
||||||
|
2. **QWebSocket::open** - Patches WebSocket connections
|
||||||
|
3. **MQTTAsync_createWithOptions** - Modifies MQTT URIs for screen sharing features
|
||||||
|
|
||||||
|
When the app attempts to connect to reMarkable's servers (e.g., `internal.cloud.remarkable.com`), the hooks redirect these requests to your configured host and port.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### App won't launch
|
||||||
|
- Ensure the code signature was properly applied
|
||||||
|
- Check that `xattr -cr` was run to clear quarantine attributes
|
||||||
|
- Verify the dylib is in `Contents/Resources/` folder
|
||||||
|
|
||||||
|
### Document sync issues
|
||||||
|
- Ensure your rmfakecloud server is running and accessible
|
||||||
|
- Verify the storage path migration was completed
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
- xovi-rmfakecloud: [asivery/xovi-rmfakecloud](https://github.com/asivery/xovi-rmfakecloud) - Original hooking information
|
||||||
|
- rm-xovi-extensions: [asivery/rm-xovi-extensions](https://github.com/asivery/rm-xovi-extensions) - Extension framework for reMarkable, used as reference for hooking Qt functions
|
||||||
|
- [qt-resource-rebuilder](https://github.com/asivery/rm-xovi-extensions/tree/master/qt-resource-rebuilder)
|
||||||
|
- [xovi-message-broker](https://github.com/asivery/rm-xovi-extensions/tree/master/xovi-message-broker)
|
||||||
|
- tinyhook: [Antibioticss/tinyhook](https://github.com/Antibioticss/tinyhook/) - Function hooking framework
|
||||||
|
- rmfakecloud: [ddvk/rmfakecloud](https://github.com/ddvk/rmfakecloud) - Self-hosted reMarkable cloud
|
||||||
|
- optool: [alexzielenski/optool](https://github.com/alexzielenski/optool) - Mach-O binary modification tool
|
||||||
|
- zstd: [facebook/zstd](https://github.com/facebook/zstd) - Compression library
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
||||||
|
|
||||||
|
## Disclaimer
|
||||||
|
|
||||||
|
This project is not affiliated with, endorsed by, or sponsored by reMarkable AS. Use at your own risk. This tool modifies the reMarkable Desktop application and may violate the application's terms of service.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions are welcome! Please feel free to submit issues or pull requests.
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 234 KiB After Width: | Height: | Size: 315 KiB |
@@ -247,6 +247,7 @@ static void (*original_qWebSocket_open)(
|
|||||||
QWebSocket *self,
|
QWebSocket *self,
|
||||||
const QNetworkRequest &request) = NULL;
|
const QNetworkRequest &request) = NULL;
|
||||||
|
|
||||||
|
#ifdef RMHOOK_ENABLE_MQTT
|
||||||
typedef void* MQTTAsync;
|
typedef void* MQTTAsync;
|
||||||
typedef void* MQTTAsync_createOptions;
|
typedef void* MQTTAsync_createOptions;
|
||||||
|
|
||||||
@@ -257,6 +258,7 @@ static int (*original_MQTTAsync_createWithOptions)(
|
|||||||
int persistence_type,
|
int persistence_type,
|
||||||
void *persistence_context,
|
void *persistence_context,
|
||||||
MQTTAsync_createOptions *options) = NULL;
|
MQTTAsync_createOptions *options) = NULL;
|
||||||
|
#endif // RMHOOK_ENABLE_MQTT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BUILD_MODE_QMLREBUILD
|
#ifdef BUILD_MODE_QMLREBUILD
|
||||||
@@ -314,11 +316,13 @@ static inline bool shouldPatchURL(const QString &host) {
|
|||||||
originalFunction:(void **)&original_qWebSocket_open
|
originalFunction:(void **)&original_qWebSocket_open
|
||||||
logPrefix:@"[reMarkable]"];
|
logPrefix:@"[reMarkable]"];
|
||||||
|
|
||||||
|
#ifdef RMHOOK_ENABLE_MQTT
|
||||||
[MemoryUtils hookSymbol:@"libpaho-mqtt3as.1.dylib"
|
[MemoryUtils hookSymbol:@"libpaho-mqtt3as.1.dylib"
|
||||||
symbolName:@"_MQTTAsync_createWithOptions"
|
symbolName:@"_MQTTAsync_createWithOptions"
|
||||||
hookFunction:(void *)hooked_MQTTAsync_createWithOptions
|
hookFunction:(void *)hooked_MQTTAsync_createWithOptions
|
||||||
originalFunction:(void **)&original_MQTTAsync_createWithOptions
|
originalFunction:(void **)&original_MQTTAsync_createWithOptions
|
||||||
logPrefix:@"[reMarkable]"];
|
logPrefix:@"[reMarkable]"];
|
||||||
|
#endif // RMHOOK_ENABLE_MQTT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BUILD_MODE_QMLREBUILD
|
#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"
|
// Patch a paho URI: "ssl://host.remarkable.com:port" -> "ssl://proxy:port"
|
||||||
// Returns patched string, or empty if no patch needed.
|
// Returns patched string, or empty if no patch needed.
|
||||||
|
#ifdef RMHOOK_ENABLE_MQTT
|
||||||
static std::string PatchMqttUri(const char* uri)
|
static std::string PatchMqttUri(const char* uri)
|
||||||
{
|
{
|
||||||
if (!uri) return {};
|
if (!uri) return {};
|
||||||
@@ -510,7 +515,9 @@ static std::string PatchMqttUri(const char* uri)
|
|||||||
}
|
}
|
||||||
return patched;
|
return patched;
|
||||||
}
|
}
|
||||||
|
#endif // RMHOOK_ENABLE_MQTT
|
||||||
|
|
||||||
|
#ifdef RMHOOK_ENABLE_MQTT
|
||||||
extern "C" int hooked_MQTTAsync_createWithOptions(
|
extern "C" int hooked_MQTTAsync_createWithOptions(
|
||||||
MQTTAsync *handle,
|
MQTTAsync *handle,
|
||||||
const char *serverURI,
|
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);
|
return original_MQTTAsync_createWithOptions(handle, serverURI, clientId, persistence_type, persistence_context, options);
|
||||||
}
|
}
|
||||||
|
#endif // RMHOOK_ENABLE_MQTT
|
||||||
#endif // BUILD_MODE_RMFAKECLOUD
|
#endif // BUILD_MODE_RMFAKECLOUD
|
||||||
|
|
||||||
#ifdef BUILD_MODE_QMLREBUILD
|
#ifdef BUILD_MODE_QMLREBUILD
|
||||||
|
|||||||
Reference in new issue
Block a user