-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprocess_explorer.cs
More file actions
47 lines (40 loc) · 1.48 KB
/
process_explorer.cs
File metadata and controls
47 lines (40 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Reflection;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
public class Program
{
public static void Main()
{
Console.WriteLine("Listing all processes...");
Console.WriteLine("--------------------------------------------------------------------");
Process[] procs = Process.GetProcesses();
foreach (Process proc in procs)
{
try
{
Console.WriteLine("Name:" + proc.ProcessName + " Path:" + proc.MainModule.FileName + " Id:" + proc.Id);
}
catch
{
continue;
}
}
Console.WriteLine("--------------------------------------------------------------------\n");
Console.WriteLine("Enter Id to inspect:");
int val;
val = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(val);
Process pickedproc = Process.GetProcessById(val);
ProcessModule myProcessModule;
ProcessModuleCollection myProcessModuleCollection = pickedproc.Modules;
Console.WriteLine("Loaded Modules by " + pickedproc.MainModule.FileName);
Console.WriteLine("--------------------------------------------------------------------\n");
for (int i = 0; i < myProcessModuleCollection.Count; i++)
{
myProcessModule = myProcessModuleCollection[i];
Console.WriteLine(myProcessModule.FileName);
}
}
}