Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Podginator/8bb19abf009673abc8eb1cf9f19afe05 to your computer and use it in GitHub Desktop.
Save Podginator/8bb19abf009673abc8eb1cf9f19afe05 to your computer and use it in GitHub Desktop.
typedef void WebResponseInflater;
typedef void WebRequester;
static void (*makeQRequest_orig)(WebRequester*, QUrl const&, QString const&, QMap<QString, QString> const&, QByteArray const&, WebResponseInflater*, int, int, QNetworkRequest::CacheLoadControl);
extern "C" __attribute__((visibility("default"))) void _intercept_network(WebRequester *_this, QUrl const& url, QString const& param, QMap<QString, QString> const& headers, QByteArray const& output, WebResponseInflater* inflater, int param1, int param2, QNetworkRequest::CacheLoadControl cl) {
nh_log("... calling original implementation");
makeQRequest_orig(_this, url, param, headers, output, inflater, param1, param2, cl);
}
static struct nh_info PocketInterceptor = (struct nh_info){
.name = "PocketInterceptor",
.desc = "Intercepts Pocket Calls and redirects tehm to Omnivore",
.uninstall_flag = "/mnt/onboard/ns_uninstall",
};
static struct nh_hook PocketIntereceptorHook[] = {
{.sym = "_ZN12WebRequester11makeRequestERK4QUrlRK7QStringRK4QMapIS3_S3_ERK10QByteArrayP19WebResponseInflateriiN15QNetworkRequest16CacheLoadControlE", .sym_new = "_intercept_network", .lib = "libnickel.so.1.0.0", .out = nh_symoutptr(makeQRequest_orig), .desc = "calls to metadata", .optional=true},
{0},
};
NickelHook(
.init = nullptr,
.info = &PocketInterceptor,
.hook = PocketIntereceptorHook,
.dlsym = nullptr
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment