如何查明 .EXE 是否具有命令行选项?
假设您有一个 .EXE,并且您想检查它是否有命令行选项。如何知道 .EXE 是否具有这种能力。就我而言,我知道 Nir Sofers WebBrowserPassView.exe 能够通过 cmd 启动它.exe 和 WebBrowserPassView.exe /stext 输出.txt。但如果我不知道,我怎么能知道呢?
Suppose you have an .EXE and you want to check if it has Command-Line Options. How can one know if the .EXE has this ability. In my case I know that Nir Sofers WebBrowserPassView.exe has the ability to start it via cmd.exe and WebBrowserPassView.exe /stext output.txt. But how can I find out if I don't know?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
最简单的方法是使用 ProcessExplorer 但它仍然会需要一些搜索。
确保您的 exe 正在运行并打开 ProcessExplorer。
在 ProcessExplorer 中找到二进制文件的名称并双击它以显示属性。
单击“字符串”选项卡。
向下搜索在二进制文件中找到的字符串列表。大多数字符串都是垃圾,因此可以忽略它们。搜索任何可能类似于命令行开关的内容。
从命令行测试这个开关,看看它是否有任何作用。
请注意,您的二进制文件可能只是没有命令行开关。
此处适用于 Chrome 可执行文件的上述步骤可供参考。 Chrome 接受的命令行开关可以在列表中看到:
The easiest way would be to use use ProcessExplorer but it would still require some searching.
Make sure your exe is running and open ProcessExplorer.
In ProcessExplorer find the name of your binary file and double click it to show properties.
Click the Strings tab.
Search down the list of string found in the binary file. Most strings will be garbage so they can be ignored. Search for anything that might possibly resemble a command line switch.
Test this switch from the command line and see if it does anything.
Note that it might be your binary simply has no command line switches.
For reference here is the above steps applied to the Chrome executable. The command line switches accepted by Chrome can be seen in the list:
使用
/?
或--help
等参数从 shell 调用它。这些是常见的帮助开关。Invoke it from the shell, with an argument like
/?
or--help
. Those are the usual help switches.Sysinternals 还有另一个可以使用的工具,Strings.exe< /a>
示例:
strings.exe c:\windows\system32\wuauclt.exe > %temp%\wuauclt_strings.txt && %temp%\wuauclt_strings.txt
Sysinternals has another tool you could use, Strings.exe
Example:
strings.exe c:\windows\system32\wuauclt.exe > %temp%\wuauclt_strings.txt && %temp%\wuauclt_strings.txt
实际上,这是 Marcin 答案的延伸。
但您也可以尝试传递“垃圾”参数,看看是否返回任何错误。直接在 shell 中从可执行文件获取任何响应意味着它可能会查看您传递的参数,并且错误响应接近保证。
如果做不到这一点,您可能不得不直接询问出版商/创建者/所有者...自己嗅探二进制文件对于最终用户来说似乎是太多的工作。
Really this is an extension to Marcin's answer.
But you could also try passing "rubbish" arguments to see if you get any errors back. Getting any response from the executable directly in the shell will mean that it is likely looking at the arguments you're passing, with an error response being close to a guarantee that it is.
Failing that you might have to directly ask the publishers/creators/owners... sniffing the binaries yourself just seems like far too much work for an end-user.
只需使用 IDA PRO (https://www.hex-rays.com/products /ida/index.shtml)来反汇编文件,并搜索一些已知的命令行选项(使用搜索...文本) - 在该部分中,您通常会看到程序的所有命令行选项(LIB2NIST.exe) 在例如,下面的屏幕截图显示了记录的命令行选项 (/COM2TAG),但也显示了一些未记录的选项,例如 /L。希望这有帮助吗?
Just use IDA PRO (https://www.hex-rays.com/products/ida/index.shtml) to disassemble the file, and search for some known command line option (using Search...Text) - in that section you will then typically see all the command line options - for the program (LIB2NIST.exe) in the screenshot below, for example, it shows a documented command line option (/COM2TAG) but also some undocumented ones, like /L. Hope this helps?
除非可执行文件的编写者专门为您提供了一种显示其提供的所有命令行开关列表的方法,否则无法执行此操作。
正如 Marcin 所建议的,显示所有选项的典型开关是
/?
或/help
(某些应用程序可能更喜欢 Unix 风格的语法,-?分别是
和-help
)。但这些只是一个常见的约定。如果这些不起作用,那你就不走运了。您需要检查应用程序的文档,或者尝试反编译可执行文件(如果您知道要查找什么)。
Unless the writer of the executable has specifically provided a way for you to display a list of all the command line switches that it offers, then there is no way of doing this.
As Marcin suggests, the typical switches for displaying all of the options are either
/?
or/help
(some applications might prefer the Unix-style syntax,-?
and-help
, respectively). But those are just a common convention.If those don't work, you're out of luck. You'll need to check the documentation for the application, or perhaps try decompiling the executable (if you know what you're looking for).
这是我从 Windows 10 控制台得到的信息:
This is what I get from console on Windows 10: