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 


auto attach flash process in CHROME

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

Joined: 20 Apr 2015
Posts: 4

PostPosted: Mon Apr 20, 2015 4:25 pm    Post subject: auto attach flash process in CHROME Reply with quote

So I have made several standalone trainers that have worked fine and I update the AoBs for hacks as they change and whatnot.

However FireFox seems to have more lag issues for some users than Chrome does.

I have used FireFox for quite a while now because of the plugin support and I just like the layout better, not to mention ease of hacking flash games with firefox.


So I need help with automatically attaching the trainer to the correct chrome process for flash so I can make a standalone trainer for Chrome that works like my standalone trainer for FireFox.


With firefox I use the following within my button click functions to attach to flash:

Code:
openProcess("FlashPlayerPlugin")

I do that within the button click functions so if the browser is refreshed, you don't need to re-open the trainer to reattach the process.

How do I do this with the Chrome browser?

Edit: haenawolf from konghack answered my question.

Just thought I would share the info he provided here for future reference to others.

Code:

function pidDialog(doPid,autoSelectFirst,pn,dn)

  autoSelectFirst = autoSelectFirst or false
--  print(type(autoSelectFirst))
  local plugname = type(pn)=='table' and pn or {"iexplore","flashplayerplugin","plugin-container","opera","chrome","awesomium_process","torch","dragon","maxthon","palemoon","safari" }
  local dllname  = type(dn)=='table' and dn or {"flash","unity" }
  if type(pn)=='string' then table.insert(plugname,pn) end
  if type(dn)=='string' then table.insert(dllname,dn) end
  local indexOf = function(s,m) for i=1,#m do if string.find(string.lower(s),string.lower(m[i]),1,true) then return i end end end -- cave insensitive find
  local function tmerge(t,o,...) for k,v in pairs(o) do t[k]=v end if select('#',...)>0 then return tmerge(t,...) else return t end end
  local function callLater(f,...)
    local a,n = {...},select('#',...)
    local t = tmerge(createTimer(),{Interval=1,Enabled=true,OnTimer=function(sender) sender.Enabled=false sender.Destroy() f(unpack(a,1,n)) end})
    return t
  end
  local function parseProc(i,s)
    local dll=' ... '
    for pid,name in string.gmatch(s,'([0-9A-F]+)-(.*)') do
      local weight,pid = 0,tonumber(pid,16)
      for _,v in ipairs(plugname) do
        if indexOf(name,plugname) then
          weight = weight + 1
          local m = enumModules(pid)
          for i=1,#m do
            local ix = indexOf(m[i].Name,dllname)
            if ix then
              weight = weight + 1
              dll = dllname[ix]
              break
            end
          end
          break
        end
      end
      return {pid=pid,desc=string.format('%5d %04X <%5s> %s',pid,pid,string.sub(dll.."     ",1,5):upper(),name),name=name,w=weight+i/2048,dll=dll}
    end
  end

  local FP = createForm(false)
  tmerge(FP,{FormStyle='fsStayOnTop',AutoSize=true,BorderWidth=4,Color=0x80,Position='poScreenCenter',BorderStyle='bsToolWindow',Caption='Double Click to Select'})
  local LB = createListBox(FP)
  tmerge(LB,{MultiSelect=false,AutoSize=true,Color=0x80})
  local cs = LB.Constraints
  tmerge(cs,{MinHeight=300,MinWidth=400})
  local fn = LB.Font
  tmerge(fn,{Color=0xffffff,Name='Courier New',Height=-12,Style='[bsBold]'})

  LB.OnDblClick = function()
    local idx,PID,NAME = LB.ItemIndex,nil,''
    if idx >= 0 then
      DESC = LB.Items[idx]
      for pid,pID,name in string.gmatch(DESC,"([0-9]+) ([0-9A-F]+) <.-> (.*)") do

        PID = tonumber(pid,10)
        NAME = name
      end
    end
--    print(tostring(PID))
    if PID ~= nil then callLater(doPid,PID,NAME,DESC) end
    FP.close()
  end -- LB.OnDblClick

  FP.OnClose = function()  FP.destroy(); FP = nil end

  getProcesslist(LB.Items)
  local plist = {}
  for i=1,LB.Items.getCount() do
    table.insert(plist,parseProc(i,LB.Items[i-1]))
  end

  table.sort(plist,function(a,b) return a.w > b.w end)
  local currProcId = getOpenedProcessID()
  for i=1,LB.Items.getCount() do
    LB.Items.setString(i-1,plist[i].desc)
    if plist[i].pid == currProcId then LB.setItemIndex(i-1) end
