Last active
April 14, 2018 16:13
-
-
Save NullDev/2eaf597a57cbaace7c0a279ec783bca1 to your computer and use it in GitHub Desktop.
Decode Syrapt0r's "my final note.txt" file by bitshifting it. See: http://code17.wikia.com
This file contains 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
"use strict"; | |
let path = require("path"); | |
let fs = require("fs"); | |
//////////////////////////////// | |
//----------------------------// | |
// Copyright (c) 2018 NullDev // | |
//----------------------------// | |
//////////////////////////////// | |
let args = process.argv.slice(2); | |
if (args.length <= 0){ | |
console.log("\nNo File!\n\Usage:\nnode decoder.js /path/to/file.txt\n"); | |
process.exit(1); | |
} | |
let filePath = path.resolve(args[0]); | |
let byteArray = function(binpath){ | |
let fileData = fs.readFileSync(binpath).toString("hex"); | |
let result = []; | |
for (var i = 0; i < fileData.length; i += 2) result.push(fileData[i] + fileData[i + 1]); | |
return result; | |
} | |
let bytes = byteArray(filePath); | |
let encoded = []; | |
let stringArr = []; | |
for (var i = 0; i < bytes.length; i++){ | |
let value = parseInt(bytes[i], 16) + 50; | |
encoded[i] = value % 256; | |
stringArr[i] = String.fromCharCode(encoded[i]); | |
} | |
let text = stringArr.join(""); | |
fs.writeFileSync(path.join(__dirname, "output.txt"), text); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment