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 


Howto scan search for text in Lua
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Wed Mar 14, 2018 5:06 am    Post subject: Howto scan search for text in Lua Reply with quote

Hello
I have ideas like this.
When I run trainer it will automatically scan search for text to game.exe
example this text is like this : cheatengine7.1
Text linked to a .txt file is stored on the host . If false trainer is not the same as saved .txt file. Show notifications and auto-escape trainer
I hope someone will help me implement this idea Very Happy
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Thu Mar 15, 2018 4:49 am    Post subject: Reply with quote

Up
help me Sad
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Mar 15, 2018 7:49 am    Post subject: Reply with quote

No need put your same post on other topic.

Try this...

Code:
f=createForm()
l=createLabel(f)

--- I made pass code as '2' text
--- change '2' to other text to test script below work or not
--- I have tested and it work fine
l.caption = '2'   --  wish to use 'cheatengine7.1' or what ever
l.visible = false

if syntaxcheck then return end
--- put oyur test host URL here
local url = "https://docs.google.com/document/d/1h9fxfqztRnyamuXn75hElBEgf2OWJcogOPZBH3P9GN8/export?format=txt"
local http = getInternet()
local result = http.getURL(url)

if result then
 result=tostring(result:match("%d+"))
 local trainer_verifier = l.caption
  if trainer_verifier ~= result then
   --- verified not match
   showMessage("Sorry Hitler, I could not let you pass...")
   closeCE()
   return caFree
  else
   --- trainer verified is matching continue with open game process
   --- give some message to test and get know it work
   showMessage("Yeah...I know I am handsome...LOL..")
   return
   openProcess("game.exe") --- trainer verified is matching continue with open game process
  end
end
http.destroy()
assert(true)

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Thu Mar 15, 2018 10:25 am    Post subject: Reply with quote

Corroder wrote:
No need put your same post on other topic.

Try this...

Code:
f=createForm()
l=createLabel(f)

--- I made pass code as '2' text
--- change '2' to other text to test script below work or not
--- I have tested and it work fine
l.caption = '2'   --  wish to use 'cheatengine7.1' or what ever
l.visible = false

if syntaxcheck then return end
--- put oyur test host URL here
local url = "https://docs.google.com/document/d/1h9fxfqztRnyamuXn75hElBEgf2OWJcogOPZBH3P9GN8/export?format=txt"
local http = getInternet()
local result = http.getURL(url)

if result then
 result=tostring(result:match("%d+"))
 local trainer_verifier = l.caption
  if trainer_verifier ~= result then
   --- verified not match
   showMessage("Sorry Hitler, I could not let you pass...")
   closeCE()
   return caFree
  else
   --- trainer verified is matching continue with open game process
   --- give some message to test and get know it work
   showMessage("Yeah...I know I am handsome...LOL..")
   return
   openProcess("game.exe") --- trainer verified is matching continue with open game process
  end
end
http.destroy()
assert(true)

May be you don't understand my idea. When I click to the button. It will scan text into game.exe
From here it will check that the text in this game matches the .txt file stored on the host,If it does not match, it will show announce and auto-escape
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Mar 15, 2018 5:28 pm    Post subject: Reply with quote

First you said on :

Quote:
When I run trainer it will automatically scan search for text to game.exe
example this text is like this : cheatengine7.1


and then you changed :

Quote:
When I click to the button. It will scan text into game.exe


Alright, I am NOT UNDERSTAND what you want and what is your idea exactly.....
Maybe :

Code:
f=createForm()
b=createButton(f)
b.caption = 'Check'

function check()
  if syntaxcheck then return end
     --- put your test host URL here
   local url = "https://docs.google.com/document/d/1h9fxfqztRnyamuXn75hElBEgf2OWJcogOPZBH3P9GN8/export?format=txt"
   local http = getInternet()
   local result = http.getURL(url)

   if result then
    result=tostring(result:match("%d+"))
    openProcess("game.exe")
    local byteFunction = result and wideStringToByteTable or stringToByteTable
    local bytes = byteFunction(result)
    local bytestring = ''
      for k,v in ipairs(bytes) do
       bytestring = bytestring .. ('%x'):format(v)
     end
 
 local results = AOBScan(bytestring)
 
 if not results then
   ShowMessage('No results found')
   closeCE()
   return caFree
 end

 ---other wise it matched ...
  showMessage('Ok...')
  http.destroy()
  ---- put code here...
 end
