Skip to content

Instantly share code, notes, and snippets.

@twilson90
Created August 11, 2022 20:18
Show Gist options
  • Save twilson90/4e41635444e274b876d6bb2078d791b7 to your computer and use it in GitHub Desktop.
Save twilson90/4e41635444e274b876d6bb2078d791b7 to your computer and use it in GitHub Desktop.
var fs = require("fs-extra");
function make_title_buffer(s) {
return Buffer.from(s.split("").join("\0"));
}
var flash_player_version = 18;
var orig_title = `Adobe Flash Player ${flash_player_version}`
var orig_title_buffer = make_title_buffer(orig_title);
var new_title = "Wasted Youth, Part 1";
var new_title_buffer = make_title_buffer(new_title.slice(0, orig_title.length));
(async()=>{
var buffers = [];
var fp = await fs.readFile("flashplayer_18_sa2.exe");
var i = 0;
while (true) {
i = fp.indexOf(orig_title_buffer, i);
if (i == -1) break;
fp.fill(0, i, i + orig_title_buffer.length)
new_title_buffer.copy(fp, i)
i += orig_title_buffer.length;
}
buffers.push(fp);
var swf = await fs.readFile("wrapper.swf");
buffers.push(swf);
var end = [0x56, 0x34, 0x12, 0xFA];
var sizeTemp = swf.length;
while (sizeTemp>0) {
end.push(sizeTemp % 0x100);
sizeTemp = Math.floor(sizeTemp / 0x100);
}
while (end.length<8) {
end.push(0x00);
}
buffers.push(Buffer.from(end));
var data = Buffer.concat(buffers);
await fs.writeFile(`${new_title}.exe`, data);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment