Dope88 Posted January 5, 2020 Share Posted January 5, 2020 Hello im searching for a good compiler Script. I would also pay for it Link to comment
XaskeL Posted January 5, 2020 Share Posted January 5, 2020 (edited) Example: function string_padding_dword(s) local l = 4 - string.len(s) % 4 return s .. string.rep(string.char(l), l) end function string_unpadding_dword(s) return string.sub(s, 0, string.len(s) - string.byte(s, string.len(s))) end function FileProtection(path, key) local file = fileOpen(path) local size = fileGetSize(file) local FirstPart = fileRead(file, 65536) fileSetPos(file, 65536) local SecondPart = fileRead(file, size - 65536) fileClose(file) file = fileCreate(path..'rw') fileWrite(file, encodeString('tea', string_padding_dword(FirstPart), { key = key })..SecondPart) fileClose(file) return true end function FileUnProtection(path, key) local file = fileOpen(path) local size = fileGetSize(file) local FirstPart = fileRead(file, 65536 + 4) fileSetPos(file, 65536 + 4) local SecondPart = fileRead(file, size - (65536 + 4)) fileClose(file) -- file = fileCreate(path..'rw') -- fileWrite(file, string_padding_dword( decodeString('tea', FirstPart, { key = key }) )..SecondPart) -- fileClose(file) return string_padding_dword( decodeString('tea', FirstPart, { key = key }) )..SecondPart end -- example FileProtection('infernus.dff', 'GT4BAE') -- FileUnProtection(path, key) local txd = engineLoadTXD('infernus.txd') engineImportTXD(txd, 401) local dff = engineLoadDFF( FileUnProtection('infernus.dff', 'GT4BAE') ) engineReplaceModel(dff, 401) Edited January 5, 2020 by XaskeL 3 Link to comment
Dope88 Posted January 5, 2020 Author Share Posted January 5, 2020 1 hour ago, XaskeL said: Example: function string_padding_dword(s) local l = 4 - string.len(s) % 4 return s .. string.rep(string.char(l), l) end function string_unpadding_dword(s) return string.sub(s, 0, string.len(s) - string.byte(s, string.len(s))) end function FileProtection(path, key) local file = fileOpen(path) local size = fileGetSize(file) local FirstPart = fileRead(file, 65536) fileSetPos(file, 65536) local SecondPart = fileRead(file, size - 65536) fileClose(file) file = fileCreate(path..'rw') fileWrite(file, encodeString('tea', string_padding_dword(FirstPart), { key = key })..SecondPart) fileClose(file) return true end function FileUnProtection(path, key) local file = fileOpen(path) local size = fileGetSize(file) local FirstPart = fileRead(file, 65536 + 4) fileSetPos(file, 65536 + 4) local SecondPart = fileRead(file, size - (65536 + 4)) fileClose(file) -- file = fileCreate(path..'rw') -- fileWrite(file, string_padding_dword( decodeString('tea', FirstPart, { key = key }) )..SecondPart) -- fileClose(file) return string_padding_dword( decodeString('tea', FirstPart, { key = key }) )..SecondPart end -- example FileProtection('infernus.dff', 'GT4BAE') -- FileUnProtection(path, key) local txd = engineLoadTXD('infernus.txd') engineImportTXD(txd, 401) local dff = engineLoadDFF( FileUnProtection('infernus.dff', 'GT4BAE') ) engineReplaceModel(dff, 401) Thank you very much Do I just have to change infernus.dff and infernus.txd to my files? and what do I have to do with the key? (GT4BAE) Link to comment
XaskeL Posted January 5, 2020 Share Posted January 5, 2020 8 minutes ago, Dope88 said: Thank you very much Do I just have to change infernus.dff and infernus.txd to my files? and what do I have to do with the key? (GT4BAE) It is worth testing. And the key is what you encrypt your file and decrypt, it is advisable to come up with it yourself. After that, you need to encrypt the models and in the client-side decrypt in RAW and load. 1 Link to comment
Dope88 Posted January 6, 2020 Author Share Posted January 6, 2020 10 minutes ago, XaskeL said: It is worth testing. And the key is what you encrypt your file and decrypt, it is advisable to come up with it yourself. After that, you need to encrypt the models and in the client-side decrypt in RAW and load. Thank you I made all in Client File but now I get Errors in line 49: Corrupt DFF File data or file path too long Link to comment
XaskeL Posted January 9, 2020 Share Posted January 9, 2020 10 hours ago, Dope88 said: Do you know why? Completely finished code, as well as an example of use inside. Also, a resource is ready to download protected files (loader). Link: https://www.dropbox.com/s/0cpkkuwjdqa6nvt/protection dff %26 txd files example.rar?dl=0 1 Link to comment
Dope88 Posted January 10, 2020 Author Share Posted January 10, 2020 On 09/01/2020 at 03:52, XaskeL said: Completely finished code, as well as an example of use inside. Also, a resource is ready to download protected files (loader). Link: https://www.dropbox.com/s/0cpkkuwjdqa6nvt/protection dff %26 txd files example.rar?dl=0 Works perfect Thank you Link to comment
mucuk6547 Posted February 17, 2020 Share Posted February 17, 2020 On 09/01/2020 at 05:52, XaskeL said: Completely finished code, as well as an example of use inside. Also, a resource is ready to download protected files (loader). Link: https://www.dropbox.com/s/0cpkkuwjdqa6nvt/protection dff %26 txd files example.rar?dl=0 Hello, does the Decode 21 locking system you still have? Link to comment
Maark Posted March 11, 2020 Share Posted March 11, 2020 On 08/01/2020 at 23:52, XaskeL said: Completely finished code, as well as an example of use inside. Also, a resource is ready to download protected files (loader). Link: https://www.dropbox.com/s/0cpkkuwjdqa6nvt/protection dff %26 txd files example.rar?dl=0 this save in a variable a lot of MB, i can clear it and still working the dff? u know? Link to comment
XaskeL Posted March 11, 2020 Share Posted March 11, 2020 7 hours ago, Maark said: this save in a variable a lot of MB, i can clear it and still working the dff? u know? Yes Link to comment
Maark Posted March 11, 2020 Share Posted March 11, 2020 (edited) 12 hours ago, XaskeL said: Yes how i can do that? i trying right now but its not working :X Edited March 11, 2020 by Maark Link to comment
XaskeL Posted March 12, 2020 Share Posted March 12, 2020 7 hours ago, Maark said: how i can do that? i trying right now but its not working :X You must remove all references to the buffer variable and call "collectgarbage ()" after replacing the model, thereby freeing memory from unused data in the variables 1 Link to comment
Maark Posted March 12, 2020 Share Posted March 12, 2020 (edited) 12 hours ago, XaskeL said: You must remove all references to the buffer variable and call "collectgarbage ()" after replacing the model, thereby freeing memory from unused data in the variables im trying to do like this local string = nil function FileUnProtection(path, key, clear) print("loaded") local file = fileOpen(path) local size = fileGetSize(file) local FirstPart = fileRead(file, 65536 + 4) fileSetPos(file, 65536 + 4) local SecondPart = fileRead(file, size - (65536 + 4)) fileClose(file) if file ~= nil then file = nil end if size ~= nil then size = nil end return decodeString('tea', FirstPart, { key = key })..SecondPart end function FileUnProtection2(path, key, clear) if path and key and clear == nil then print("loading") local returnDATA = FileUnProtection(path, key, nil) return returnDATA elseif clear then print("clearing") print(returnDATA) -- prints nil ._. if returnDATA ~= nil then returnDATA = nil print("cleared") end if file ~= nil then file = nil end if size ~= nil then size = nil end if FirstPart ~= nil then FirstPart = nil end if SecondPart ~= nil then SecondPart = nil end end end local string1 = FileUnProtection2('549.txdcw', 'password', nil) local txd = engineLoadTXD(string1) engineImportTXD(txd, 549) local string1 = nil local string2 = FileUnProtection2('549.dffcw', 'password', nil) local dff = engineLoadDFF(string2) engineReplaceModel(dff, 549) local string2 = nil FileUnProtection2(nil, nil, true) but in ipb still in Lua Memory Edited March 12, 2020 by Maark Link to comment
Moderators Patrick Posted March 12, 2020 Moderators Share Posted March 12, 2020 12 minutes ago, Maark said: im trying to do like this but in ipb still in Lua Memory Set txd and dff to nil too after replace. 1 Link to comment
Maark Posted March 12, 2020 Share Posted March 12, 2020 8 minutes ago, Patrick said: Set txd and dff to nil too after replace. nothing happened =/ Link to comment
The_GTA Posted March 12, 2020 Share Posted March 12, 2020 1 hour ago, Maark said: im trying to do like this local string1 = FileUnProtection2('549.txdcw', 'password', nil) local txd = engineLoadTXD(string1) engineImportTXD(txd, 549) local string1 = nil local string2 = FileUnProtection2('549.dffcw', 'password', nil) local dff = engineLoadDFF(string2) engineReplaceModel(dff, 549) local string2 = nil FileUnProtection2(nil, nil, true) but in ipb still in Lua Memory Oh god. Let me help you seeing that you are not completely familiar with the "local" keyword in Lua. If you create a local variable in Lua then it overshadows any previous local variable definition without modifying variables with same names. Thus from the Lua compiler's perspective local var1 = 1; local var1 = 2; There are two different variables with the same name but you can only access the last variable in subsequent code (the first one remains silently on the Lua stack). THUS, to fix your code, replace line 37 local string1 = nil with string1 = nil Please repair line 42 in the same way. - Martin Link to comment
Maark Posted March 12, 2020 Share Posted March 12, 2020 15 minutes ago, The_GTA said: Oh god. Let me help you seeing that you are not completely familiar with the "local" keyword in Lua. If you create a local variable in Lua then it overshadows any previous local variable definition without modifying variables with same names. Thus from the Lua compiler's perspective local var1 = 1; local var1 = 2; There are two different variables with the same name but you can only access the last variable in subsequent code (the first one remains silently on the Lua stack). THUS, to fix your code, replace line 37 local string1 = nil with string1 = nil Please repair line 42 in the same way. - Martin Ty, but still 36403KB in memory =/ Link to comment
The_GTA Posted March 12, 2020 Share Posted March 12, 2020 2 minutes ago, Maark said: Ty, but still 36403KB in memory =/ Are you calling the function "collectgarbage" as XaskeL has suggested? I am not seeing it in your code that you posted above. 1 Link to comment
Maark Posted March 12, 2020 Share Posted March 12, 2020 55 minutes ago, The_GTA said: Are you calling the function "collectgarbage" as XaskeL has suggested? I am not seeing it in your code that you posted above. No, i dont know about this function, i put in the code and now is 2451 KB in memory @edit, i put 6 times and now is 212KB, thats nice (i see in stackoverflow we need use 2 times do destroy) Link to comment
sancak_doge Posted March 31, 2020 Share Posted March 31, 2020 How can I run this locking, can you help? Link to comment
mucuk6547 Posted March 31, 2020 Share Posted March 31, 2020 On 12/03/2020 at 21:18, The_GTA said: Are you calling the function "collectgarbage" as XaskeL has suggested? I am not seeing it in your code that you posted above. car dff size 24 mb txd 113 mb I am doing it for trial purposes but it does not appear in the game. Link to comment
FernandoMTA Posted March 20, 2023 Share Posted March 20, 2023 https://forum.multitheftauto.com/topic/134836-rel-nandocrypt-file-encryption-resource/ Link to comment
TMTMTL Posted March 20, 2023 Share Posted March 20, 2023 15 minutes ago, FernandoMTA said: https://forum.multitheftauto.com/topic/134836-rel-nandocrypt-file-encryption-resource/ Highly recommend the use of NandoCrypt Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now