forked from koekeishiya/yabai
-
Notifications
You must be signed in to change notification settings - Fork 3
/
install-yabai-sa.js
22 lines (18 loc) · 907 Bytes
/
install-yabai-sa.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function loadYabaiSA(sa_path) {
var RTLD_NOW = 0x02;
var _dlopen = new NativeFunction(Module.findExportByName(null, "dlopen"), 'pointer', ['pointer', 'int']);
var path = Memory.allocUtf8String(sa_path);
var handle = _dlopen(path, RTLD_NOW);
if (handle.isNull()) {
console.error("[e] failed to load scripting addition payload");
return
}
// some debug to make sure things are working
var _image_slide = new NativeFunction(Module.findExportByName(sa_path, "image_slide"), 'uint64', []);
var _static_base_addr = new NativeFunction(Module.findExportByName(sa_path, "static_base_address"), 'uint64', []);
console.log("[i] image_slide: ", _image_slide().toString(16));
console.log("[i] static_base_addr: ", _static_base_addr().toString(16));
}
// path to scripting additions payload (compiled for arm64e(!))
var sa_path = "/path/to/yabai/src/osax/payload";
loadYabaiSA(sa_path);