使用 Ruby 创建 Excel 列表
我正在 ruby 中生成一个 excel,其中每一行代表 nmap 扫描的结果。
一行的示例可能如下所示:ip,yes(因为端口 22 打开),no(因为端口 80 未打开)等。
我希望能够创建一个带有下拉列表的标题行每个端口都允许我选择该端口是否打开。
因此,我可以过滤结果以查看所有同时打开端口 22 和 80 的主机。
有没有办法用 WIN32OLE.new("Excel.Application") 做到这一点? (或者其他东西;html 会更好,因为 Linux 不支持 win32ole)。
I'm generating an excel in ruby which each line represents the results of an nmap scan.
An example of a line could look like that: ip, yes (because port is 22 open), no (because port 80 is not open), etc.
I would like to be able to create a header line with a drop down list for each port that allow me to select if that port is open or not.
So i can filter my results to see for example all hosts that have both port 22 and 80 open.
Is there a way to do that with WIN32OLE.new("Excel.Application")? (or something else; html would be better because Linux does not support win32ole).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我最初建议创建一个 CSV 文件并导出到 Excel,但您似乎需要更复杂的东西。
像这样的东西会起作用吗:
I would initially suggest creating a CSV file and exporting to Excel, but you seem to require something more sophisticated.
Would something like this work: http://rubyonwindows.blogspot.com/search/label/excel?updated-max=2007-03-31T11%3A16%3A00-05%3A00&max-results=20 ?
经过更多研究,我还没有找到任何使用 Ruby 在 Excel 中创建下拉列表的解决方案。 我使用的解决方法是创建一个 Excel 模板(带有下拉列表)并用 Ruby 填充它。
After more research I haven't found any solution to create a drop down list in excel with Ruby. The workaround I used was to create a excel template (with the drop down list) and fill it up with Ruby.
老问题,但万一其他人发现了这个,目前有一些红宝石可以用于此目的。
对于从 ruby 创建/解析 Excel 电子表格,有 RubyXL ,对于 nmap XML 文件的解析有 nmap 解析器
Old question but in case anyone else finds this one, there's a couple of ruby gems that could be used for this at the moment.
For creation/parsing of Excel spreadsheets from ruby there's RubyXL and for the parsing for nmap XML files there's nmap-parser
您可以使用 gem axlsx 创建数据验证列表。 示例如下: github.com/randym/axlsx/blob/master/examples/数据验证.rb
You can create a data validation list using gem axlsx. Example here: github.com/randym/axlsx/blob/master/examples/data_validation.rb