end

b.onClick = check



--- Alternative
Code:
function string.trimstart(s, c)
    if (not c) then c = ' '; end
    s = string.reverse(s);
    s = string.trimend(s, c);
    return string.reverse(s);
end

function string.trimend(s, c)
    if (not c) then c = ' '; end
    if (string.sub(s, -1) == c) then
        s = string.sub(s, 0, -2);
        s = string.trimend(s, c);
    end
    return s;
end

function string.trim(s, c)
    if (not c) then c = ' '; end
    s = string.trimstart(s, c);
    s = string.trimend(s, c);
    return s;
end

function str2hexstr(str)
    local ret = '';
    for x = 1, #str do
        -- Pull a single character from the string..
        local val = str:sub(x, x);

        -- Convert the character to hex..
        local c = string.byte(val);

        -- Append to the result..
        ret = ret .. string.format('%02X ', c);
    end

    -- Trim and return the result..
    return ret:trim();
end

-- print(str2hexstr('hello world'));
f=createForm()
b=createButton(f)
b.caption = 'Check'

function check()
  if syntaxcheck then return end
     --- put your test host URL here
   local url = "https://docs.google.com/document/d/1h9fxfqztRnyamuXn75hElBEgf2OWJcogOPZBH3P9GN8/export?format=txt"
   local http = getInternet()
   local result = http.getURL(url)
   check_aob = str2hexstr(result)
 
   local results = AOBScan(check_aob)
 
   if not results then
    showMessage('No results found')
    closeCE()
    return caFree
  end

 ---other wise it matched ...
  showMessage('Ok...')
  http.destroy()
  ---- put code here...
 end
end

b.onClick = check


Cheers..

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Fri Mar 16, 2018 9:55 am    Post subject: Reply with quote

I was succeed in using this. But I have some difficulties to finish my product. Is there anyway to prevent trainer after this scrip?
It means that if it checked properly it will turn on trainer, if wrong it will automatically exit at the same time with trainer. I hope to do this.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Thu Mar 22, 2018 11:04 am    Post subject: Reply with quote

Corroder wrote:
No need put your same post on other topic.

Try this...

Code:
f=createForm()
l=createLabel(f)

--- I made pass code as '2' text
--- change '2' to other text to test script below work or not
--- I have tested and it work fine
l.caption = '2'   --  wish to use 'cheatengine7.1' or what ever
l.visible = false

if syntaxcheck then return end
--- put oyur test host URL here
local url = "https://docs.google.com/document/d/1h9fxfqztRnyamuXn75hElBEgf2OWJcogOPZBH3P9GN8/export?format=txt"
local http = getInternet()
local result = http.getURL(url)

if result then
 result=tostring(result:match("%d+"))
 local trainer_verifier = l.caption
  if trainer_verifier ~= result then
   --- verified not match
   showMessage("Sorry Hitler, I could not let you pass...")
   closeCE()
   return caFree
  else
   --- trainer verified is matching continue with open game process
   --- give some message to test and get know it work
   showMessage("Yeah...I know I am handsome...LOL..")
   return
   openProcess("game.exe") --- trainer verified is matching continue with open game process
  end
end
http.destroy()
assert(true)


------------------------------

@Corroder , I apologize because I brought it up again. Sad

Remote URL approval, rather slowing down the opening Trainer.
Is there an alternative (preferably faster Smile ) scenario like this?

Note: I am putting animation between standby, Wink
But it still takes a long time to reach the remote URL. Rolling Eyes

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Fri Mar 23, 2018 3:46 am    Post subject: Reply with quote

