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 


How to Hide Data in LUA script By Encrypting Data

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
zu007
How do I cheat?
Reputation: 0

Joined: 26 Feb 2015
Posts: 5

PostPosted: Wed Jun 03, 2015 3:46 pm    Post subject: How to Hide Data in LUA script By Encrypting Data Reply with quote

i just find this Lua Script but cann't understand how they Encrypt the Data.
also i cann't UnderStand these Function(bec & bdc).Specially function bdc used to Decoding for Encrypted Data.

Orignal Values which are Encrypted.
===========================================
v[1]=60 9B 03 66 40 65 01 6C 06 65 01 6C 05 65 01 6C 08 65 01 6C 09
v[2]=60 9B 03 66 40 65 01 6C 06 65 01 6C 05 65 01 6C 08 65 01 6C 08
v[3]=6D 06 60 9B 03 66 40 65 01 6C 06 65 01 6C 05 65 01 6C 07 65 01 6C 08
v[4]=6D 06 60 9B 03 66 40 65 01 6C 06 65 01 6C 05 65 01 6C 07 65 01 6C 07
v[5]=AB ?? ?? ?? ?? 00 00 ?? ?? ?? ?? ?? ?? ?? ?? ?? 00 00 ?? 66 ?? ?? ?? ?? ?? ?? ?? ?? ?? 66 ?? ?? ?? ?? ?? ?? ?? ?? 06 ?? ?? ?? ?? ?? ?? ?? ?? 47
v[6]=?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0E
v[7]=60 C3 06 66 17 D0 66 E4 4B 46 BE 28 01 46 1D 00 4F
v[8]=25 F9 02 02 02 02 02 02 02 02 02 02 02 02 02 02 4f
v[9]=D1 66 89 34 12 02 00 00 26 48 D1 66 C1 28 60 AD 05 66 D4 22
v[10]=D1 66 ?? ?? 12 02 00 00 27 48 D1 66 ?? ?? 60 ?? ?? 66 ?? ??
v[11]=61 ?? 2a 24 ?? 25 ?? ??
v[12]=61 ?? 2a 24 ?? 25 88 27
============================================




Code:




-- Decoding Functions use Decrypt Code & Text

