-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ⭐️ nmap provider * 🧹 update go mod file * 🧹 update spellcheck
- Loading branch information
1 parent
7beb5d7
commit ebc4e69
Showing
21 changed files
with
2,704 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# 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](https://nmap.org/download.html). | ||
|
||
## Get Started | ||
|
||
```shell | ||
cnquery shell nmap | ||
``` | ||
|
||
## Example | ||
|
||
*Scan active IP address in network* | ||
|
||
```shell | ||
nmap.network("192.168.178.0/24").hosts { name ports { * } } | ||
nmap.network.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* | ||
```shell | ||
nmap.network(target: "192.168.178.25").hosts { ports } | ||
nmap.network.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. | ||
```shell | ||
cnquery shell nmap --networks "192.168.0.0/20" --discover hosts | ||
``` | ||
Connect to a specific IP address and display all open ports. | ||
```shell | ||
cnquery shell nmap host 8.8.8.8 | ||
``` | ||
## Verifying the Installation of nmap | ||
To verify the installation of nmap, run the following command: | ||
```shell | ||
cnquery run nmap -c "nmap.version { * }" | ||
nmap.version: { | ||
compiledWithout: [] | ||
nsockEngines: [ | ||
0: "kqueue" | ||
1: "poll" | ||
2: "select" | ||
] | ||
version: "7.95" | ||
platform: "arm-apple-darwin23.4.0" | ||
compiledWith: [ | ||
0: "liblua-5.4.6" | ||
1: "openssl-3.3.1" | ||
2: "libssh2-1.11.0" | ||
3: "libz-1.2.12" | ||
4: "libpcre2-10.44" | ||
5: "nmap-libpcap-1.10.4" | ||
6: "nmap-libdnet-1.12" | ||
7: "ipv6" | ||
] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) Mondoo, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package config | ||
|
||
import ( | ||
"go.mondoo.com/cnquery/v11/providers-sdk/v1/inventory" | ||
"go.mondoo.com/cnquery/v11/providers-sdk/v1/plugin" | ||
"go.mondoo.com/cnquery/v11/providers/nmap/connection" | ||
"go.mondoo.com/cnquery/v11/providers/nmap/provider" | ||
) | ||
|
||
var Config = plugin.Provider{ | ||
Name: "nmap", | ||
ID: "go.mondoo.com/cnquery/v11/providers/nmap", | ||
Version: "11.0.0", | ||
ConnectionTypes: []string{provider.DefaultConnectionType}, | ||
Connectors: []plugin.Connector{ | ||
{ | ||
Name: "nmap", | ||
Use: "nmap", | ||
Short: "a Nmap network scanner", | ||
Long: `Use the nmap provider to query network information using the Nmap network scanner.`, | ||
MinArgs: 0, | ||
MaxArgs: 2, | ||
Discovery: []string{ | ||
connection.DiscoveryAll, | ||
connection.DiscoveryAuto, | ||
connection.DiscoveryHosts, | ||
}, | ||
Flags: []plugin.Flag{ | ||
{ | ||
Long: "networks", | ||
Type: plugin.FlagType_List, | ||
Default: "", | ||
Desc: "Only include repositories with matching names", | ||
}, | ||
}, | ||
}, | ||
}, | ||
AssetUrlTrees: []*inventory.AssetUrlBranch{ | ||
{ | ||
PathSegments: []string{"technology=network", "category=nmap"}, | ||
Key: "kind", | ||
Title: "Kind", | ||
Values: map[string]*inventory.AssetUrlBranch{ | ||
"host": nil, | ||
}, | ||
}, | ||
}, | ||
} |
Oops, something went wrong.