1
0
Fork 0

mvp: wonky but working selenium firefox version

This commit is contained in:
Arthur K. 2026-03-07 20:18:02 +03:00
parent 061eefdb24
commit a3c843d63c
Signed by: wzray
GPG key ID: B97F30FDC4636357
20 changed files with 738 additions and 407 deletions

View file

@ -0,0 +1,26 @@
(function() {
var code = '(' + function() {
// Remove Selenium artifacts (except webdriver - handled by binary patch)
var toDelete = ['cdc_', '$cdc_', 'wd_', 'selenium', '__webdriver_script_fn', '__driver_evaluate', '__webdriver_evaluate', '__selenium_evaluate', '__fxdriver_evaluate', '__driver_unwrapped', '__webdriver_unwrapped', '__selenium_unwrapped', '__fxdriver_unwrapped', '__webdriver_script_function', '__webdriver_script_func', '__webdriver_script_fn', '__fxdriver_athena_', '_Selenium_IDE_Recorder', '_selenium', 'calledSelenium', '$cdc_asdjflasutopfhvcZLmcfl_', '$chrome_asyncScriptInfo', '__$webdriverAsyncExecutor', '__nightmare', '_phantom', 'callPhantom', '__lastWatirAlert', '__lastWatirConfirm', '__lastWatirPrompt'];
toDelete.forEach(function(key) {
if (window[key]) delete window[key];
if (document[key]) delete document[key];
});
// Clean up document properties
for (var key in document) {
if (key.match(/\$[a-z]dc_/) && document[key]) {
delete document[key];
}
}
} + ')();';
var script = document.createElement('script');
script.textContent = code;
var target = document.documentElement;
if (target) {
target.insertBefore(script, target.firstChild);
script.remove();
}
})();

View file

@ -0,0 +1,14 @@
{
"manifest_version": 2,
"name": "Dark Reader",
"version": "1.0",
"permissions": ["<all_urls>"],
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["dark-reader.js"],
"run_at": "document_start",
"all_frames": true
}
]
}

9
extras/patch_firefox.py Normal file
View file

@ -0,0 +1,9 @@
with open("/usr/lib/firefox-esr/libxul.so", "rb") as f:
data = bytearray(f.read())
patch = bytes([0x31, 0xC0, 0xC3])
offset = 0x443CAD0
data[offset : offset + len(patch)] = patch
with open("/usr/lib/firefox-esr/libxul.so", "wb") as f:
f.write(data)