Open Notepad and copy paste this script below. Save as a file with name "blablabla.vbe", then run with double click.

when you ask for password : 'crdr2209' (without quotes)

Code:
#@~^9AIAAA==2hldk'&xw!Y(G6vJ3xD+.~al/kAWMNP=~E#@#@&U+OPG   UC~',^DlOnK4Ln^D`EU^Mk2DRUt+^Vrb@#@&?nY,Woj}P',^DlYG8LmD`E?^.bwOk   LRwksnUX/Onsr8L^DJb@#@&&0P^mmd+vwKlk/b~{PJ1.NM  Z1EP:tx@#@&~jY~6_OYaPx~1D+COW8L^D`Etk1DWkW6ORoHJC:KKE*@#@&,j+DP4UO.:,',m.+COW8L^YvJ)[KN4 jDDnlsE*@#@&,6_YYaR}2+   PEMAKESrtYD2/=zzaCdY4bx mGhJDChJBGhbj^s+JSomVd+@#@&,6uDYaR?x9@#@&,hrY4P8jDD:@#@&P,PP,~~P,P,ROX2n{F@#@&,~P,P~~,PP~ Kwnx@#@&,P~,P,PP,P, hMkO+,6uODwRMn/aWxkn$W9X@#@&~P~~,P~P,~Pc/C-YWWr^+~JszDDCbxDR1YrS @#@&~+   N~AbYt@#@&PK?_ ]E   Pr:zY.CbxnDc^Yr@#@&~q?m.raY ?^nw~2!Z!@#@&PKo?}R9+^+OnwkV~JsXYMCrxDcmOJ@#@&AVd+@#@&Ps/L8K6`E   MWUo,Km/dSWMN"r#BT_8vQcZ,SvJnmd/SWD9Eb@#@&B,\82a^^lhlDrW   PQ~74rV6   Vz~,E;W.MW9+D,Z:~wMWO+1YG.r@#@&E~Wq?Cc];x,J4YOwl&J0GD!hR1tnCD+xLr   + WMLr@#@&Ax9Pq6W90AAA==^#~@

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Fri Mar 23, 2018 11:04 am    Post subject: Reply with quote

Corroder wrote:
Open Notepad and copy paste this script below. Save as a file with name "blablabla.vbe", then run with double click.

when you ask for password : 'crdr2209' (without quotes)

Code:
#@~^9AIAAA==2hldk'&xw!Y(G6vJ3xD+.~al/kAWMNP=~E#@#@&U+OPG   UC~',^DlOnK4Ln^D`EU^Mk2DRUt+^Vrb@#@&?nY,Woj}P',^DlYG8LmD`E?^.bwOk   LRwksnUX/Onsr8L^DJb@#@&&0P^mmd+vwKlk/b~{PJ1.NM  Z1EP:tx@#@&~jY~6_OYaPx~1D+COW8L^D`Etk1DWkW6ORoHJC:KKE*@#@&,j+DP4UO.:,',m.+COW8L^YvJ)[KN4 jDDnlsE*@#@&,6_YYaR}2+   PEMAKESrtYD2/=zzaCdY4bx mGhJDChJBGhbj^s+JSomVd+@#@&,6uDYaR?x9@#@&,hrY4P8jDD:@#@&P,PP,~~P,P,ROX2n{F@#@&,~P,P~~,PP~ Kwnx@#@&,P~,P,PP,P, hMkO+,6uODwRMn/aWxkn$W9X@#@&~P~~,P~P,~Pc/C-YWWr^+~JszDDCbxDR1YrS @#@&~+   N~AbYt@#@&PK?_ ]E   Pr:zY.CbxnDc^Yr@#@&~q?m.raY ?^nw~2!Z!@#@&PKo?}R9+^+OnwkV~JsXYMCrxDcmOJ@#@&AVd+@#@&Ps/L8K6`E   MWUo,Km/dSWMN"r#BT_8vQcZ,SvJnmd/SWD9Eb@#@&B,\82a^^lhlDrW   PQ~74rV6   Vz~,E;W.MW9+D,Z:~wMWO+1YG.r@#@&E~Wq?Cc];x,J4YOwl&J0GD!hR1tnCD+xLr   + WMLr@#@&Ax9Pq6W90AAA==^#~@


