View previous topic :: View next topic |
Author |
Message |
Lynxz Gaming Expert Cheater Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Thu Dec 21, 2017 12:38 am Post subject: Scanning String with lua and result will be in ListBox[HELP] |
|
|
How to scan a string using Lua and the result will be inside ListBox
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Thu Dec 21, 2017 10:34 pm Post subject: |
|
|
Not really sure what you mean, you can use an aobscan if you find the bytes or you can use a memscan and provide the appropriate values to scan for the string, neither will automatically put the result in a ListBox for you however, you'd need to take the result from the StringList or FoundList and put it in a ListBox after the scan is finished.
|
|
Back to top |
|
|
Lynxz Gaming Expert Cheater Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Fri Dec 22, 2017 5:00 am Post subject: |
|
|
FreeER wrote: | Not really sure what you mean, you can use an aobscan if you find the bytes or you can use a memscan and provide the appropriate values to scan for the string, neither will automatically put the result in a ListBox for you however, you'd need to take the result from the StringList or FoundList and put it in a ListBox after the scan is finished. |
sorry for my bad english xD, i want CEEdit scan a string, and the scan result will be on CEListBox.
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Fri Dec 22, 2017 7:44 am Post subject: |
|
|
Not so much your English as the actual explanation but I suppose that's enough to work with... I'd expect something like this to work. Oh, if you're not certain whether the strings will always be wide strings / unicode or not you'll probably want to provide a checkbox for the user to tell you
Code: | -- get string from editbox
local string = CETrainer.CEEdit1.Text
-- if edit box is empty, do nothing. Could do more checks for if it's just whitespace but...
if string == "" then return end
-- use checkbox to determine which function to use to get bytes
-- if you know it's always one or the other then just use the proper one :)
local byteFunction = CETrainer.CECheckbox1.Checked and wideStringToByteTable or stringToByteTable
-- get the bytes
local bytes = byteFunction(string)
-- turn byte table into hex string
local bytestring = ''
for k,v in ipairs(bytes) do
bytestring = bytestring .. ('%x'):format(v)
end
-- scan for bytes
local results = AOBScan(bytestring)
-- if not found show message and quit
if not results then
ShowMessage('No results found')
return
end
-- otherwise, update list box
CETrainer.CEListBox1.Items = results |
Replace "CETrainer" with whatever your form name is, pretty sure CETrainer is the default for trainers that CE generates for you but if you create your own then it's probably UDF1, for User Defined Form, or something like that by default.
Replace "CEEdit1" with the name of your edit box, "CEListBox1" with the name of your list box, and "CECheckbox1" with the name of your checkbox, all of those are the defaults for the first ones created.
|
|
Back to top |
|
|
Lynxz Gaming Expert Cheater Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Fri Dec 22, 2017 10:48 pm Post subject: |
|
|
Thank you for reply! and it works!
but what if the result is a string too?
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sat Dec 23, 2017 12:31 am Post subject: |
|
|
results, the return value of AOBScan, will be either nil if nothing is found or a StringList object which contains strings. Since most things in CE happen to be strings that shouldn't be an issue most of the time, but if you do need to convert one from a hex string to a number you can use tonumber(thestring, 16) or getAddress/getAddressSafe (which can also handle symbol names like modules and registered symbols, the "safe" version will simply return nil if you give it something it can't figure out).
|
|
Back to top |
|
|
|