Remove batch file creation to reduce AV false positives
- Refactored all process execution to use direct exe calls - Added ExecuteExeAsync method for direct process execution - Removed dynamic .bat file creation that triggered Wacatac detection - All commands now run ControlMyMonitor.exe directly with arguments 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,46 @@ internal class ConsoleHelper
|
||||
return await readTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute an exe directly with arguments (no cmd.exe or batch file wrapper)
|
||||
/// </summary>
|
||||
public static async Task<(string Output, int ExitCode)> ExecuteExeAsync(string exePath, string arguments, int timeoutMs = 5000)
|
||||
{
|
||||
var p = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = exePath,
|
||||
Arguments = arguments,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true
|
||||
}
|
||||
};
|
||||
|
||||
p.Start();
|
||||
|
||||
var readTask = Task.Run(async () =>
|
||||
{
|
||||
var output = await p.StandardOutput.ReadToEndAsync();
|
||||
await p.WaitForExitAsync();
|
||||
return (output, p.ExitCode);
|
||||
});
|
||||
|
||||
var completedTask = await Task.WhenAny(readTask, Task.Delay(timeoutMs));
|
||||
|
||||
if (completedTask != readTask)
|
||||
{
|
||||
try { p.Kill(true); } catch { }
|
||||
return (string.Empty, -1);
|
||||
}
|
||||
|
||||
var result = await readTask;
|
||||
p.Close();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<string> CmdCommandAsync(params string[] cmds) =>
|
||||
await CommandAsync(cmdFileName, cmds);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user