The cause of the incident was that I played Love Nest, and soon after I saw Kinito Pet‘s live broadcast, I found the doxing in Meta game very interesting, so I pre-researched how to dox, so that it would be convenient for future game make. Theoretically, this is a C# solution for Windows environment, but because it is only tested with Unity in Windows environment, it may not be applicable to other engine environments.

Get directly

  Some information can be obtained directly, which saves time and effort

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//Get operating system information
print(Environment.UserName);
print(Environment.MachineName);
print(Environment.OSVersion);

Process[] processes = Process.GetProcesses();//You can match some common software by process name
foreach (Process process in processes)
{
print(process.ProcessName);
print(process.StartTime);
print((DateTime.Now - process.StartTime).TotalSeconds);//Running time(Sec)
}

//Calling the camera
WebCamDevice[] devices = WebCamTexture.devices;
if (devices.Length > 0)//If have camera
{
WebCamTexture webCamTexture = new WebCamTexture(devices[0].name);//Create a separate window to display needs other plug-in support
webCamTexture.Play();//For a simple solution, just create a RawImage and assign it the texture
}

Create process

  Some information requires creating a process and obtaining it in the cmd. Let me first introduce a simple process creation.

1
2
3
4
5
6
7
8
9
10
11
string GetCmdInfo(string command)
{
Process process = new();
process.StartInfo.FileName = "cmd.exe"; //Required, just write a file name
process.StartInfo.Arguments = "/c " + command; //Required, command to execute
process.StartInfo.CreateNoWindow = true; //Do not create a window
process.StartInfo.UseShellExecute = false; //Do not interact with the shell
process.StartInfo.RedirectStandardOutput = true; //Redirect output
process.Start();
return process.StandardOutput.ReadToEnd();
}

  Then we can use the process to execute the command line to implement various extended functions (such as obtaining hardware information, etc. At present, the most mainstream solution for obtaining hardware information is to introduce System.Management to call ManagementObjectSearcher for traversal, but Unity requires some additional operations. Here we first use the wmic command to obtain it)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//Calling the printer
Process printProcess = new Process();
printProcess.StartInfo.FileName = "notepad.exe";
printProcess.StartInfo.Arguments = $"/p \"{filePath}\"";
printProcess.StartInfo.CreateNoWindow = true; printProcess.Start();

//Get hardware information
print(GetCmdInfo("wmic cpu get name"));//CPU information
print(GetCmdInfo("wmic diskdrive get model"));//Hard disk information
print(GetCmdInfo("wmic memorychip get capacity"));//Memory information(KB)
print(GetCmdInfo("wmic path win32_videocontroller get name"));//Graphic card information

//The following requires administrator privileges and will be blocked by anti-virus software
GetCmdComd("wmmic process call create shutdown.exe");//Shutdown
GetCmdComd("wmmic process where pic='114514' call terminate");//Kill process by process block number
GetCmdComd("wmmic process where name='qq.exe' call terminate");//Kill a process by its name
GetCmdComd(@"wmic process call create 'C:\\QQ.exe'");//Create process by process path

Simulate keyboard and mouse

  The next step is to obtain and simulate the keyboard and mouse operations. At this step, you can’t avoid adding something to Unity’s C#. I personally recommend NuGet for Unity and install Input Simulator.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//Simulate keyboard
InputSimulator sim = new();
sim.Keyboard.TextEntry(command[i]);

//Simulate mouse
[DllImport("user32.dll")]
public static extern bool SetCursorPos(int x, int y);
[DllImport("user32.dll")]
public static extern bool GetCursorPos(out Vector2Int point);

void Start()
{
GetCursorPos(out Vector2Int point);//The unit is pixel, the upper left corner is (0, 0)
SetCursorPos(Screen.width / 2, Screen.height / 2);
}

Written behind

  That’s about it for now. After I got interested, I verified it with various parties and recorded these C# system calls as a preliminary study for Meta games. You are welcome to add to it. Now it’s time for you to be creative. For example, you can suddenly open the player’s camera and tell the player that you can see me; when threatening the player, you can call the printer to print a death notice; when the player refuses to tell the real address of the character, you can directly open the command line ipconfig and wait for a few seconds to say that you already know it… Of course, I also hope that you will pay attention to not overdoing the doxing when making Meta games…