将参数传递到控制台程序steghide [英] Pass parameters to the console program steghide
问题描述
我有Steghide程序,
I have program steghide,
Steghide is a steganography program that is able to hide data in various kinds of image- and audio-files. The color- respectivly sample-frequencies are not changed thus making the embedding resistant against first-order statistical tests.
http://steghide.sourceforge.net [ ^ ]
我尝试设置参数
System.Diagnostics.Process.Start("steghide.exe","-sf""picture.jpg");
我运行程序.它显示
http://steghide.sourceforge.net[^]
I try set parameters
System.Diagnostics.Process.Start("steghide.exe", "-sf" "picture.jpg");
I run the program. And it shows
steghide extract -sf picture.jpg
Enter passphrase:
wrote extracted data to "secret.txt
".
如何传递参数密码
".
How to pass parameter password
推荐答案
首先,阅读"steghide.exe"的文档.您需要能够将密码短语作为另一个参数传递.如果此命令行参数不可用,则解决方案仍然可行,请参见下文.
但是首先,请查看 ^ ].
没有您要使用的签名,代码无法编译.您可以使用Process.Start(string, string)
:
First, read the documentation of "steghide.exe". You need to be able to pass a pass phrase as another parameter. If this command line parameter is not available, the solution is still possible, see below.
But first, look at all of the methodsSystem.Diagnostics.Process.Start
at http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx[^].
There is not such signature you are trying to use, the code won''t compile. You can useProcess.Start(string, string)
:
System.Diagnostics.Process.Start("steghide.exe", "-sf picture.jpg");
在这种用法中,所有参数都放在一个字符串中,并用空白字符分隔: http://msdn.microsoft .com/en-us/library/h6ak8zt5.aspx [ ^ ].
现在,回到密码短语没有命令行参数的情况:
更糟糕的是,那么您需要模拟用户输入.这是通过使用System.Diagnostics.Process.StandardInput
完成的.您将需要重定向.为此,您将需要使用流程Start(ProcessStartInfo)
方法.
确保在流程启动信息中指定重定向选项,请参见:
http://msdn.microsoft.com/en-us/library/system. diagnostics.process.startinfo.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.diagnostics. processstartinfo.aspx [ ^ ].
您将在此处找到具有重定向的代码示例: http://msdn.microsoft. com/en-us/library/system.diagnostics.process.standardinput.aspx [
In this usage, all parameters go in one string, separated with the blank character: http://msdn.microsoft.com/en-us/library/h6ak8zt5.aspx[^].
Now, coming back to the situation when there is no a command line parameter for your pass phrase:
It''s worse, then you need to simulate the user input. This is done by using System.Diagnostics.Process.StandardInput
. You will need to redirect it. Do do this, you will need to use the process Start(ProcessStartInfo)
method.
Make sure you prescribe redirection option in your process start info, see:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.startinfo.aspx[^],
http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx[^].
You will find a code sample with redirection here: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardinput.aspx[^].
You need to write your value of the pass phrase to the redirected string where required.
这篇关于将参数传递到控制台程序steghide的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!