-
Notifications
You must be signed in to change notification settings - Fork 313
Adding new modules
justinbastress edited this page Feb 7, 2018
·
3 revisions
Modules are added by calling zgrab2.AddCommand("<module-id>", "<module-display-name>", "<module description>", <module default port>, &theModule)
, where theModule
is an instance of the appropriate Module
implementation.
A typical module will consist in the following files:
-
modules/<module-id>/scanner.go
: Package documentation should describe the protocol, the input flags, what the scan does, and the output format. The body should provide the followingstruct
s:-
Flags
: Implements zgrab2.ScanFlags. Defines the input arguments from the command line.- All modules should include
zgrab2.BaseFlags
- Modules that implement TLS should include
zgrab2.TLSFlags
- All modules should include
-
ScanResults
: This will be returned by theScanner.Scan()
method and JSON-encoded in the output. Ideally, this should provide both aMarshalJSON()
and anUnmarshalJSON()
method (if the defaults are not sufficient). - bar
- baz
-
-
modules/<module-id>.go
: Calls<module>.RegisterModule()
in itsinit()
function.