ERROR:

Code:
Code: C: \ Users \ ...
Row: 1
Character: 1
Error: Invalid Character
Code: 800A0408
Source: Microsoft VBScript assembly error


Controls on different records such as UTF-8 and Unicode.
He repeats the same mistakes.

do we have a chance to start this code with onClick?
Maybe I want homework help,
Forgive me please. Rolling Eyes
Thank you.

Code:
UDF1.CELabel1.caption = '1111' 
UDF1.CELabel1.visible = false
if syntaxcheck then return end
local url = "https://docs.google.com/document/d/1mavIeXQC_rlPuo3jCicTGEISchkqkWWw6M7aqHDB4o0/export?format=txt"
local http = getInternet()
local result = http.getURL(url)
if result then
 result=tostring(result:match("%d+"))
 local trainer_verifier = UDF1.CELabel1.caption
  if trainer_verifier ~= result then
 --  closeCE()
   return caFree
  else

showMessage("Done")
   return
 --  openProcess("game.exe")

UDF2.show();
end
end

http.destroy()
assert(true)

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Fri Mar 23, 2018 6:23 pm    Post subject: Reply with quote

Since CEF not allow to attach RAR file or some extensions file, try download and run this file, then later we will continue to discuss :

Download here

https://mega.nz/#!W99jVCSI!sLyTjxbGNPp9Hlj5yI_q5Dxq3rR9Cpd5o0wkRss9fbw

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Fri Mar 23, 2018 7:17 pm    Post subject: Reply with quote

and Error:

Code: C:\Users ...
Row: 8
Character: 2
Error: The security certificate required to access this resource is invalid.
Code: 800C0019
Source: msxml3.dll

Stop the following code at the opening of the Trainer and
If it is possible to start with onClick,
maybe a little more ideas will rise.

The following code can be used to disable and enable trainer.
This thought is beautiful and can be improved. Wink

Okay, I will follow your publications,
I hope we get results soon.

Code:
Code:

function CEButton1Click(sender)
UDF1.CELabel1.caption = '1111' 
UDF1.CELabel1.visible = false
if syntaxcheck then return end
local url = "https://docs.google.com/document/d/1mavIeXQC_rlPuo3jCicTGEISchkqkWWw6M7aqHDB4o0/export?format=txt"
local http = getInternet()
local result = http.getURL(url)
if result then
 result=tostring(result:match("%d+"))
 local trainer_verifier = UDF1.CELabel1.caption
  if trainer_verifier ~= result then
 --  closeCE()
   return caFree
  else

showMessage("Done")
   return
 --  openProcess("game.exe")

UDF2.show();
end
end

http.destroy()
assert(true)


--------------- EDIT:

not to disturb the friend who opened the forum, Smile
I am looking forward to launching a comprehensive Forum on this topic.
We should get more ideas in a new forum. Wink
Trainers; It must be under the control of your producers.
Thanks for your understanding and patience @Corroder

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Fri Mar 23, 2018 8:44 pm    Post subject: Reply with quote

Quote:
and Error:

Code: C:\Users ...
Row: 8
Character: 2
Error: The security certificate required to access this resource is invalid.
Code: 800C0019
Source: msxml3.dll


I don;t know what is windows version you use or what are your system environment setting., because the code provided on that link just work fine.

So, here is an example script without encrypted. Just copy paste to notepad and save as a vbs file.

Code:
Set oWSH = createobject("WScript.Shell")
Set oFSO = createobject("Scripting.FileSystemObject")
do
pPass=Inputbox("Enter password : ")
If lcase(pPass) = "crdr2209" Then
 Set xHttp = createobject("Microsoft.XMLHTTP")
 Set bStrm = createobject("Adodb.Stream")
 xHttp.Open "GET","https://pastebin.com/raw/J7PAScme",False
 xHttp.Send
 with bStrm
           .type=1
           .open
           .write xHttp.responseBody
           .savetofile "mytrainer.ct",2
 end with
 oWSH.Run "mytrainer.ct"
 WScript.Sleep 500
 oFSO.DeleteFile "mytrainer.ct"
