| View previous topic :: View next topic |
| Author |
Message |
paul44 Expert Cheater
Reputation: 3
Joined: 20 Jul 2017 Posts: 214
|
Posted: Sat Jan 31, 2026 8:17 am Post subject: En/decode a Form [Solved] |
|
|
En/decode a lua script does not seem to give problems, but i have been trying to do the same with a Form.
I basically save the form to disk (so not accessible via Table~edit), and (would) load it as file:
//... (as raw file, it can be loaded this way)
local sLua = 'My_Form.frm'
oLua = findTableFile(sLua).stream
My_GUI = createFormFromStream(oLua)
...//
Above works fine, but the form - on disk - should be in encoded format. And i can not get this work - load & decode - somehow ?!
Btw: main reason to use this: the gui references (link & images) to FRF forum; and i obviously like to make sure that it stays this way...
Last edited by paul44 on Sat Feb 07, 2026 3:54 am; edited 1 time in total |
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1549
|
Posted: Mon Feb 02, 2026 9:06 am Post subject: |
|
|
Since you encrypted the form text (code), load the encrypted code into a txt file.
At runtime, decrypt the txt code, save it as a ".FRM" file somewhere on disk (like Temp), call it, run it, and delete the decrypted instance from disk.
_________________
|
|
| Back to top |
|
 |
Csimbi I post too much
Reputation: 98
Joined: 14 Jul 2007 Posts: 3356
|
Posted: Mon Feb 02, 2026 1:10 pm Post subject: |
|
|
| AylinCE wrote: | Since you encrypted the form text (code), load the encrypted code into a txt file.
At runtime, decrypt the txt code, save it as a ".FRM" file somewhere on disk (like Temp), call it, run it, and delete the decrypted instance from disk. |
I guess that defeats the point.
I assume if it need to be decrypted at all, it should be decrypted into memory.
Can't CE read encrypted data natively?
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1549
|
Posted: Tue Feb 03, 2026 12:19 am Post subject: |
|
|
If Cheat Engine doesn't have a built-in decoder for your specific encryption method, you must handle the decryption within your script logic.
However, I understand your concern about "defeating the point" by saving it to disk. If you want to avoid the disk entirely for security reasons, you should decrypt the data directly into a MemoryStream instead of a physical file.
Since createFormFromStream expects a stream object, the logic would be:
Load the encrypted file into a local variable/buffer.
Decrypt it in memory (using your custom function).
Write the decrypted string/bytes into a createMemoryStream().
Pass that memory stream to createFormFromStream(ms).
The logic remains the same: Whether it's in RAM or on Disk, the decrypted content must exist somewhere for the engine to parse it.
Also, consider this: Is your main script itself encrypted? If the main script is plain text, anyone can see your decryption function and easily reverse the process to get your FRM content anyway. To truly protect your links/images, the "loader" script itself needs to be protected/wrapped.
_________________
|
|
| Back to top |
|
 |
Csimbi I post too much
Reputation: 98
Joined: 14 Jul 2007 Posts: 3356
|
Posted: Tue Feb 03, 2026 1:04 pm Post subject: |
|
|
MemoryStream - check.
Makes sense, thanks!
|
|
| Back to top |
|
 |
paul44 Expert Cheater
Reputation: 3
Joined: 20 Jul 2017 Posts: 214
|
Posted: Thu Feb 05, 2026 11:45 am Post subject: the issue being... |
|
|
@AylinCE: "Since you encrypted the form text (code), load the encrypted code into a txt file".
=> you might have misinterpreted my rq: in fact, atm i do NOT know how to encrypt a form (using - logically (?) - CE's encode fn here) 'properly'. If there is/are another method(s), then do tell !
Iow if you know the proper steps to encode a form, and get it working using the decode fn, then that is actually what i'm looking for.
ps: the intention is to use ce v7.6 with its extended/external en/decode functionality/dll.
ps2: yep, i also follow #csimbi's logic.
=> However: if you can work out a practical example as explained in your 2nd post - following them respective steps - then that would be smashing.
(nothing fancy: just using a simple form with a button or whatever)
==> give a shout if you want me to test/prepare/explain something in more detail...
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 472
Joined: 09 May 2003 Posts: 25872 Location: The netherlands
|
Posted: Thu Feb 05, 2026 2:59 pm Post subject: |
|
|
here's an example of non destructively encrypting a tablefile (in this case a form)
| Code: |
function encodeFile(tablefilename)
local originalfile=findTableFile(tablefilename)
local encodedfile=createTableFile(tablefilename..'_encoded')
originalfile.stream.Position=0
while originalfile.stream.Position<originalfile.stream.Size do
encodedfile.stream.writeByte(originalfile.stream.readByte() + 1)
end
end
function decodeFile(tablefilename)
local originalfile=findTableFile(tablefilename)
local decodedfile=createTableFile(tablefilename..'_decoded')
originalfile.stream.Position=0
while originalfile.stream.Position<originalfile.stream.Size do
decodedfile.stream.writeByte(originalfile.stream.readByte() - 1)
end
end
encodeFile('myform')
decodeFile('myform_encoded')
f=createFormFromStream(findTableFile('myform_encoded_decoded').stream)
f.Show()
|
feel free to change it. make it more destructive, etc...
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
paul44 Expert Cheater
Reputation: 3
Joined: 20 Jul 2017 Posts: 214
|
Posted: Sat Feb 07, 2026 3:50 am Post subject: got it... |
|
|
^ "just" tested and working; really big thx for this one !
btw: i'm more of a "i have to see it to believe it"-kind_of_a_guy...
So: [ https://ibb.co/3X5sSzq ]
In practise, I see 2 things in our app:
a. only the 'encoded' form is added to the table
b. the decode fn is called in Lua_startup; ànd encoded itself
(~ we kinda have that covered)
=> atm i can not really grasp its impact on the current/existing lua coding, but surely doable (without too much hassle... me hopes)
ps: in case any is wondering what the en/decode function does: it "simply" increases the ascii_value (byte) by '1' (and decode obviously reverses it)
|
|
| Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 961
|
Posted: Wed Feb 11, 2026 5:09 pm Post subject: |
|
|
The CEForm method (A)saveToStream seems not match (B)createFormFromStream.
It said 'missing root element' when use (B) to load the stream created by (A).
But this work,
| Code: |
-- making the form stream
form.SaveToFile(afilePath) -- save to *.frm in disk, an xml file
createTableFile(tableFileName, afilePath) -- create tableFile with the *.frm
-- load the form from stream
local tf = findTableFile(tableFileName)
local ff = createFormFromStream(tf.Stream)
ff.Show()
|
It seems not right, as the form is already encoded as ascii85 in the *.frm,
loading it into a tableFile will encode ascii85 one more time (?).
bye
_________________
- Retarded. |
|
| Back to top |
|
 |
|