OppaiCyber

fixed_attach_xc

Sep 14th, 2020
621
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function ProcessMemory(pro)
  2. f = createForm() f.setSize(300, 150) f.Caption = "Sorted Process List"
  3. setProperty(f, "BiDiMode", "bdLeftToRight")
  4. f.Color = 0xFF0000 f.Position = poDesktopCenter
  5. list = createListBox(f) x, y = f.getSize() list.setSize(x - 10, y - 50) list.setPosition(5, 45) list.OptimalFill = true list.color = 0x00FFFF
  6. list.Font.Style = "fsBold"
  7. local lx1 = createLabel(f)
  8. lx1.AutoSize = false
  9. lx1.Height = 41
  10. lx1.Left = 15
  11. lx1.Top = 1
  12. lx1.Width = 270
  13. lx1.Font.Size = 10 lx1.Font.Color = 0xFFFFFF lx1.OptimalFill = true lx1.Font.Style = "fsBold"
  14. lx1.Alignment = "taCenter"
  15. lx1.caption = 'Double-click the selection to confirm.\nOnaylamak için, seçimi çift tıklayın.\nPID:   -     Process:    -     Memory:                                 '
  16.  
  17. function filterprocess()
  18. local pro = pro..
  19. ".exe"
  20. if pro == ""
  21. or pro == nil then
  22. return nil end
  23.  
  24. local tasklist = io.popen "tasklist /fo csv /nh"
  25. local plist = {}
  26. local proc_item
  27. list.clear()
  28.  
  29. for line in tasklist: lines() do
  30.         local exe, pid, mem = line: match '^"(.-)","(%d+)",.-"([^"]+)"$'
  31.     table.insert(plist, {
  32.         pid = tonumber(pid),
  33.         exe = exe,
  34.         mem = tonumber((mem: gsub("%D", "")))
  35.     })
  36. end
  37.  
  38. tasklist: close()
  39. table.sort(plist, function(a, b) return a.mem > b.mem end)
  40. for j = 1, math.min(120, #plist) do
  41.     if plist[j].exe == pro then
  42. proc_item = string.format(plist[j].pid..
  43.     ' - '..plist[j].exe..
  44.     ' - '..plist[j].mem..
  45.     ' Kb')
  46. list.Items.Add(proc_item)
  47. end
  48. end
  49. end
  50.  
  51. function attaching(name)
  52. local a = list.ItemIndex
  53. local pro1 = list.Items[a]
  54. print(pro1)
  55.     pid, mem = pro: match("(.*) -- "..name..
  56.         " - (.*) Kb")
  57. local pid = pro1: match('%d+');
  58. pid = tonumber(pid)
  59. print(pid..
  60.     " - "..name)
  61. if pid then
  62. openProcess(pid)
  63. sleep(200)
  64. f.Close()
  65. end
  66. end
  67.  
  68. filterprocess()
  69. list.onDblClick = function() attaching(pro..
  70.     ".exe") end
  71. end
  72.  
  73. ProcessMemory("chrome")
RAW Paste Data