Beispiel #1
0
 public ProcessInformation(ProcessWrapper p)
 {
     active = p;
     InitializeComponent();
     lvInfo.Items.Add(new ListViewItem(new string[] { "Name", p.Process.ProcessName }));
     lvInfo.Items.Add(new ListViewItem(new string[] { "PID", p.Process.Id.ToString() }));
     lvInfo.Items.Add(new ListViewItem(new string[] { "Handle", p.Process.Handle.ToString() }));
     lvInfo.Items.Add(new ListViewItem(new string[] { "Title", p.Process.MainWindowTitle }));
     lvInfo.Items.Add(new ListViewItem(new string[] { "Threads", p.Process.Threads.Count.ToString() }));
     lvInfo.Items.Add(new ListViewItem(new string[] { "Memory", (p.Process.WorkingSet64 / 1000).ToString() + "KB" }));
 }
Beispiel #2
0
 private void bInject_Click(object sender, EventArgs e)
 {
     if (!openNew)
     {
         if (activeProcess != null)
         {
             var res = i.inject(activeProcess.Process.Id, tbDllResult.Text);
             if (res.ErrorCode == 0)
             {
                 activeProcess.InjectedList.Add(res);
                 updateSelected();
             }
             else
             {
                 msg("Injection failed");
             }
         }
         else
         {
             msg("No process selected");
         }
     }
     else
     {
         if (File.Exists(activeExe))
         {
             if (File.Exists(tbDllResult.Text))
             {
                 try
                 {
                     DLLInformation dll = i.inject(activeExe, tbDllResult.Text);
                     if (dll.ErrorCode == 0)
                     {
                         activeProcess = new ProcessWrapper(Process.GetProcessById(dll.ProcID));
                         activeProcess.InjectedList.Add(dll);
                         openNew = false;
                         updateSelected();
                     }
                     else
                     {
                         msg("Injection failed");
                     }
                 }
                 catch
                 {
                     msg("Injection failed");
                 }
             }
             else
             {
                 msg("No DLL found to inject");
             }
         }
         else
         {
             msg("No executable to launch");
         }
     }
 }
Beispiel #3
0
        private void refreshProcessList()
        {
            lbProcesses.Items.Clear();
            Process[] procs = Process.GetProcesses();
            lProcs.Clear();

            foreach (Process p in procs)
            {
                ProcessWrapper w = new ProcessWrapper(p);
                Icon ico = null;
                if (!il.Images.ContainsKey(p.Id.ToString()))
                {
                    try
                    {
                        ico = Icon.ExtractAssociatedIcon(p.MainModule.FileName);
                        Bitmap bm = new Bitmap(ico.Width, ico.Height);
                        using (Graphics g = Graphics.FromImage(bm))
                        {
                            g.DrawIcon(ico, 0, 0);
                        }
                        il.Images.Add(p.MainModule.FileName, bm);
                    }
                    catch
                    {

                    }
                }
                lProcs.Add(p.Id.ToString(), w);
            }
            lbProcesses.SmallImageList = il;

            foreach (var q in lProcs)
            {
                ProcessWrapper w = q.Value;
                try
                {
                    lbProcesses.Items.Add(new ListViewItem(new string[] { w.Process.ProcessName, w.Process.Id.ToString() }, w.Process.MainModule.FileName));
                }
                catch
                {
                    lbProcesses.Items.Add(new ListViewItem(new string[] { w.Process.ProcessName, w.Process.Id.ToString() }));
                }

            }
        }
Beispiel #4
0
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lbProcesses.SelectedItems.Count > 0)
     {
         activeProcess = lProcs[lbProcesses.SelectedItems[0].SubItems[1].Text];
         openNew = false;
         updateSelected();
     }
 }
Beispiel #5
0
 private void bShowProcInfo_Click(object sender, EventArgs e)
 {
     if (activeProcess != null)
     {
         if (!activeProcess.Process.HasExited)
         {
             new ProcessInformation(activeProcess).ShowDialog();
         }
         else
         {
             msg("Process has exited, can't display process information");
             activeProcess = null;
         }
     }
     else
     {
         msg("No process selected");
     }
 }
Beispiel #6
0
 private void bSelectPID_Click(object sender, EventArgs e)
 {
     int pid;
     if (int.TryParse(tbPID.Text, out pid))
     {
         try
         {
             activeProcess = new ProcessWrapper(Process.GetProcessById(pid));
             openNew = false;
             updateSelected();
         }
         catch
         {
             msg("No process found with this PID");
         }
     }
     else
     {
         msg("PID has to be a number");
     }
 }