Created
May 7, 2013 04:10
-
-
Save rcombs/5530201 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env node | |
var fs = require("fs"); | |
var argv = process.argv; | |
// 4556454e54484f52495a4f4e | |
// 0617071EE10C9F5B | |
var key1 = new Buffer("FFD8FFE000104A464946004556454E54", "hex"); | |
var key2str; | |
var key2str_1 = key2str = "HORIZON EVENT"; | |
var key2 = new Buffer(key2str); | |
//var key4 = new Buffer("480617071EE10C9F5B0000000000", "hex"); | |
var key4 = new Buffer("480617071EE10C9F5B0000000000", "hex"); | |
var key = Buffer.concat([key1, key2]); | |
//var key = new Buffer("ENT HORIZONEV"); | |
var shift = 0; | |
var data = (argv[2] && new Buffer(argv[2].replace(/[^0-9a-f]/gi, ""), "hex")) || fs.readFileSync("masked_key.png"); | |
//var data = new Buffer("4F52495A4F4EFFD9", "hex"); | |
//var key = new Buffer("49454E44AE426082", "hex"); | |
var newData = new Buffer(data.length); | |
while((key.length <= 50)){ | |
key = Buffer.concat([key, (new Buffer(key2str_1))]); | |
} | |
/* | |
while(key.length % 8 != 0){ | |
key = Buffer.concat([key, (new Buffer([0]))]); | |
} | |
*/ | |
key = new Buffer("ffd8ffe000104a464946004556454e54484f52495a4f4e204556454e54484f52495a4f4e204556454e54484f52495a4f4e204556454e54484F52495A4F4EFFD9", "hex"); | |
//484F52495A4F4EFFD9 | |
//key = key.slice(0, 58); | |
while(newData[0xEFFF8] != 0x49){ | |
for(var i = 0; i < data.length; i++){ | |
newData[i] = data[i] ^ key[i % key.length]; | |
} | |
break; | |
if(argv[2]){ | |
break; | |
} | |
} | |
console.log(key.length.toString(10)); | |
console.log(key.toString("hex")); | |
if(argv[2]){ | |
console.log(newData); | |
console.log(newData.toString("hex").toUpperCase()); | |
console.log(encodeURIComponent(newData.toString())); | |
}else{ | |
fs.writeFileSync("out.png", newData); | |
} | |
//console.log(newData.toString("hex").toUpperCase()); | |
//4F 52 49 5A 4F 4E FF D9 | |
//49 45 4E 44 AE 42 60 82 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env node | |
var pngparse = require("pngparse"); | |
var argv = process.argv; | |
// 4556454e54484f52495a4f4e | |
// 0617071EE10C9F5B | |
/* | |
var key1 = new Buffer("FFD8FFE000104A464946004556454E54", "hex"); | |
var key2str; | |
var key2str_1 = key2str = "HORIZON EVENT"; | |
var key2 = new Buffer(key2str); | |
var key4 = new Buffer("480617071EE10C9F5B", "hex"); | |
var key = (argv[3] && new Buffer(argv[3].replace(/[^0-9a-f]/gi, ""), "hex")) || Buffer.concat([key1, key2, key4]); | |
var shift = 0; | |
*/ | |
//var data = (argv[2] && new Buffer(argv[2].replace(/[^0-9a-f]/gi, ""), "hex")) || fs.readFileSync("steg.png"); | |
//var data = new Buffer("4F52495A4F4EFFD9", "hex"); | |
//var key = new Buffer("49454E44AE426082", "hex"); | |
var newData = new Buffer(200); | |
newData.fill(0); | |
pngparse.parseFile("steg.png", function(err, file){ | |
var data = file.data; | |
var i2 = 0; | |
for(var i = 0; i < newData.length * 8; i++){ | |
if((i+1) % 4){ | |
newData[(i2 / 8) >>> 0] |= (data[i] & 1) << (7 - (i2 % 8)); | |
i2++ | |
} | |
} | |
console.log(newData); | |
console.log(newData.toString("hex").toUpperCase()); | |
console.log(escape(newData.toString())); | |
}); | |
//console.log(newData.toString("hex").toUpperCase()); | |
//4F 52 49 5A 4F 4E FF D9 | |
//49 45 4E 44 AE 42 60 82 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment