Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- verze = "23.0401.R1"
- local desifra = {}
- local i = 1
- local function decrypt(text, key)
- local result = ""
- for i = 1, #text do
- local byte = text:byte(i)
- local key_byte = key:byte((i - 1) % #key + 1)
- result = result .. string.char(bit.bxor(byte, key_byte))
- end
- return result
- end
- function readEncryptedFile(file, key, radek)
- if not fs.exists(file) then
- error("File not found!")
- end
- if fs.isDir(file) then
- error("Cannot read directories!")
- end
- local encryptedData = false
- if file:sub(-4) == ".pcr" then
- local inputFile = fs.open(file, "rb")
- encryptedData = inputFile.readAll()
- inputFile.close()
- encryptedData = decrypt(encryptedData, key)
- end
- if not encryptedData then
- error("File is not encrypted!")
- end
- for line in encryptedData:gmatch("[^\r\n]+") do
- desifra[i] = line
- i = i + 1
- end
- if (radek) then
- return desifra[radek]
- else
- return encryptedData
- end
- end
- --print(readEncryptedFile("/C/system/Users/Administrator/.data.pcr", "0", 2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement