Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⭐️ nmap provider #4168

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

⭐️ nmap provider #4168

wants to merge 3 commits into from

Conversation

chris-rock
Copy link
Member

@chris-rock chris-rock commented Jun 2, 2024

nmap provider

Nmap, short for Network Mapper, is a powerful and versatile open-source tool used for network discovery and security auditing. This tool is widely utilized by network administrators, security professionals, and penetration testers to map out network structures, discover hosts, identify services, and detect vulnerabilities.

The nmap provider maps primary objects and attributes that nmap uses to store and manage information about scanned targets, discovered hosts, and their associated ports and services.

Pre-requisites

This provider requires the nmap tool to be installed on your system. You can download and install nmap from the official website.

Get Started

cnquery shell nmap

Example

Scan active IP address in network

nmap.target("192.168.178.0/24").hosts { name ports { * }  }
nmap.target.hosts: [
  0: {
    ports: [
      0: {
        service: "http"
        version: ""
        method: "probed"
        state: "open"
        protocol: "tcp"
        port: 443
        product: "FRITZ!Box http config"
      }
      1: {
        service: "sip"
        version: ""
        method: "probed"
        state: "open"
        protocol: "tcp"
        port: 5060
        product: "AVM FRITZ!OS SIP"
      }
    ]
    name: "192.168.178.1"
  }
  1: {
    ports: [
      0: {
        service: "rtsp"
        version: "770.8.1"
        method: "probed"
        state: "open"
        protocol: "tcp"
        port: 5000
        product: "AirTunes rtspd"
      }
      1: {
        service: "rtsp"
        version: "770.8.1"
        method: "probed"
        state: "open"
        protocol: "tcp"
        port: 7000
        product: "AirTunes rtspd"
      }
    ]
    name: "192.168.178.25"
  }
]

Host scan with specific ip

nmap.target(target: "192.168.178.25").hosts { ports }
nmap.target.hosts: [
  0: {
    ports: [
      0: nmap.port port=5000 service="rtsp"
      1: nmap.port port=7000 service="rtsp"
    ]
  }
]

Advanced Usage

Discover all exposed hosts on a network.

cnquery shell nmap --networks "192.168.0.0/20" --discover hosts

Connect to a specific IP address and display all open ports.

cnquery shell nmap host 8.8.8.8

TODO

  • implement nmap discovery
  • expose nmap version to the nmap resource
  • implement nmap host discovery
  • ensure discovery returns multiple nmap host

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Jun 2, 2024

Test Results

3 098 tests  +1   3 096 ✅ ±0   1m 20s ⏱️ ±0s
  376 suites +6       1 💤 ±0 
   29 files   +1       1 ❌ +1 

For more details on these failures, see this check.

Results for commit d51bd70. ± Comparison against base commit 2d12b8a.

♻️ This comment has been updated with latest results.

Makefile Outdated Show resolved Hide resolved
providers/defaults.go Outdated Show resolved Hide resolved
providers/nmap/README.md Outdated Show resolved Hide resolved
providers/nmap/README.md Outdated Show resolved Hide resolved

This comment has been minimized.

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants