Skip to content

Commit 229a5b0

Browse files
Improve ZGrab Docs/--help (#524)
* added example of using stdin for input to the README * added a description of zgrab2 to --help with example usages * added example usages for http * remove ./zgrab2 in favor of zgrab2 --------- Co-authored-by: Zakir Durumeric <zakird@gmail.com>
1 parent 7a1f6c0 commit 229a5b0

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ domain.com
9696
10.0.0.1, , , 5678
9797
, domain.com, tag
9898
192.168.0.0/24, , tag
99+
```
100+
101+
And an example of calling zgrab2 with input:
99102

103+
```shell
104+
echo "en.wikipedia.org" | ./zgrab2 http --max-redirects=1 --endpoint="/wiki/New_York_City"
100105
```
101106

102107
## Multiple Module Usage

modules/http/scanner.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ func (module *Module) NewScanner() zgrab2.Scanner {
133133

134134
// Description returns an overview of this module.
135135
func (module *Module) Description() string {
136-
return "Send an HTTP request and read the response, optionally following redirects."
136+
desc := []string{
137+
"Send an HTTP request and read the response, optionally following redirects",
138+
"Ex: echo \"en.wikipedia.org\" | ./zgrab2 http --max-redirects=1 --endpoint=\"/wiki/New_York_City\"",
139+
}
140+
return strings.Join(desc, "\n")
137141
}
138142

139143
// Validate performs any needed validation on the arguments

utility.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@ const defaultDNSPort = "53"
2222

2323
func init() {
2424
parser = flags.NewParser(&config, flags.Default)
25+
desc := []string{
26+
// Using a long single line so the terminal can handle wrapping, except for Input/Examples which should be on
27+
// separate lines
28+
"zgrab2 is fast, modular L7 application-layer scanner. It is commonly used with tools like ZMap which identify " +
29+
"\"potential services\", or services we know are active on a given IP + port, and these are fed into ZGrab2 " +
30+
"to confirm and provide details of the service. It has support for a number of protocols listed below as " +
31+
"'Available commands' including SSH and HTTP. By default, zgrab2 will accept input from stdin and output " +
32+
"results to stdout, with updates and logs to stderr. Please see 'zgrab2 <command> --help' for more details " +
33+
"on a specific command.",
34+
"Input is taken from stdin or --input-file, if specified. Input is CSV-formatted with 'IP, Domain, Tag, Port' " +
35+
"or simply 'IP' or 'Domain'. See README.md for more details.",
36+
"",
37+
"Example usages:",
38+
"echo '1.1.1.1' | zgrab2 tls # Scan 1.1.1.1 with TLS",
39+
"echo example.com | zgrab2 http # Scan example.com with HTTP",
40+
}
41+
parser.LongDescription = strings.Join(desc, "\n")
2542
}
2643

2744
// NewIniParser creates and returns a ini parser initialized

0 commit comments

Comments
 (0)