{"id":16552624,"url":"https://github.com/postmodern/ruby-nmap","last_synced_at":"2025-05-16T02:04:36.319Z","repository":{"id":722031,"uuid":"369511","full_name":"postmodern/ruby-nmap","owner":"postmodern","description":"A Ruby interface to nmap, the exploration tool and security / port scanner. Allows automating nmap and parsing nmap XML files.","archived":false,"fork":false,"pushed_at":"2024-01-25T11:39:07.000Z","size":592,"stargazers_count":295,"open_issues_count":9,"forks_count":51,"subscribers_count":21,"default_branch":"main","last_synced_at":"2025-05-11T08:36:31.881Z","etag":null,"topics":["automation","nmap","ruby","ruby-nmap","xml-parser"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postmodern.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2009-11-11T22:10:22.000Z","updated_at":"2025-05-11T05:12:36.000Z","dependencies_parsed_at":"2024-06-18T15:06:07.970Z","dependency_job_id":"60633868-73b2-4c1a-85ab-db9fa77f9ce2","html_url":"https://github.com/postmodern/ruby-nmap","commit_stats":{"total_commits":530,"total_committers":9,"mean_commits":"58.888888888888886","dds":"0.037735849056603765","last_synced_commit":"97de8eb232760c321c06c3f2158928c7a7100a75"},"previous_names":["sophsec/ruby-nmap"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fruby-nmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fruby-nmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fruby-nmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fruby-nmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postmodern","download_url":"https://codeload.github.com/postmodern/ruby-nmap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254453646,"owners_count":22073616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","nmap","ruby","ruby-nmap","xml-parser"],"created_at":"2024-10-11T19:45:33.074Z","updated_at":"2025-05-16T02:04:36.264Z","avatar_url":"https://github.com/postmodern.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ruby-nmap\n\n[![CI](https://github.com/postmodern/ruby-nmap/actions/workflows/ruby.yml/badge.svg)](https://github.com/postmodern/ruby-nmap/actions/workflows/ruby.yml)\n[![Code Climate](https://codeclimate.com/github/postmodern/ruby-nmap.svg)](https://codeclimate.com/github/postmodern/ruby-nmap)\n[![Gem Version](https://badge.fury.io/rb/ruby-nmap.svg)](https://badge.fury.io/rb/ruby-nmap)\n\n* [Source](https://github.com/postmodern/ruby-nmap/)\n* [Issues](https://github.com/postmodern/ruby-nmap/issues)\n* [Documentation](http://rubydoc.info/gems/ruby-nmap/frames)\n\n## Description\n\nA Ruby API to [nmap], the exploration tool and security / port scanner.\nAllows automating nmap and parsing nmap XML files.\n\n## Features\n\n* Provides a Ruby API for automating nmap.\n* Provides a Parser for enumerating nmap XML scan files.\n* Supports the full [Nmap XML DTD][nmap-dtd].\n\n## Examples\n\nRun Nmap from Ruby:\n\n```ruby\nrequire 'nmap/command'\n\nNmap::Command.run do |nmap|\n  nmap.connect_scan   = true\n  nmap.service_scan   = true\n  nmap.output_xml     = 'scan.xml'\n  nmap.verbose        = true\n\n  nmap.ports   = [20, 21, 22, 23, 25, 80, 110, 443, 512, 522, 8080, 1080]\n  nmap.targets = '192.168.1.*'\nend\n```\n\nRun `sudo nmap` from Ruby:\n\n```ruby\nrequire 'nmap/command'\n\nNmap::Command.sudo do |nmap|\n  nmap.syn_scan       = true\n  nmap.os_fingerprint = true\n  nmap.service_scan   = true\n  nmap.output_xml     = 'scan.xml'\n  nmap.verbose        = true\n\n  nmap.ports   = [20, 21, 22, 23, 25, 80, 110, 443, 512, 522, 8080, 1080]\n  nmap.targets = '192.168.1.*'\nend\n```\n\nParse Nmap XML scan files:\n\n```ruby\nrequire 'nmap/xml'\n\nNmap::XML.open('scan.xml') do |xml|\n  xml.each_host do |host|\n    puts \"[#{host.ip}]\"\n\n    host.each_port do |port|\n      puts \"  #{port.number}/#{port.protocol}\\t#{port.state}\\t#{port.service}\"\n    end\n  end\nend\n```\n\nPrint NSE script output from an XML scan file:\n\n```ruby\nrequire 'nmap/xml'\n\nNmap::XML.open('nse.xml') do |xml|\n  xml.each_host do |host|\n    puts \"[#{host.ip}]\"\n\n    host.scripts.each do |name,output|\n      output.each_line { |line| puts \"  #{line}\" }\n    end\n\n    host.each_port do |port|\n      puts \"  [#{port.number}/#{port.protocol}]\"\n\n      port.scripts.each do |id,script|\n        puts \"    [#{id}]\"\n\n        script.output.each_line { |line| puts \"      #{line}\" }\n      end\n    end\n  end\nend\n```\n\n## Requirements\n\n* [ruby] \u003e= 2.0.0\n* [nmap] \u003e= 5.00\n* [nokogiri] ~\u003e 1.3\n* [command_mapper] ~\u003e 0.3\n\n## Install\n\n* Debian / Ubuntu:\n\n```shell\n$ sudo apt install nmap\n```\n\n* Fedora / RedHat:\n\n```shell\n$ sudo dnf install nmap\n```\n\n* Homebrew:\n\n```shell\n$ brew install nmap\n```\n\n```shell\n$ gem install ruby-nmap\n```\n\n## License\n\nSee {file:LICENSE.txt} for license information.\n\n[nmap]: http://www.insecure.org/\n[ruby]: https://www.ruby-lang.org/\n[nokogiri]: http://nokogiri.rubyforge.org/\n[command_mapper]: https://github.com/postmodern/command_mapper.rb#readme\n[nmap-dtd]: https://nmap.org/book/nmap-dtd.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostmodern%2Fruby-nmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostmodern%2Fruby-nmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostmodern%2Fruby-nmap/lists"}