Foro de elhacker.net

Programación => Programación General => Mensaje iniciado por: aoBKnbX95S en 18 Septiembre 2014, 22:05 pm



Título: Alguien que me ayude a Ordenar este Código?
Publicado por: aoBKnbX95S en 18 Septiembre 2014, 22:05 pm
Hola, tengo este código (LUA script cheat engine)... es un Process List para seleccionar navegadores. Soy principiante en el tema, necesito que alguien me ayude a Organizarlo.

Gracias de antemano. :)

Código
  1. function CEButton1Click(sender)
  2. SmartAttach =.. {..  wanted_processes = { 'chrome.exe','plugin%-container.exe',..                       'flashplayerplugin','dragon.exe' }..                       ,..  currentprocesslist = {}.. }....function SmartAttach:Start(  )..self.form  =  createForm( true )..  setProperty( self.form ,  "Position",  "" )..  setProperty( self.form ,  "BiDiMode",  "bdLeftToRight" )..  self.form.Caption  =  'Process List'..  self.form.height  =  46..  self.form.width  =  463..  self.combobox  =  createComboBox( self.form )..  self.combobox.top  =  10..  self.combobox.left  =  10..  self.combobox.width  =  213..  self.combobox.ReadOnly  =  true..  self.button  =  createButton( self.form )..  self.button.Caption  =  'Enable'..  self.button.top  =  10..  self.button.left  =  240..  self.button.onClick  =  function ( sender ) self:Attach( sender )end......  self.button.width  =  95..  self.pickhighestmem  =  createButton( self.form )..  self.pickhighestmem.Caption  =  'Refresh Process '..  self.pickhighestmem.top  =  10..  self.pickhighestmem.left  =  353..  self.pickhighestmem.width  =  100..  self.pickhighestmem.onClick  =  function ( sender ) self:RefreshList( sender ) end..  self.form.show()..  SmartAttach:RefreshList()..end......function SmartAttach.SortByKey(T,K,reverse)..  if reverse==true then table.sort(T, function (a,b) return a[K] > b[K] end)..                   else table.sort(T, function (a,b) return a[K] < b[K] end) end..  return T..end....function SmartAttach.ProcessMatch(s)..  for _,v in pairs(SmartAttach.wanted_processes) do..    if s:match(v:lower()) then return true end..  end..  return false..end....function SmartAttach.gatherData()..  local handle  =  io.popen( "tasklist.exe /fo csv" )..  local processTable = {}..  local skip = true..  local tmp = nil..  for line in handle:lines() do..    if skip then skip = false..    else..      tmp = {}..      for t in line:gmatch('\"(.-)\"') do..       table.insert(tmp,t)..      end..      local processName = tmp[1]..      if SmartAttach.ProcessMatch(processName:lower()) then..        local PID         = tmp[2]..      --local Session     = tmp[3]..      --local SessionNum  = tmp[4]..        local MemoryUsage = tmp[5]:gsub("[^%d]",'')+0  -- +0 converts to number....        local entry = { processName=processName, PID=PID, MemoryUsage=MemoryUsage }..        processTable[#processTable+1] = entry..      end..    end..  end..  handle:close()..  return SmartAttach.SortByKey(processTable,'MemoryUsage',true)..end....function SmartAttach.RefreshList()..  local items = SmartAttach.combobox.items..  items.clear()..  SmartAttach.currentprocesslist = SmartAttach.gatherData()..  if ( #SmartAttach.currentprocesslist > 0 ) then..    for _,v in ipairs( SmartAttach.currentprocesslist ) do..      strings_add(items, string.format('%.1f',v.MemoryUsage/1024)..'MB'..' - '..v.processName)..    end..  SmartAttach.combobox.ItemIndex  =  0..  else..    return showMessage( "No Browser in the process" )..  end..end....function SmartAttach:Attach(sender)..  local index = SmartAttach.combobox.ItemIndex..  if index < 0 then return end..  openProcess( tonumber(SmartAttach.currentprocesslist[index + 1].PID) )..end....SmartAttach:Start()..end



[MOD]: Utiliza el botón de "Insertar Código"


Título: Re: Alguien que me ayude a Ordenar este Código?
Publicado por: Eleкtro en 18 Septiembre 2014, 22:11 pm
¿Por "Organizarlo" te refieres a indentarlo, estructurarlo, simplificarlo?, lo primero sería una petición muy vaga.

Postea el código bien, porfavor, es ilegible.

Saludos!


Título: Re: Alguien que me ayude a Ordenar este Código?
Publicado por: engel lex en 18 Septiembre 2014, 22:22 pm
está bien escrito el codigo? no conozco lua, pero veo muchos puntos flotando por ahí...


Título: Re: Alguien que me ayude a Ordenar este Código?
Publicado por: Eleкtro en 18 Septiembre 2014, 23:29 pm
veo muchos puntos flotando por ahí...

Yo tampoco manejo LUA pero es bastante confusa/imperfecta la sintaxis de este lenguaje, 2 puntos es el operador para concatenar Strings (que no instrucciones), 3 puntos es para otra cosa, y 1 punto para otra diferente.

> http://www.lua.org/work/doc/manual.html#3.1

Saludos


Título: Re: Alguien que me ayude a Ordenar este Código?
Publicado por: engel lex en 18 Septiembre 2014, 23:36 pm
Yo tampoco manejo LUA pero es bastante confusa/imperfecta la sintaxis de este lenguaje, 2 puntos es el operador para concatenar Strings (que no instrucciones), 3 puntos es para otra cosa, y 1 punto para otra diferente.

> http://www.lua.org/work/doc/manual.html#3.1

Saludos

wow, que loco

en un punto hay hasta 6 puntos juntos...