查看传递给程序的命令行参数

2023-12-04

您可以跳过这部分

我正在使用拇指驱动器中的批处理文件,以便 安装真正的 crypt 卷。我在以下命令的帮助下创建了该批处理文件这个链接。在该批处理文件中我有用户名和密码 我将其作为参数传递给 trueCrypt.exe,以便使其成为 安装。


无论如何,我的问题是:是否有可能看到参数从第三方进程传递给程序?换句话说,是否可以看到传递给该程序的参数:

using System;
using System.Reflection;
using System.Diagnostics;

class Program
{
    static string password = "";

    static void Main(string[] args)
    {
        if (args.Length > 0)
            password = args[0];

        // get location where this program resides 
        var locationOfThisExe = Assembly.GetExecutingAssembly().Location;


        Console.Write("Press enter to start a new instance of this program.");
        Console.Read();

        var randomArgument = new Random().NextDouble().ToString();
        Process.Start(locationOfThisExe, randomArgument); 
        // I am passing a random argument to a new process!
        // is it possible to see these arguments from another process?
    }
}

Edit

我正在创建编辑,因为我认为我错误地解释了自己,但此编辑应该是一个解决方案而不是问题

我认为这个问题还没有受到足够的重视。执行显示的命令https://stackoverflow.com/users/235660/alois-kraus shows:

(我将输出粘贴到记事本++上)

enter image description here

在图像上它没有显示得很清楚,但我能够看到参数被传递到该过程。这对我来说很重要,因为我使用以下命令挂载我的真实加密卷:

"C:\Program Files\TrueCrypt\TrueCrypt.exe" /v "a:\volume.tc" /lz /a /p a

告诉 truecrypt 我想挂载位于a:\volume.tc在驱动器号 z 上,密码是a

如果我执行该命令 true crypt 会将该卷安装在驱动器 z 上:

enter image description here

问题是如果我然后执行命令wmic process注意穿什么鞋:

enter image description here

注意密码就在里面!

因此总而言之,将安全信息作为参数传递是不安全的。如果您关闭接收参数的进程可能是安全的,但我认为意识到这一点很重要......


如果具有管理权限或相同用户帐户的其他用户可以执行程序,您可以看到所有命令行

wmic process

使用这个命令行从所有进程中。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

查看传递给程序的命令行参数 的相关文章

随机推荐