简体   繁体   English

在C#中执行命令行,但对taskmanager隐藏它

[英]Execute command line in C# but hide it from taskmanager

I'm executing command lines containing passwords in C#, if I display the optional "Command Line" column in the windows task manager ("Processes" tab) it contains all the arguments including the passwords, could you think of a way to hide this, like only showing the ".exe" file or something ? 我正在C#中执行包含密码的命令行,如果我在Windows任务管理器(“进程”选项卡)中显示可选的“命令行”列,则其中包含包括密码在内的所有参数,您能想到一种隐藏此方法的方法吗,就像只显示“ .exe”文件一样?

Thanks 谢谢

If you have control over the program you are calling, you could modify it to read the data from standard input instead of passing the passwords on the command line. 如果您可以控制要调用的程序,则可以对其进行修改以从标准输入中读取数据,而不必在命令行中传递密码。 This would prevent it from being part of the command line itself, which would "hide" it. 这将阻止它成为命令行本身的一部分,而命令行将“隐藏”它。

If you cannot change the program, there will be no way to hide the command line used to start the process, as there are Windows API calls that can query this for open processes (which is what is being used by Task Manager). 如果您无法更改程序,则将无法隐藏用于启动该进程的命令行,因为有Windows API调用可以查询此进程中的打开进程(这是任务管理器所使用的)。

Well, fist off: In my opinion you should really not do something like passing credentials in a human readable format! 好吧,别打扰:我认为您真的不应该做类似以人类可读格式传递凭据的操作! Passing a path to a file containing encrypted credentials is not hard to do and much safer. 将路径传递到包含加密凭据的文件并不难,而且更安全。

I don't think that hiding the commandline is even possible. 我认为隐藏命令行甚至是不可能的。 Correct me if I'm wrong. 如果我错了纠正我。

See: What is the easiest way to encrypt a password when I save it to the registry? 请参阅: 将密码保存到注册表中时,最简单的加密方式是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM