如何将 Nmap 和 Wireshark 与应用程序捆绑在一起?
我写了一个java应用程序。它依赖于 Nmap、Wireshark 和其他通过 Windows 上的 DOS 提示符调用的命令行工具。
如果我想为该应用程序制作一个安装程序,如何确保 Nmap 和 Wireshark 安装在用户的计算机上,并且 Windows“Path”环境变量随其安装目录更新,以便当我调用我的应用程序出现 DOS 提示,命令正确执行吗?
I've written a java app. It depends on Nmap, Wireshark and other command line tools which it invokes via a DOS prompt on Windows.
If I'd like to make an installer for the app, how can I make sure that Nmap and Wireshark are installed on the user's computer, and the Windows "Path" Environmental Variable is updated with their install directories, so that when I invoke the DOS prompts from my app, the commands execute correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 ProcessBuilder 类来检查如果应用程序已经存在。只需通过命令行运行查询,例如:
并检查返回的字符串,它是否具有wireshark二进制文件的路径或错误消息。一旦到达那里,您就可以从此abs路径调用wireshark命令。
如果没有,那么您可以将它们打包为便携式工具,打包在您的 jar 文件中。您可以在运行时解压缩此文件,并通过进程构建器调用此工具并运行与wireshark相关的任务。 nmap 也是如此。
我希望这能让您知道如何去做。
You can use ProcessBuilder class to check if the application already exists. Simply over the command line run query something like:
and check the returned string, either it will have the path to wireshark binary or error message. Once it is there, you can invoke wireshark commands from this abs path.
If not, then you can package them as portable tool packaged in your jar file. You can unjar this file at run time, and through process builder, invoke this tool and run wire-shark dependent tasks. Same goes for nmap.
I hope this gives you the idea how to go about it.