假设你有一个 .EXE 文件,你想检查它是否具有命令行选项。如何知道 .EXE 文件是否有这种能力。在我的案例中,我知道 Nir Sofers 的 WebBrowserPassView.exe 能够通过 cmd.exe 启动,并使用 WebBrowserPassView.exe /stext output.txt 命令。但是如果我不知道怎么办呢?
假设你有一个 .EXE 文件,你想检查它是否具有命令行选项。如何知道 .EXE 文件是否有这种能力。在我的案例中,我知道 Nir Sofers 的 WebBrowserPassView.exe 能够通过 cmd.exe 启动,并使用 WebBrowserPassView.exe /stext output.txt 命令。但是如果我不知道怎么办呢?
通过在shell中加上像/?
或--help
这样的参数来调用它。这些都是通常用来获取帮助的开关。
Sysinternals 有一款工具可以使用,Strings.exe
例如:
strings.exe c:\windows\system32\wuauclt.exe > %temp%\wuauclt_strings.txt && %temp%\wuauclt_strings.txt
只需使用IDA PRO(https://www.hex-rays.com/products/ida/index.shtml)对文件进行反汇编,并搜索一些已知的命令行选项(使用搜索...文本)-在该部分中,您通常会看到程序的所有命令行选项 - 例如,下面的截图显示了一个记录的命令行选项(/COM2TAG),但也有一些未记录的选项,如/L。希望这可以帮助您?
这实际上是对Marcin答案的扩展。
但您也可以尝试传递“垃圾”参数,以查看是否会收到任何错误响应。在shell中直接从可执行文件获得任何响应都意味着它可能正在查看您传递的参数,如果出现错误响应,那就几乎可以保证了。
如果仍然失败,您可能需要直接向发布者/创建者/所有者提问......自己嗅探二进制文件似乎对最终用户来说工作量太大了。
/?
或 /help
(某些应用程序可能更喜欢Unix风格的语法,分别为 -?
和 -help
)。但这只是一个常见的约定。这是我在Windows 10控制台中得到的内容:
C:\>find /?
Searches for a text string in a file or files.
FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]
/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.
If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.