Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


About the drm and encode functions

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Flux.
Advanced Cheater
Reputation: 0

Joined: 10 Nov 2016
Posts: 88
Location: Another World - N5X2 106311411+2123518

PostPosted: Fri Apr 19, 2019 11:01 am    Post subject: About the drm and encode functions Reply with quote

Looking for some help on the drm and encode functions.

So prepped a small table and saved it as a CT file, then opened it as a lua script.

do i just paste this at the top of the script, and save as a trainer to add drm to the table, or do i need to do something more -
Code:
enableDRM()
z=getHandleList(3)
for i=1,#z do
  closeRemoteHandle(z[i].HandleValue, z[i].ProcessID)
end


Also not sure what to do with the encode function, the scripts are asm,
if i paste this at the top of the script -
Code:
local encode = function()

and paste this at the bottom -
Code:
local size = math,random (10,1000000000000)
end
print(encodeFunction(encode))

The result prints in a new window, but copying that into my lua script
gives an error when executed.

Can someone point me in the right direction please.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25837
Location: The netherlands

PostPosted: Fri Apr 19, 2019 11:14 am    Post subject: Reply with quote

that encodeDRM part should be enough, perhaps add a check by spawning a secondary process that opens your trainer, and if it succeeds, quit

as for encodeFunction, that is for Lua, not Asm

anyhow, let's say you have a script like
Code:

local function x(p1)
  print("p1="..p1)
  return p1*2
end

if x(8)==16 then
  print("all ok")
else
  print("nope")
end


you can encode it using:
Code:

print(encodeFunction(loadstring([[local function x(p1)
  print("p1="..p1)
  return p1*2
end

if x(8)==16 then
  print("all ok")
else
  print("nope")
end]])))



which will then print out
Code:
c-oWpDNPJ!ketlRCB=/U!NS2(5ypT38s!d+2p%IdACS{mVh12?1mcti21a;?0{OHp7#iFf92go80L2@[808wEd/I4@UyY%GffcA.m.-8+umF[7!d6g{nODNXo_u!Pke_*MnwMXY3bK:t0c/mfU.*!CAiZuts}dr}1MOj$dw[uvWVk:jqBI7GCCo?hvJ?EF3Nyjn(OitN05LfqXa


you can then load and run it using
Code:

decodeFunction("c-oWpDNPJ!ketlRCB=/U!NS2(5ypT38s!d+2p%IdACS{mVh12?1mcti21a;?0{OHp7#iFf92go80L2@[808wEd/I4@UyY%GffcA.m.-8+umF[7!d6g{nODNXo_u!Pke_*MnwMXY3bK:t0c/mfU.*!CAiZuts}dr}1MOj$dw[uvWVk:jqBI7GCCo?hvJ?EF3Nyjn(OitN05LfqXa")()


Tip: if you make an .exe trainer, build your own lua files with randomized opcode and math orders and use those to encode your scripts and load them back
e.g: https://cheatengine.org/download/havefunwiththisluabuild.rar (though this one has a small issue with negative values, guess I missed one enum or swapped something, oh well)
downside is that scripts from other people which use decodeFunction then fail, so best make a separate CE folder with the modded lua files

_________________
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
View user's profile Send private message MSN Messenger
Flux.
Advanced Cheater
Reputation: 0

Joined: 10 Nov 2016
Posts: 88
Location: Another World - N5X2 106311411+2123518

PostPosted: Fri Apr 19, 2019 11:46 am    Post subject: Reply with quote

Hello Dark Byte, thank you for the detailed response that info is very useful.

I know this is wrong but i was thinking, that the entire script was lua,
with some asm cheats in it, and i was using the encode function on the entire lua script.

Thanks again for the response.

Cant double post.
Sorry to bother you again but a new problem has arose.
Don't know whats happened but every time i use this snippet of code, it causes a bsod, after about 30 secs, any ideas ?
Code:
enableDRM()
z=getHandleList(3)
for i=1,#z do
  closeRemoteHandle(z[i].HandleValue, z[i].ProcessID)
end
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites