Skip to content

Instantly share code, notes, and snippets.

@kiding
Last active January 28, 2019 02:41
Show Gist options
  • Save kiding/36cfbbe6ab35ab93b5fdbd67a9fa3aba to your computer and use it in GitHub Desktop.
Save kiding/36cfbbe6ab35ab93b5fdbd67a9fa3aba to your computer and use it in GitHub Desktop.
KakaoTalk+: No More Search Pane (macOS)
/*
Hide the annoying search pane.
$ sudo node KakaoTalk+.js
$ nohup /Applications/KakaoTalk.app/Contents/MacOS/KakaoTalk+ </dev/null >/dev/null 2>&1
*/
const { readFileSync, writeFileSync } = require('fs'),
{ execSync } = require('child_process'),
{ ok } = require('assert');
const target = 'showSearchPane',
input = `/Applications/KakaoTalk.app/Contents/MacOS/KakaoTalk`,
output = `/Applications/KakaoTalk.app/Contents/MacOS/KakaoTalk+`;
const dump = execSync(`objdump -macho -objc-meta-data ${input}`).toString() || '',
[, addr] = dump.match(new RegExp(`${target}\\n.+?imp\\s+(0x[0-9a-f]+)`, 'su')) || [, NaN];
ok(!isNaN(addr), `Failed to find the method ${target}`);
console.log(`Found ${target} at ${addr}`);
const binary = readFileSync(input);
binary[addr - 0x100000000] = 0xC3; // ret
for (let i=1; i<16; i++) {
binary[addr - 0x100000000 + i] = 0x90; // nop
}
writeFileSync(output, binary, { mode : 0o755 });
console.log(`Saved ${output}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment