| 
			
				|  | Cheat Engine The Official Site of Cheat Engine
 
 
 |  
 
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| MetaUnv_WithCE How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 27 Jul 2021
 Posts: 9
 
 
 | 
			
				|  Posted: Mon Jan 17, 2022 8:10 am    Post subject: luacode section not functional in generated trainer |   |  
				| 
 |  
				| may I know if new {$LUACODE} function in CE7.3 works in generated trainner? 
 I got a old trainner code(execute a codeinjection AAscript ) upgrade to luacode,and it works well in CE,but if compiled it as a standalone trainner,it will not functional to write AAscript code injection to target process(verified by using CE to check the memory)
 
 for simply concept the keypart code just like:
 
 
 
  	  | Code: |  	  | --controlMainForm = getMainForm() xx=false
 
 function enableit()
 scan="B8 ? ? ? ? E8 "
 x=AOBScanUnique(scan)
 registerSymbol("subaddr",x)
 mem=allocateMemory(0x2048)
 registerSymbol("newmem",mem)
 script=[[
 label(returnhere)
 label(originalcode)
 label(exit)
 
 newmem: //this is allocated memory, you have read,write,execute access
 //place your code here
 push rax
 pushfq
 {$luacode tt=r9}
 x=readString(tt,5000)
 http=getInternet()
 c="data="..urlEncode(x)
 s=http.postURL("http://127.0.0.1/log",c)
 http.destroy()
 {$asm}
 jmp originalcode
 
 
 originalcode:
 popfq
 pop rax
 mov rax,rsp
 mov [rax+08],rbx
 
 exit:
 jmp returnhere
 
 subaddr:
 jmp newmem
 nop 2
 returnhere:
 
 
 ]]
 ax=autoAssemble(script)
 end
 
 
 function disableit()
 --writeBytes(x,0x48,0x8B,0xC4,0x48,0x89,0x58,0x08)
 --writeBytes(x,0x48,0x8B,0xC4,0x48,0x89,0x58,0x08,0x48,0x89,0x70,0x10,0x48,0x89,0x78,0x18)
 --writeBytes(x,0x48,0x8B,0xC4,0x48,0x89,0x58,0x08)
 writeBytes(x,0x48,0x8B,0xC4,0x48,0x89,0x58,0x08,0x48,0x89,0x70,0x10,0x48,0x89,0x78,0x18,0x4c,0x89,0x48,0x20,0x55)
 unregisterSymbol("newmem")
 unregisterSymbol("subaddr")
 deAlloc(mem,0x2048)
 mem=nil
 scan=nil
 x=nil
 ax=nil
 end
 
 --writeBytes(x,0x48,0x8B,0xC4,0x48,0x89,0x58,0x08,0x48,0x89,0x70,0x10,0x48,0x89,0x78,0x18,0x4c)
 --48 8B C4 48 89 58 08 48 89 70 10 48 89 78 18 4c 89 48 20 55 41 54 41 55 41 56 41 57 48 8d a8 68EDFFFF
 function CETrainer_CEButton1Click(sender)
 if not(xx) then
 enableit()
 xx=true
 CETrainer.CEButton1.setCaption("Disable")
 else
 disableit()
 xx=false
 CETrainer.CEButton1.setCaption("Enable")
 end
 end
 
 
 
 | 
 
 
 
 tried with all features enabled
 
 
 
 
	
		
	 
		| Description: |  |  
		| Filesize: | 13.58 KB |  
		| Viewed: | 2180 Time(s) |  
		| 
  
 
 |  
 |  |  
		| Back to top |  |  
		|  |  
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Mon Jan 17, 2022 8:35 am    Post subject: |   |  
				| 
 |  
				| looks like I forgot to add the luacode required files to the exe pre-built options 
 You'll need to add luaclient*.dll files to the .exe package (use the add file(s) option in extra files for that)(
 _________________
 
 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 |  |  
		|  |  
		| MetaUnv_WithCE How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 27 Jul 2021
 Posts: 9
 
 
 | 
			
				|  Posted: Mon Jan 17, 2022 8:50 am    Post subject: |   |  
				| 
 |  
				|  	  | Dark Byte wrote: |  	  | looks like I forgot to add the luacode required files to the exe pre-built options 
 You'll need to add luaclient*.dll files to the .exe package (use the add file(s) option in extra files for that)(
 | 
 
 Thanks So Much Dark Byte!
   and here is another question:
 Is luacode section thread safe?
 
 for example the codeinjection in original post
 will may executed by mutlithread in target process
 
 (in fact it's a network packet function,and where codeinejction injected was a code section shared in multiple tcp socket client in target process, one socket client one thread,I'm trying to log every packet data by that injection and post it to local webserver to save)
 
 so,if luacode executed concurrently ,for example instancehttp1=getInternet() ,will the instancehttp1instance here shared across multiple thread is same instance?if not,will it block and hang to execute one by one(sometimes the webserver may slow to response)?
 |  |  
		| Back to top |  |  
		|  |  
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Mon Jan 17, 2022 10:16 am    Post subject: |   |  
				| 
 |  
				| the luacode section runs in it's own thread, so don't access gui code unless you synchronize() it with the main thread first 
 Also, right now, only one luacode section can run at a time, so if you take a long time, or even wait for some other lua code, it'll freeze the target process
 
 
 (Instead of luacode you may want to use createThread(function())  )
 _________________
 
 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 |  |  
		|  |  
		| MetaUnv_WithCE How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 27 Jul 2021
 Posts: 9
 
 
 | 
			
				|  Posted: Mon Jan 17, 2022 11:05 pm    Post subject: |   |  
				| 
 |  
				|  	  | Dark Byte wrote: |  	  | the luacode section runs in it's own thread, so don't access gui code unless you synchronize() it with the main thread first 
 Also, right now, only one luacode section can run at a time, so if you take a long time, or even wait for some other lua code, it'll freeze the target process
 
 
 (Instead of luacode you may want to use createThread(function())  )
 | 
 
 found a post /viewtopic.php?t=611040 said Lua is not thread-safe,got some clue.
 
 may I confirm the gui code you mentioned here is the gui thread in trainner,not the render thread in game?
 
 and createThread might not suitable here since the  Shared Packet Process Code Section is in inside different Network Thread and managed by game process itself?
 
 so the  createThread might not suitable in this situation but we may create multiple LuaThread in trainner.exe when needed when it's a function we can directly execute(for ex a loop that consistently add 1 health per seconds)
 
 im assume it works like follow picture
 
 
 
 
	
		
	 
		| Description: |  |  
		| Filesize: | 77.6 KB |  
		| Viewed: | 2092 Time(s) |  
		| 
  
 
 |  
 |  |  
		| Back to top |  |  
		|  |  
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Tue Jan 18, 2022 12:36 am    Post subject: |   |  
				| 
 |  
				| CE's gui thread yes 
 you may want to implement a producer/consumer mechanic as postURL can take a while.
 
 example: network thread 1 calls luacode,  then network thread 2 and 3 have to wait till network thread 1 has finished sending the data
 
 (you can also write the data to a file if it's localhost only)
 _________________
 
 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 |  |  
		|  |  
		| MetaUnv_WithCE How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 27 Jul 2021
 Posts: 9
 
 
 | 
			
				|  Posted: Tue Jan 18, 2022 1:06 am    Post subject: |   |  
				| 
 |  
				|  	  | Dark Byte wrote: |  	  | CE's gui thread yes 
 you may want to implement a producer/consumer mechanic as postURL can take a while.
 
 example: network thread 1 calls luacode,  then network thread 2 and 3 have to wait till network thread 1 has finished sending the data
 
 (you can also write the data to a file if it's localhost only)
 | 
 
 
 Thanks so much my legend! got it finally
   
 looks {$luacode} and {$ccode} bring by 7.3 opens a whole new land,there gonna be alot daily reverse job gonna benefit from this! !
 |  |  
		| Back to top |  |  
		|  |  
		|  |  
  
	| 
 
 | 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
 
 |  |