-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17e6205
commit 257f8cc
Showing
15 changed files
with
2,498 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# 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. | ||
Check failure on line 5 in providers/nmap/README.md GitHub Actions / Run spell check
|
||
|
||
## 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). | ||
Check failure on line 9 in providers/nmap/README.md GitHub Actions / Run spell check
|
||
|
||
## Get Started | ||
|
||
```shell | ||
cnquery shell nmap | ||
``` | ||
|
||
## Example | ||
|
||
*Scan active IP address in network* | ||
|
||
```shell | ||
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* | ||
```shell | ||
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. | ||
```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 | ||
``` |
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,25 @@ | ||
// Copyright (c) Mondoo, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package config | ||
|
||
import ( | ||
"go.mondoo.com/cnquery/v11/providers-sdk/v1/plugin" | ||
"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", | ||
Discovery: []string{}, | ||
Flags: []plugin.Flag{}, | ||
}, | ||
}, | ||
} |
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,37 @@ | ||
// Copyright (c) Mondoo, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package connection | ||
|
||
import ( | ||
"go.mondoo.com/cnquery/v11/providers-sdk/v1/inventory" | ||
"go.mondoo.com/cnquery/v11/providers-sdk/v1/plugin" | ||
) | ||
|
||
type NmapConnection struct { | ||
plugin.Connection | ||
Conf *inventory.Config | ||
asset *inventory.Asset | ||
// Add custom connection fields here | ||
} | ||
|
||
func NewNmapConnection(id uint32, asset *inventory.Asset, conf *inventory.Config) (*NmapConnection, error) { | ||
conn := &NmapConnection{ | ||
Connection: plugin.NewConnection(id, asset), | ||
Conf: conf, | ||
asset: asset, | ||
} | ||
|
||
// initialize your connection here | ||
|
||
return conn, nil | ||
} | ||
|
||
func (c *NmapConnection) Name() string { | ||
return "nmap" | ||
} | ||
|
||
func (c *NmapConnection) Asset() *inventory.Asset { | ||
return c.asset | ||
} | ||
|
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,13 @@ | ||
// Copyright (c) Mondoo, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package main | ||
|
||
import ( | ||
"go.mondoo.com/cnquery/v11/providers-sdk/v1/plugin/gen" | ||
"go.mondoo.com/cnquery/v11/providers/nmap/config" | ||
) | ||
|
||
func main() { | ||
gen.CLI(&config.Config) | ||
} |
Oops, something went wrong.