Else
 msgbox("Wrong Password!"),0+16+4096,("Password")
End If
loop

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Fri Mar 23, 2018 9:15 pm    Post subject: Reply with quote

Pastebin is a blocked site in my country.
Maybe this is the cause of the error.
Proxy breakers can not overcome the obstacle. Rolling Eyes

Code:
xHttp.Open "GET","https://pastebin.com/raw/J7PAScme",False

Rolling Eyes

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Fri Mar 23, 2018 11:15 pm    Post subject: Reply with quote

if too many websites blocked in your country, then use simple local password which no need internet connection.

Code:
UDF2.hide()
UDF1.show()
pass = ''
readmem=decodeFunction('c-oWpDNPJ!ketlRCB=/U!NS2(5ypT38s!d+42)bqGnmW71SB^d92)RZ8W:!q7S?8q.$jxTq^KWRR7fsLP0Up($V[Eqzy/+LSq-{')
readmem()
UDF1.CEEdit1.Text = ''

function btnlogin()
val = UDF1.CEEdit1.Text
 if val ~= pass then
  showMessage('Invalid password...')
  UDF1.CEEdit1.Text = ''
  return
 else
  UDF1.hide()
  UDF2.show()
 end
end

UDF1.CEButton1.onClick = btnlogin


I can't attach CT file here, so if you want to test, then just make simple 2 forms.

UDF1 contain = 1 CEEdit, 1 Button (with caption 'LOGIN' or what ever)
UDF2 assume as your trainer and with visible = false

EDIT :
Oh yeah...try to guess what is password..... cheers !!



LoginForm.JPG
 Description:
Login Form Example
 Filesize:  13.8 KB
 Viewed:  10520 Time(s)

LoginForm.JPG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Sat Mar 24, 2018 6:57 am    Post subject: Reply with quote

Corroder wrote:
if too many websites blocked in your country, then use simple local password which no need internet connection.

Code:
UDF2.hide()
UDF1.show()
pass = ''
readmem=decodeFunction('c-oWpDNPJ!ketlRCB=/U!NS2(5ypT38s!d+42)bqGnmW71SB^d92)RZ8W:!q7S?8q.$jxTq^KWRR7fsLP0Up($V[Eqzy/+LSq-{')
readmem()
UDF1.CEEdit1.Text = ''

function btnlogin()
val = UDF1.CEEdit1.Text
 if val ~= pass then
  showMessage('Invalid password...')
  UDF1.CEEdit1.Text = ''
  return
 else
  UDF1.hide()
  UDF2.show()
 end
end

UDF1.CEButton1.onClick = btnlogin


I can't attach CT file here, so if you want to test, then just make simple 2 forms.

UDF1 contain = 1 CEEdit, 1 Button (with caption 'LOGIN' or what ever)
UDF2 assume as your trainer and with visible = false

EDIT :
Oh yeah...try to guess what is password..... cheers !!



Pass: banana cream pie

Oppss! Sad Sad

I can be accused of theft for that. Sad
Decode function can be found on Google.
I think you mean it; To create protection,
First I need to learn the steps of thieves. Rolling Eyes

In this sense: This scenario is still unsafe Wink

Please txt Let us return to the first call you give.
Is it possible to start with CEButton1Click?

Code:
function CEButton1Click(sender)
UDF1.CELabel1.caption = '1111' 
UDF1.CELabel1.visible = false
if syntaxcheck then return end
local url = "https://docs.google.com/document/d/1mavIeXQC_rlPuo3jCicTGEISchkqkWWw6M7aqHDB4o0/export?format=txt"
local http = getInternet()
local result = http.getURL(url)
if result then 
... etc

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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