function bec(data)
    return ((data:gsub('.', function(x)
        local r,b='',x:byte()
        for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
        return r;
    end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
        if (#x < 6) then return '' end
        local c=0
        for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
        return b:sub(c+1,c+1)
    end)..({ '', '==', '=' })[#data%3+1])
end

function bdc(data)
    data = string.gsub(data, '[^'..b..'=]', '')
    return (data:gsub('.', function(x)
        if (x == '=') then return '' end
        local r,f='',(b:find(x)-1)
        for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
        return r;
    end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
        if (#x ~= 8) then return '' end
        local c=0
        for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
        return string.char(c)
    end))
end

---- already Encrypted Data

v[1]=bdc('NjAgOUIgMDMgNjYgNDAgNjUgMDEgNkMgMDYgNjUgMDEgNkMgMDUgNjUgMDEgNkMgMDggNjUgMDEgNkMgMDk=') 
v[2]=bdc('NjAgOUIgMDMgNjYgNDAgNjUgMDEgNkMgMDYgNjUgMDEgNkMgMDUgNjUgMDEgNkMgMDggNjUgMDEgNkMgMDg=')
v[3]=bdc('NkQgMDYgNjAgOUIgMDMgNjYgNDAgNjUgMDEgNkMgMDYgNjUgMDEgNkMgMDUgNjUgMDEgNkMgMDcgNjUgMDEgNkMgMDg=')
v[4]=bdc('NkQgMDYgNjAgOUIgMDMgNjYgNDAgNjUgMDEgNkMgMDYgNjUgMDEgNkMgMDUgNjUgMDEgNkMgMDcgNjUgMDEgNkMgMDc=')
v[5]=bdc('QUIgOTYgMkEgMTIgMDcgMDAgMDAgMjkgRDIgNDYgRjYgMDUgMDAgNzYgMTIgMUQgMDAgMDAgRDAgNjYgOTIgMTcgRDEgQzQgNEYgRjcgMDYgMDEgRDAgNjYgOTIgMTcgNDYgMUQgMDAgMjQgMDAgMEQgMDYgMDAgMDAgRDAgNEYgREIgQTkgMDEgMDAgNDc=')
v[6]=bdc('Pz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gPz8gMEU=')
v[7]=bdc('RDEgNjYgODkgMzQgMTIgMDIgMDAgMDAgMjYgNDggRDEgNjYgQzEgMjggNjAgQUQgMDUgNjYgRDQgMjI=')
v[8]=bdc('RDEgNjYgPz8gPz8gMTIgMDIgMDAgMDAgMjcgNDggRDEgNjYgPz8gPz8gNjAgPz8gPz8gNjYgPz8gPz8=')
v[9]=bdc('NjAgQzMgMDYgNjYgMTcgRDAgNjYgRTQgNEIgNDYgQkUgMjggMDEgNDYgMUQgMDAgNEY=')
v[10]=bdc('MjUgRjkgMDIgMDIgMDIgMDIgMDIgMDIgMDIgMDIgMDIgMDIgMDIgMDIgMDIgMDIgNGY=')
v[11]=bdc('NjEgPz8gMmEgMjQgPz8gMjUgPz8gPz8=')
v[12]=bdc('NjEgPz8gMmEgMjQgPz8gMjUgODggMjc=')


function cyberHacks()
t =
{

{bdc('V29ya3Nob3AgSGFjayBVcGdyYWRlIHdpdGhvdXQgVGhvcml1bQ=='),[[
Luacall(scan(v[1],v[2]))
Luacall(scan(v[3],v[4]))
]]},
{bdc('V29ya3Nob3AgVGltZSBCeXBhc3MgKGVuYWJsZSBhdCA4MSUp'),[[
Luacall(scan( v[5],v[6]))
]]},
{bdc('RXBpYyBUZWNoIChlbmFibGUgYXQgODElKQ=='),[[
Luacall(scan(v[7],v[8]))
]]},
{bdc('VW5sb2NrIExvY2tlZCBVbml0cyBpbiBXb3Jrc2hvcCAoYXQgODElKQ=='),[[
Luacall(scan(v[9],v[10]))
]]},
{bdc('NWsgRGVzaWduKGVuYWJsZSBhdCA4MSUp'),[[
Luacall(scan(v[11],v[12]))
]]},

}
end







function scan(search, change)
     aobs = AOBScan(search, "+W")
     if(aobs == nil) then
      scanCheck=false
    else
       j = stringlist_getCount(aobs)
      for i = 1, j do
          address=stringlist_getString(aobs,i-1)
          for i = 1, string.len(change), 3 do
             z = string.sub(change, i, i+2)
             x, y = string.find(z, "%?+")
              if (x == nil) then
                script=[[
                ]]..address.."+"..(DEC_HEX((i-1)/3))..[[:
                db ]]..z..[[
                ]]
                autoAssemble(script)
             end
          end
       end
      object_destroy(aobs);
      aobs=nil
      scanCheck=true
   end
end



Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Wed Jun 03, 2015 4:26 pm    Post subject: Reply with quote

Just run the data through the routine like it is and print out the results if you need to read it.

As for how it works, they are just base64 encoding / decoding the data. The functions this uses are taken from:
http://lua-users.org/wiki/BaseSixtyFour

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Fluffer_Nutter
Advanced Cheater
Reputation: 0

Joined: 26 Feb 2015
Posts: 67

PostPosted: Wed Jun 03, 2015 11:51 pm    Post subject: Reply with quote

All these War Commander kiddies on the forums lol.

When we wrote that script it is using Base64 encryption like atom0s said. But the issue was it was still easy to see. But if you want to use it just use the print() command and decode / encode it. If you made it that far to take it from our trainer just go a little farther to decrypte it.

But like i said its all in the LUA test so anyone can just look inside and see how it is encrypted and BAM you have the codes. I would suggest just not using Base64 and try something else.

bec = Base64 Encryption Command
bdc = Base64 Decryption Command
Back to top
View user's profile Send private message
VirtualMind
Newbie cheater
Reputation: 0

Joined: 04 Apr 2015
Posts: 20

PostPosted: Sun Apr 03, 2016 8:30 am    Post subject: Reply with quote

Fluffer_Nutter wrote:
All these War Commander kiddies on the forums lol.

When we wrote that script it is using Base64 encryption like atom0s said. But the issue was it was still easy to see. But if you want to use it just use the print() command and decode / encode it. If you made it that far to take it from our trainer just go a little farther to decrypte it.

But like i said its all in the LUA test so anyone can just look inside and see how it is encrypted and BAM you have the codes. I would suggest just not using Base64 and try something else.

bec = Base64 Encryption Command
bdc = Base64 Decryption Command


why are you including the encryption function if you're not gonna actually use it? seems who made the script is a kiddie himself since he blindly copied the given source code.
Back to top
View user's profile Send private message
Fluffer_Nutter
Advanced Cheater
Reputation: 0

Joined: 26 Feb 2015
Posts: 67

PostPosted: Sun Apr 03, 2016 6:08 pm    Post subject: Reply with quote

It was just for testing, but now others use it and think it locks there trainer. I think the original was found off the Lua help center. But yes the issue is the function is sitting right there, so very easy to crack. Also it uses cipher encryption (depending on how new the code is, original was just base64) but again same issue since it is found and used with just text search with cheat engine.

Here is the link. Credit is given.
http://lua-users.org/wiki/BaseSixtyFour
Back to top
View user's profile Send private message
facecheats
Newbie cheater
Reputation: 0

Joined: 12 Jul 2015
Posts: 20

PostPosted: Tue Apr 26, 2016 12:34 pm    Post subject: Reply with quote

[quote="Fluffer_Nutter"]It was just for testing, but now others use it and think it locks there trainer. I think the original was found off the Lua help center. But yes the issue is the function is sitting right there, so very easy to crack. Also it uses cipher encryption (depending on how new the code is, original was just base64) but again same issue since it is found and used with just text search with cheat engine.

Here is the link. Credit is given.



Code:

local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'

function bec(data)
    return ((data:gsub('.', function(x)
        local r,b='',x:byte()
        for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
        return r;
    end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
        if (#x < 6) then return '' end
        local c=0
        for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
        return b:sub(c+1,c+1)
    end)..({ '', '==', '=' })[#data%3+1])
end

function bdc(data)
    data = string.gsub(data, '[^'..b..'=]', '')
    return (data:gsub('.', function(x)
        if (x == '=') then return '' end
        local r,f='',(b:find(x)-1)
        for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
        return r;
    end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
        if (#x ~= 8) then return '' end
        local c=0
        for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
        return string.char(c)
    end))
end



title = "Property Of Cyber Terminators"
credits=bdc(' ')
blue="0x00ff123"
red1="0x000000FF"
Background="0x00FFD700"
white="0x00000000"
green="0x0043FF00"
--showMessage(bdc(' '))

mt = {}
mt[1]= bdc('RWlvQUFHSUxZZ3RtNmdaZ2xTeG03QzRrQVE9PQ==')
mt[2]= bdc('RWdBQUFHSUxZZ3RtNmdaZ2xTeG03QzRrTlE9PQ==')
mt[3]= bdc('RWlvQUFHSU9ZZzVtNmdaZ2xTeG03QzRrQVE9PQ==')
mt[4]= bdc('RWdBQUFHSU9ZZzVtNmdaZ2xTeG03QzRrTlE9PQ==')


function setHack_Information()
t =
{
{'Instant Construction',[[Luacall(scan(mt[1],mt[2]))]]},
{'Gems on Collect',[[Luacall(scan(mt[3],mt[4]))]]},

}
end

----------------------------------------- MAIN GUI -----------------------------------------
MainGUI     = {}
MainGUI[1]  = createForm(false)
MainGUI[2]  = createPanel(MainGUI[1])
MainGUI[4]  = createLabel(MainGUI[2])
MainGUI[5]  = createGroupBox(MainGUI[2])
MainGUI[6]  = createLabel(MainGUI[5])
MainGUI[7]  = createLabel(MainGUI[5])
MainGUI[8]  = createLabel(MainGUI[2])
MainGUI[9]  = createLabel(MainGUI[5])
MainGUI[10] = createComboBox(MainGUI[5])
MainGUI[11]  = createGroupBox(MainGUI[2])
MainGUI[12] = createButton(MainGUI[5])
MainGUI[13] = createLabel(MainGUI[2])
MainGUI[14]  = createLabel(MainGUI[11])
MainGUI[15] = createListBox(MainGUI[11])
MainGUI[16] = createButton(MainGUI[11])
MainGUI[17] = createButton(MainGUI[11])
MainGUI[18]  = createLabel(MainGUI[11])
MainGUI[19]  = createLabel(MainGUI[11])
MainGUI[23]  = createButton(MainGUI[11])
MainGUI[24]  = createButton(MainGUI[11])


----------------------------------------- PROPERTIES -----------------------------------------
setProperty(MainGUI[1] , "color", red2)
setProperty(MainGUI[1] , "ShowInTaskBar", 'stAlways')
setProperty(MainGUI[1] , "Position", "poScreenCenter")
setProperty(MainGUI[1] , "BiDiMode", "bdLeftToRight")
setProperty(MainGUI[2] , "BiDiMode", "bdLeftToRight")
setProperty(MainGUI[2] , "BiDiMode", "bdLeftToRight")
setProperty(MainGUI[10] , "ReadOnly", "True")
FontHeight = getProperty(MainGUI[4] , "Font")
setProperty(FontHeight , "Style", "[fsBold, fsitalic]")
setProperty(FontHeight , "Height", "26")
setProperty(FontHeight , "Color", white)
FontHeight = getProperty(MainGUI[5] , "Font")
setProperty(FontHeight , "Height", "18")
setProperty(FontHeight , "Color", white)
FontHeight = getProperty(MainGUI[8] , "Font")
setProperty(FontHeight , "Style", "[fsBold, fsitalic]")
setProperty(FontHeight , "Height", "26")
setProperty(FontHeight , "Color", white)
FontHeight = getProperty(MainGUI[9] , "Font")
setProperty(FontHeight , "Style", "[fsBold]")
setProperty(FontHeight , "Height", "16")
setProperty(FontHeight , "Color", white)
FontHeight = getProperty(MainGUI[10] , "Font")
setProperty(FontHeight , "Height", "18")
FontHeight = getProperty(MainGUI[12] , "Font")
setProperty(FontHeight , "Height", "13")
FontHeight = getProperty(MainGUI[13] , "Font")
setProperty(FontHeight , "Style", "[fsBold, fsitalic]")
setProperty(FontHeight , "Height", "16")
setProperty(FontHeight , "Color", white)
setProperty(MainGUI[13], "Cursor", "-21")
FontHeight = getProperty(MainGUI[14] , "Font")
setProperty(FontHeight , "Height", "18")
setProperty(FontHeight , "Color", white)
FontHeight = getProperty(MainGUI[15] , "Font")
setProperty(FontHeight , "Height", "18")
FontHeight = getProperty(MainGUI[18] , "Font")
setProperty(FontHeight , "Style", "[fsBold]")
setProperty(FontHeight , "Height", "18")
setProperty(FontHeight , "Color", white)
FontHeight = getProperty(MainGUI[19] , "Font")
setProperty(FontHeight , "Height", "18")
setProperty(FontHeight , "Color", white)

-----------------------------------------SIZE + POS -----------------------------------------
control_setSize(MainGUI[1], 425, 512)
x,y = control_getSize(MainGUI[1])
control_setSize(MainGUI[2], x,y)
control_setSize(MainGUI[5], 404, 129)
control_setSize(MainGUI[10], 255, 21)
control_setSize(MainGUI[11], 404, 279)
control_setSize(MainGUI[12], 107, 28)
control_setSize(MainGUI[15], 255, 106)
control_setSize(MainGUI[16], 107, 26)
control_setSize(MainGUI[17], 107, 26)
control_setSize(MainGUI[23], 107, 26)
control_setSize(MainGUI[24], 107, 26)
control_setPosition(MainGUI[4], 15, 10)
control_setPosition(MainGUI[5], 10, 35)
control_setPosition(MainGUI[6], 10, 5)
control_setPosition(MainGUI[8], 15, 175)
control_setPosition(MainGUI[9], 10, 75)
control_setPosition(MainGUI[10], 10, 35)
control_setPosition(MainGUI[11], 10, 205)
control_setPosition(MainGUI[12], 280, 35)
control_setPosition(MainGUI[13], 12, 490)
control_setPosition(MainGUI[14], 10, 5)
control_setPosition(MainGUI[15], 10, 35)
control_setPosition(MainGUI[16], 280, 35)
control_setPosition(MainGUI[17], 280, 76)
control_setPosition(MainGUI[18], 10, 155)
control_setPosition(MainGUI[19], 11, 180)
control_setPosition(MainGUI[23], 280, 116)
control_setPosition(MainGUI[24], 280, 160)



----------------------------------------- CAPTION -----------------------------------------
control_setCaption(MainGUI[1], title.." Trainer")
control_setCaption(MainGUI[4], title.." Trainer")
control_setCaption(MainGUI[6], "Select your browser. Make sure the game is loaded.")
control_setCaption(MainGUI[8],  "Available hacks for this game")
control_setCaption(MainGUI[9], "Attached to PID: waiting...")
control_setCaption(MainGUI[12], "Select")
control_setCaption(MainGUI[13], " facebookhax.net " ..credits)
control_setCaption(MainGUI[14],  "Enable hacks before starting a new game.")
control_setCaption(MainGUI[16], 'Enable selected')
control_setCaption(MainGUI[17], 'Enable all')
control_setCaption(MainGUI[18],"Description:")
control_setCaption(MainGUI[19],"no hack selected")
control_setCaption(MainGUI[23], 'Reset all')
control_setCaption(MainGUI[24], 'Donate')
control_setEnabled(MainGUI[16], false)
control_setEnabled(MainGUI[17], false)
control_setEnabled(MainGUI[23], false)



----------------------------------------- PROGRESSBAR  -----------------------------------------
MainGUI[20] = createProgressBar(MainGUI[11])
control_setPosition(MainGUI[20], 11, 180)
control_setSize(MainGUI[20], 255, 14)
control_setVisible(MainGUI[20], false)
MainGUI[21]  = createLabel(MainGUI[11])
FontHeight = getProperty(MainGUI[21] , "Font")
setProperty(FontHeight , "Style", "[fsBold]")
setProperty(FontHeight , "Height", "18")
setProperty(FontHeight , "Color", white)
control_setPosition(MainGUI[21], 10, 155)
control_setVisible(MainGUI[21], false)
MainGUI[22]  = createLabel(MainGUI[11])
FontHeight = getProperty(MainGUI[22] , "Font")
setProperty(FontHeight , "Style", "[fsBold]")
setProperty(FontHeight , "Height", "18")
control_setPosition(MainGUI[22], 10, 205)
control_setVisible(MainGUI[22], false)

----------------------------------------- COMBOBOX CONTENT -----------------------------------------
setHack_Information()
al = combobox_getItems(MainGUI[10])
strings_clear(al)
strings_add(al, 'Browser list...')
strings_add(al, 'Firefox')
strings_add(al, 'Google Chrome')
strings_add(al, 'Firefox(Unity Game)')
strings_add(al, 'Maxthon')
strings_add(al, 'Internet Explorer')
strings_add(al, 'Internet Explorer Windows XP')
setProperty(MainGUI[10] , "ItemIndex", "0")
all_enabled = 0
success = 1
TeL = listbox_getItems(MainGUI[15])
TempSave = {}
strings_clear(TeL)
check = 0
i = 0
repeat
if t[i+1]==nil then
   check = 1
else
   i = i+1
   strings_add(TeL, t[i][1])
   TempSave[i] = {}
   TempSave[i][1] = t[i][1]
   TempSave[i][2] = t[i][2]
   TempSave[i][3] = t[i][3]
   TempSave[i][4] = 2
   TempSave[i][5] = 0
   check = 0
end
until check == 1

errorOnLookupFailure(false)
alreadycheckedPIDS={}
openNextProcTimer = createTimer(nil,false)
timer_setInterval(openNextProcTimer, 1000)
timer_onTimer(openNextProcTimer,
function(sender)
   local tempPIDtable = getPids()
   if #tempPIDtable == 0 then return end
   timer_setEnabled(sender,false)
   openProcess(tempPIDtable[1])
end)

----------------------------------------- CHECKPROCESS / PIDS -----------------------------------------

function checkProcessMajor()
   reinitializeSymbolhandler()
   if getAddress("pepflashplayer.dll")~=0 or getAddress("AdobeCPGetAPI") ~=0 then
      return true
   end
   return false
end

function getPids()
   local SL=createStringlist()
   getProcesslist(SL)
   local tempPIDtable={}
   for i=0,strings_getCount(SL)-1 do
      local entry = strings_getString(SL,i)
      local processname = entry:sub(10,255)
      local PID = tonumber('0x'..entry:sub(1,8))
      if processname == "chrome.exe" then
         if alreadycheckedPIDS[PID]~=true then
            table.insert(tempPIDtable,PID)
         end
      end
   end
   object_destroy(SL)
   return tempPIDtable
end

function checkProcess(sender)
   timer_setEnabled(sender,false)
   alreadycheckedPIDS[getOpenedProcessID()]=true
   if checkProcessMajor() then
      timer_setEnabled(openNextProcTimer,false)
      alreadycheckedPIDS={}
      enableHacks()
   else
      timer_setEnabled(openNextProcTimer,true)
   end
end

checkProcessTimer = createTimer(nil,false)
timer_setInterval(checkProcessTimer, 100)
timer_onTimer(checkProcessTimer, checkProcess)

function onOpenProcess()
   if success == 1 then return end
   timer_setEnabled(checkProcessTimer,true)
end

----------------------------------------- BROWSER SELECT -----------------------------------------

function scanBrowser()
   AttachItems = combobox_getItems(MainGUI[10])
   AttachIndex = combobox_getItemIndex(MainGUI[10])
   control_setEnabled(MainGUI[16], false)
   control_setEnabled(MainGUI[17], false)

   local font = getProperty(MainGUI[9] , "Font")
   setProperty(font, "Color", white)
   control_setCaption(MainGUI[9], "Attached to PID: " .. "Scanning Process, Please wait...")
   processMessages()
   if AttachIndex == -1 then return end
   if AttachIndex == 0 then
      control_setCaption(MainGUI[9], "Attached to PID: " .. "no Browser selected.")
      return
   end
   local check = strings_getString(AttachItems,AttachIndex)
   if check == 'Google Chrome' then
      success = 0
      local test = openProcess("chrome.exe")
      if test == nil then
         setProperty(font , "Color", orange1)
         control_setCaption(MainGUI[9], "Attached to PID: " .. "Chrome not found.")
         timer_setEnabled(openNextProcTimer,false)
         return
      end
      strings_add(getAutoAttachList(),"chrome.exe")
      timer_setEnabled(openNextProcTimer,true)
      return
   end

   if check == 'Firefox' or check == 'Internet Explorer' or check == 'SeaMonkey Windows 7' then openProcess("FlashPlayerPlugin") end
      errorOnLookupFailure(false)
      reinitializeSymbolhandler()
      err=getAddress("kernel32.dll")==0
   if err==true then
      setProperty(font , "Color", green)
      control_setCaption(MainGUI[9], "Attached to PID: " .. "Flash player plugin not found")
   else
      local PID=getOpenedProcessID()
      setProperty(font, "Color", green)
      control_setCaption(MainGUI[9], "Attached to PID: " .. PID .. " - flash player plugin")
      control_setEnabled(MainGUI[16], true)
      control_setEnabled(MainGUI[17], true)
   end

      if check == 'Firefox(Unity Game)' or check == 'Internet Explorer Windows XP' or check == 'SeaMonkey Windows XP' then openProcess("plugin-container.exe") end
      errorOnLookupFailure(false)
      reinitializeSymbolhandler()
      err=getAddress("kernel32.dll")==0
   if err==true then
      setProperty(font , "Color", red)
      control_setCaption(MainGUI[9], "Attached to PID: " .. "Flash player plugin not found")
   else
      local PID=getOpenedProcessID()
      setProperty(font, "Color", green)
      control_setCaption(MainGUI[9], "Attached to PID: " .. PID .. " - flash player plugin")
      control_setEnabled(MainGUI[16], true)
      control_setEnabled(MainGUI[17], true)
   end



      local check = strings_getString(AttachItems,AttachIndex)
   if check == 'Maxthon' then
      success = 0
      local test = openProcess("Maxthon.exe")
      if test == nil then
         setProperty(font , "Color", red1)
         control_setCaption(MainGUI[9], "Attached to PID: " .. "Maxthon not found.")
         timer_setEnabled(openNextProcTimer,false)
         return
      end
      strings_add(getAutoAttachList(),"Maxthon.exe")
      timer_setEnabled(openNextProcTimer,true)
      return
   end
end


local function browser(text, key)
   return text:gsub("%a", function(t)
         local base = (t:lower() == t and string.byte('a') or string.byte('A'))

         local r = t:byte() - base
         r = r + key
         r = r%26 -- works correctly even if r is negative
         r = r + base
         return string.char(r)
      end)
end

local function PIDD(text, key)
   return browser(text, -key)
end

Scanning = {
   browser = browser,
   PIDD = PIDD,
}




















































----------------------------------------- ENABLE HACKS -----------------------------------------
function enableHacks()
   setProperty(getProperty(MainGUI[9] , "Font"), "Color", white)
   local PID=getOpenedProcessID()
   local check = strings_getString(AttachItems,AttachIndex)
   if check == 'Firefox' or check == 'Internet Explorer' then
      control_setCaption(MainGUI[9], "Attached to PID: " .. PID .. " - flash player plugin")
                local font = getProperty(MainGUI[9] , "Font")
   setProperty(font, "Color", green)

   elseif check == 'Google Chrome' then
      control_setCaption(MainGUI[9], "Attached to PID: " .. PID .. " - chrome.exe")
            local font = getProperty(MainGUI[9] , "Font")
   setProperty(font, "Color", green)

   elseif check == 'Maxthon' then
      control_setCaption(MainGUI[9], "Attached to PID: " .. PID .. " - Maxthon.exe")
            local font = getProperty(MainGUI[9] , "Font")
   setProperty(font, "Color", green)

elseif check == 'SeaMonkey' then
      control_setCaption(MainGUI[9], "Attached to PID: " .. PID .. " - SeaMonkey")
            local font = getProperty(MainGUI[9] , "Font")
   setProperty(font, "Color", green)


end
   success = 1
    control_setEnabled(MainGUI[16], true)
    control_setEnabled(MainGUI[17], true)

end

----------------------------------------- PROGRESS BAR -----------------------------------------
function show_progressbar()
     control_setPosition(MainGUI[22], 10, 205)
     control_setCaption(MainGUI[22], '')
     control_setVisible(MainGUI[18], false)
     control_setVisible(MainGUI[19], false)
     control_setVisible(MainGUI[20], true)
     control_setVisible(MainGUI[21], true)
     control_setVisible(MainGUI[22], true)
     progressbar_setPosition(MainGUI[20], 0)
end

function hide_progressbar()
    control_setVisible(MainGUI[20], false)
    control_setVisible(MainGUI[21], false)
    control_setVisible(MainGUI[22], false)
    control_setVisible(MainGUI[18], true)
    control_setVisible(MainGUI[19], true)
end

----------------------------------------- EXECUTE HACKS -----------------------------------------
function ExecuteHacks()
    HLS = listbox_getItemIndex(MainGUI[15])
    LIST = listbox_getItems(MainGUI[15])
    if HLS == -1 then return end
    i = HLS+1
    font=getProperty(MainGUI[21], 'Font')
    control_setVisible(MainGUI[18], false)
    control_setVisible(MainGUI[19], false)
    control_setVisible(MainGUI[20], false)
    control_setVisible(MainGUI[21], true)
    control_setVisible(MainGUI[22], false)
    if t[i][2]==nil then
         setProperty(font, 'Color', white)
         control_setCaption(MainGUI[21], "You already enabled this hack !")
         return
    end
    control_setEnabled(MainGUI[16], false)
    control_setEnabled(MainGUI[17], false)

    control_setCaption(MainGUI[21], "Executing hack...")
    control_setVisible(MainGUI[22], true)
    control_setCaption(MainGUI[22], '')
    control_setPosition(MainGUI[22], 10, 250)
    strings_setString(LIST, HLS, t[i][1])
    processMessages()
    if TempSave[i][4] == 2 then
      Asm = autoAssemble(t[i][2])
      font=getProperty(MainGUI[22], 'Font')
      control_setCaption(MainGUI[21], "Executing hack. Finished.")
      unpause()
      if scanCheck~=true then
        TempText = t[i][1]..' - Failed'
        TempSave[i][5] = t[i][1]..' - Failed'
        strings_setString(LIST, HLS, TempText)
        setProperty(font, 'Color', red1)
        control_setCaption(MainGUI[22], 'Failed to enable ')
 else
        TempText = t[i][1]..' - Enabled'
        TempSave[i][5] = t[i][1]..' - Enabled'
        strings_setString(LIST, HLS, TempText)
        setProperty(font, 'Color', green)
        control_setCaption(MainGUI[22], 'Hack enabled. Enjoy it !')
t[i][2] = nil
        TempSave[i][4] = 1
      end
    end
    if TempSave[i][4] == 0 then TempSave[i][4] = 2 end
    control_setEnabled(MainGUI[16], true)
    control_setEnabled(MainGUI[17], true)

end

----------------------------------------- EXECUTE ALL HACKS  -----------------------------------------
function ExecuteAllHacks()
     font=getProperty(MainGUI[21], 'Font')
     if all_enabled == 1 then
        control_setVisible(MainGUI[18], false)
        control_setVisible(MainGUI[19], false)
        control_setVisible(MainGUI[20], false)
        control_setVisible(MainGUI[21], true)
        control_setVisible(MainGUI[22], false)
        setProperty(font, 'Color', white)
        control_setCaption(MainGUI[21], "You allready enabled all hacks !")
        return
     end
     lb = listbox_getItems(MainGUI[15])
     LIST = listbox_getItems(MainGUI[15])
     control_setEnabled(MainGUI[16], false)
     control_setEnabled(MainGUI[17], false)
     control_setEnabled(MainGUI[23], false)
     show_progressbar()
     progressbar_setMax(MainGUI[20], strings_getCount(lb))
     for i = 1, strings_getCount(lb) do
         strings_setString(LIST, i-1, t[i][1])
     end
    count = 0
     for i = 1, strings_getCount(lb) do
          control_setCaption(MainGUI[21], "Executing hack: "..t[i][1])
          progressbar_setPosition(MainGUI[20], i)
          processMessages()
        if TempSave[i][4] == 2 then
              Asm = autoAssemble(t[i][2])
            if scanCheck~=true then
                    TempSave[i][5] = t[i][1]..' - Failed'
                    strings_setString(LIST, i-1, TempSave[i][5])
             else
                   TempSave[i][5] = t[i][1]..' - Enabled'
                    strings_setString(LIST, i-1, TempSave[i][5])
                   t[i][2] = nil
               TempSave[i][4] = 1
               count = count + 1
             end
         else
              count = count + 1
                 TempSave[i][5] = t[i][1]..' - Enabled'
                 strings_setString(LIST, i-1, TempSave[i][5])
         end
      if TempSave[i][4] == 0 then TempSave[i][4] = 2 end
   end
    control_setEnabled(MainGUI[16], true)
    control_setEnabled(MainGUI[17], true)
    control_setEnabled(MainGUI[23], true)
    control_setCaption(MainGUI[21], "Executing hack. Finished ! ")
    font=getProperty(MainGUI[22], 'Font')
   if count == strings_getCount(lb) then
      setProperty(font, 'Color', white)
        control_setCaption(MainGUI[22], 'All hacks enabled. Enjoy it !')
        all_enabled = 1
   else
      diff = strings_getCount(lb) - count
        if diff == 1 then
           text = "hack"
        else
           text = "hacks"
        end
        setProperty(font, 'Color', red1)
       control_setCaption(MainGUI[22], 'Failed to enable ' .. diff .. ' ' .. text .. ' !')
   end
end

----------------------------------------- RESET HACKS  -----------------------------------------
function ResetAllHacks()
     lb = listbox_getItems(MainGUI[15])
     ct = strings_getCount(lb)
     for i = 1, ct do
         strings_setString(lb, i-1, t[i][1])
         TempSave[i][4] = 2
         t[i][2]= TempSave[i][2]
     end
     all_enabled = 0
     hide_progressbar()
     control_setVisible(MainGUI[19], false)
     control_setCaption(MainGUI[18], 'All hacks reseted.')
end
----------------------------------------- AOB SWAP -----------------------------------------
function DEC_HEX(IN)
   local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
    if IN<1 then
      OUT=0
      return OUT
   end
   while IN>0 do
      I=I+1
      IN,D=math.floor(IN/B),math.fmod(IN,B)+1
      OUT=string.sub(K,D,D)..OUT
   end
   return OUT
end

function scan(enter, exit)
pretemp1 =Scanning.PIDD(enter,12)
pretemp2 =Scanning.PIDD(exit,12)
temp1 = bdc(pretemp1)
temp2 = bdc(pretemp2)
temp3 = Scanning.PIDD(temp1,12)
temp4 = Scanning.PIDD(temp2,12)
search = bdc(temp3)
change = bdc(temp4)
     aobs = AOBScan(search, "+W")
     if(aobs == nil) then
      scanCheck=false
    else
       j = stringlist_getCount(aobs)
      for i = 1, j do
          address=stringlist_getString(aobs,i-1)
          for i = 1, string.len(change), 3 do
             z = string.sub(change, i, i+2)
             x, y = string.find(z, "%?+")
              if (x == nil) then
                script=[[
                ]]..address.."+"..(DEC_HEX((i-1)/3))..[[:
                db ]]..z..[[
                ]]
                autoAssemble(script)
             end
          end
       end
      object_destroy(aobs);
      aobs=nil
      scanCheck=true
   end
end

----------------------------------------- HACK DESCRIPTION -----------------------------------------
function HackDescriptionsChange()
    hide_progressbar()
    control_setCaption(MainGUI[18], 'Description:')
    HLS = listbox_getItemIndex(MainGUI[15])
    if HLS == -1 then return end
    i = HLS+1
    if t[i][3]~='' and t[i][3]~=nil then
      control_setCaption(MainGUI[19] ,t[i][3])
    else
      control_setCaption(MainGUI[19], "no description available.")
    end
end
---------------------------------------- KONGHACK / EXIT -----------------------------------------
function OpenKonghack()
   shellExecute(" ")
end

function Donate()
shellExecute(" ")
end

function CloseTrainer()
   form_hide(MainGUI[1])
   closeCE()
end

----------------------------------------- ONCLICK EVENTS  -----------------------------------------
control_onClick(MainGUI[12], scanBrowser)
control_onClick(MainGUI[13], OpenKonghack)
control_onClick(MainGUI[16], ExecuteHacks)
control_onClick(MainGUI[17], ExecuteAllHacks)
control_onClick(MainGUI[23], ResetAllHacks)
control_onClick(MainGUI[24], Donate)
setMethodProperty(MainGUI[15], 'OnSelectionChange', HackDescriptionsChange)
form_onClose(MainGUI[1], CloseTrainer)
form_show(MainGUI[1])

_________________
dved rvrdv vrevr rvrve
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 Lua Scripting 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