--    if i < 6 and type(autoSelectFirst)=='string' then print(plist[i].dll,indexOf(plist[i].dll,{autoSelectFirst}) or 'NIL') end
    if i==1 and autoSelectFirst == true or type(autoSelectFirst)=='string' and indexOf(plist[i].dll,{autoSelectFirst}) ~=nil then
      LB.setItemIndex(i-1) LB.OnDblClick() return
    end
  end

  FP.show()
end
-- usage:

--pidDialog(print)

--pidDialog(openProcess)

--pidDialog(function(pid,name) print(string.format('%04X-%s',pid,name)) end)


The following is my trainer button to call the function
Code:

--select and attach flash process
function CEButtonClickFirstClick(sender)
pidDialog(function(pid,name)
           openProcess(pid)
           showMessage(string.format('%s %04X-%s %s',"Process:",pid,name,'attached successfully!'))
           end,'flash')
end



By the way: this seems to work for MOST browsers, not just chrome! Smile
Back to top
View user's profile Send private message
tomtinhte
How do I cheat?
Reputation: 0

Joined: 27 Aug 2014
Posts: 8

PostPosted: Wed Apr 22, 2015 5:24 am    Post subject: Reply with quote

and if chrome. maybe is?
Code:

function CEButton1Click(sender)
pidDialog(function(pid,name)
           openProcess(pid)
           showMessage(string.format('%s %04X-%s %s',"Process:",pid,name,'attached successfully!'))
           end,'chrome.exe')
end
Back to top
View user's profile Send private message Yahoo Messenger
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 941

PostPosted: Wed Apr 22, 2015 6:00 am    Post subject: Reply with quote

Code:
pidDialog(doPid,autoSelectFirst,pn,dn)
---
doPid(pid,name,desc) - function to execute when the process is selected.
autoSelectFirst - type boolean or string
 -- if boolean = true, select the 1st (highest weight) process from the list without display the process list box, even the process name is not in plugname or dllname, it may select svchost.exe if it is the 1st process enumerated;
 -- if string, and is one of string inside dllname, it will not show the popup and return the 1st process with match *.dll from enumModule if possible. If such string is not found, the popup will still show;
 -- in case not to select 1st process but manual select from popup, but also want to change the default plugname, dllname, set this as false or nil;
 -- *this auto-select function may be more unreliable and lower performance as more process there(eg. user playing multiple unity instance of a game in different browser)
pn,dn -- these to modify the default plugname and dllname. If the respective type is table, the corresponding table is replaced ; if the type is string, the string is added to the table


eg.1
suppose cowon broswer or whatever has part of the module name as 'cowon', this added the weight of the cowon process in the list.

Code:
pidDialog(function(pid,...) end, false,'cowon')


eg.2 suppose there are 2 button to auto select 'chrome' unity and 'firefox' flash plugins, their respective call can be:
Code:

chrom-unity:
pidDialog(function(pid,...) end, 'unity',{'chrome'})  -- last is a table, so enumModule run on chrome process only, should be better performance
firefox-flash:
pidDialog(function(pid,...) end, 'flash',{"flashplayerplugin","plugin-container"})


for auto select some known *.exe,
Code:
pidDialog(function(pid,...) end, true,{"GxmOfWxrs.exe"}

... but it may be better use ce auto Attach function: getAutoAttachList().add("GxmOfWxrs.exe") at the beginning of the lua script


-------- BUG : the dll check is inside an unnecessary for loop
Code:


  local function parseProc(i,s)
    local dll=' ... '
    for pid,name in string.gmatch(s,'([0-9A-F]+)-(.*)') do
      local weight,pid = 0,tonumber(pid,16)
--      for _,v in ipairs(plugname) do   -- ====== remove or comment
        if indexOf(name,plugname) then
          weight = weight + 1
          local m = enumModules(pid)
          for i=1,#m do
            local ix = indexOf(m[i].Name,dllname)
            if ix then
              weight = weight + 1
              dll = dllname[ix]
              break
            end
          end
--          break  -- =======
--        end       -- ======= remove or comment
      end
      return {pid=pid,desc=string.format('%5d %04X <%5s> %s',pid,pid,string.sub(dll.."     ",1,5):upper(),name),name=name,w=weight+i/2048,dll=dll}
    end
  end
Back to top
View user's profile Send private message
Remember
How do I cheat?
Reputation: 0

Joined: 03 Apr 2015
Posts: 4

PostPosted: Sun May 24, 2015 4:20 pm    Post subject: Reply with quote

h ttp://postimg.org/image/4phewxy89/


how close the process in task manager please
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