关于如何以编程方式与 nmap 集成有什么想法吗?

发布于 2024-07-16 15:09:27 字数 211 浏览 11 评论 0原文

我刚刚开始研究如何将开源安全产品 nmap 集成到一些 C++ 代码中。 如果有人尝试过这个,并且对最佳方法有一些想法,我当然会很感激。

感谢您的回复。 具体来说,我想运行端口扫描(ipv6)。 我肯定更喜欢非 gpl 解决方案,例如命令行或套接字接口。 然而,我也在寻找最快的解决方案,因为我们面临着一些严格的时间表,并且如有必要,我们可以回载实施非 gpl 解决方案。

I'm just starting to look into how to integrate nmap, an open source security product, into some c++ code. If anyone's tried this, and has some ideas on the best approach, I'd certainly appreciate it.

Thanks for the responses. Specifically, I'd like to run a port scan (ipv6). I would definitely prefer non-gpl solutions such as a command line or sockets interface. However, I'm also this point I'm looking for the fastest solution/s, as we're up against some stringent timelines, and we can backload implemententing the non-gpl solution if necessary.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

电影里的梦 2024-07-23 15:09:27

(注:我不是律师,这些都不应被视为法律建议)

您可能应该注意到,Nmap 认为解析其输出的产品是派生作品,根据 手册中的许可章节,因此属于 GPL 许可义务。 GPLv2 没有定义什么是派生作品,而是让这取决于法院并根据版权法的定义。 通常的解释是,除了链接到操作系统中包含的系统库之外,任何形式的链接都会使链接的作品成为派生作品,而通过管道或网络进行通信的单独进程不一定是派生作品,尽管如GPL FAQ,“如果通信的语义足够亲密,交换复杂的内部数据结构,这也可以作为考虑将这两个部分组合成一个更大的程序的基础。” 这似乎是 Nmap 开发人员正在采取的解释。

无论如何,假设您不需要担心 GPL,您可能想查看 输出Nmap 的选项; 特别是,-oX 用于 XML 输出,-oG 用于“greppable”输出。 如果您需要更多地控制 Nmap 的功能,您应该查看 Nmap 脚本引擎,一个 Lua Nmap 中的脚本引擎为您提供各种控制。

(note: I am not a lawyer, and none of this should be taken as legal advice)

You should probably note that Nmap considers a product that parses its output to be a derived work, according to the licensing chapter in the manual, and thus fall under the GPL licensing obligations. The GPLv2 does not define what a derived work is, instead letting that be up to the courts and according to definitions in copyright law. The usual interpretation is that any form of linking, other than linking to system libraries included in the operating system, makes the linked work a derived work, while separate process that talk over pipes or the network are not necessarily derived works, though as mentioned in the GPL FAQ, "if the semantics of the communication are intimate enough, exchanging complex internal data structures, that too could be a basis to consider the two parts as combined into a larger program." That seems to be the interpretation that the Nmap developers are taking.

Anyhow, assuming that you don't need to worry about the GPL, you probably want to look at the output options for Nmap; in particular, -oX for XML output and -oG for "greppable" output. If you need more control over what Nmap does, you should look into the Nmap Scripting Engine, a Lua scripting engine in Nmap that gives you all kinds of control.

二货你真萌 2024-07-23 15:09:27

您是否希望使用特定的功能? 我发现在其他语言中使用 nmap 的一个简单方法是使用 -oX 开关让它吐出 xml。 您可以使用 DTD(以及将其转换为您最喜欢的绑定工具的 xsd 的多种方法)来使用数据。

鉴于您正在用 C++ 编写,尽管如果您需要的话,直接链接可能很容易。

Are you looking to use specific pieces of functionality? An easy way I've found of using nmap in other languages is to have it spit out xml using the -oX switch. There is a DTD (and numerous ways to covert this to an xsd for your favourite binding tool) what you can use to consume the data.

Given that you're writing in C++ though it probably would be easy enough to link against directly if you needed.

黑寡妇 2024-07-23 15:09:27

你总是可以在管道中读取它。 按照传统,即使非 GPL 访问 GPL 也是可以接受的。

You could always read it in pipe. According to tradition that is acceptable even if non-GPL accesses GPL.

小梨窩很甜 2024-07-23 15:09:27

“整合”还不够。 你想做什么样的事情? 根据“集成”的级别,将 nmap 作为单独的进程运行并捕获其输出可能就足够了。 这样做的好处是您可以更新 nmap 的版本而无需重建应用程序。 如果您需要更紧密的耦合,那么这取决于您需要什么功能和“库化”nmap,但请注意它是 GPL 代码,并且这种集成需要您的应用程序的源代码分发。

"Integrate" doesn't really say enough. What kind of things do you want to do? Depending on the level of "integration" it might be enough to run nmap as a separate process and capture its output. The advantage there is that you can update the version of nmap without rebuilding your app. If you require tighter coupling, then it depends on what functionality you need and "library-izing" nmap, but be warned that it's GPL code and this kind of integration would require source distribution of your app..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文