-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathprocinfo.cs
59 lines (53 loc) · 2.74 KB
/
procinfo.cs
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
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Diagnostics;
class Program
{
static void Main(string[] args)
{
if (args.Length != 1 || !int.TryParse(args[0], out int processId))
{
Console.WriteLine("Usage: procinfo.exe <pid>");
return;
}
try
{
Process process = Process.GetProcessById(processId);
if (process != null && !process.HasExited)
{
string filePath = process.MainModule.FileName;
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(filePath);
Console.WriteLine("Name: " + fileVersionInfo.OriginalFilename);
Console.WriteLine("Description: " + fileVersionInfo.FileDescription);
Console.WriteLine("Path: " + filePath);
Console.WriteLine("Product Name: " + fileVersionInfo.ProductName);
Console.WriteLine("File Version: " + fileVersionInfo.FileVersion);
Console.WriteLine("Internal Name: " + fileVersionInfo.InternalName);
Console.WriteLine("Company Name: " + fileVersionInfo.CompanyName);
Console.WriteLine("Comments: " + fileVersionInfo.Comments);
Console.WriteLine("Legal Copyright: " + fileVersionInfo.LegalCopyright);
Console.WriteLine("Legal Trademarks: " + fileVersionInfo.LegalTrademarks);
Console.WriteLine("Product Version: " + fileVersionInfo.ProductVersion);
Console.WriteLine("Private Build: " + fileVersionInfo.PrivateBuild);
Console.WriteLine("Special Build: " + fileVersionInfo.SpecialBuild);
Console.WriteLine("IsDebug: " + fileVersionInfo.IsDebug);
Console.WriteLine("IsPatched: " + fileVersionInfo.IsPatched);
Console.WriteLine("IsPre Release: " + fileVersionInfo.IsPreRelease);
Console.WriteLine("IsPrivate Build: " + fileVersionInfo.IsPrivateBuild);
Console.WriteLine("IsSpecial Build: " + fileVersionInfo.IsSpecialBuild);
Console.WriteLine("Language: " + fileVersionInfo.Language);
Console.WriteLine("Product Build Part: " + fileVersionInfo.ProductBuildPart);
Console.WriteLine("Product Major Part: " + fileVersionInfo.ProductMajorPart);
Console.WriteLine("Product Minor Part: " + fileVersionInfo.ProductMinorPart);
Console.WriteLine("Product Private Part: " + fileVersionInfo.ProductPrivatePart);
}
else
{
Console.WriteLine("[-] PID:" + processId + " not found or exited");
}
}
catch (Exception ex)
{
Console.WriteLine("[!] Error: " + ex.Message);
}
}
}