From e7535b764d01f807d926efa6bbff5541cb9be871 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 4 Oct 2017 11:20:17 -0400 Subject: [PATCH] Name changes, readme changes --- README.md | 25 +++++++------------------ cmd/zgrab2/main.go | 8 ++++---- {zmodules => modules}/http.go | 2 +- {zmodules => modules}/ssh.go | 2 +- {zmodules => modules}/tls.go | 2 +- 5 files changed, 14 insertions(+), 25 deletions(-) rename {zmodules => modules}/http.go (99%) rename {zmodules => modules}/ssh.go (98%) rename {zmodules => modules}/tls.go (99%) diff --git a/README.md b/README.md index 7be7435..d3f9d2f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Zgrab 2.0 +ZGrab 2.0 ========= This repo contains the new ZGrab framework, and will eventually replace https://github.com/zmap/zgrab. @@ -22,7 +22,7 @@ $ make ## Single Module Usage -Zgrab2 supports modules. For example, to run the ssh module use +ZGrab2 supports modules. For example, to run the ssh module use ``` ./zgrab2 ssh @@ -57,30 +57,19 @@ port=22 ## Adding New Protocols -Add module to zmodules/ that satisfies the following interface: -``` -type Protocol interface { - Scan(ip net.IP) (interface{}, error) - Validate(args []string) error - PerRoutineInitialize() - New() interface{} -} -``` +Add module to modules/ that satisfies the following interfaces: `Scanner`, `ScanModule`, `ScanFlags`. -The struct must embed zgrab2.BaseProtocol. In the files `init()` function the following must be included. +The flags struct must embed zgrab2.BaseFlags. In the modules `init()` function the following must be included. ``` func init() { - var configStruct ConfigStruct - cmd, err := zgrab2.AddCommand("module", "short description", "long description of module", &configStruct) + var newModule NewModule + _, err := zgrab2.AddCommand("module", "short description", "long description of module", portNumber, &newModule) if err != nil { log.Fatal(err) } - configStruct.SetDefaultPortAndName(cmd, uint(00), "module") } ``` -The `Validate()` function should make a call to `zgrab2.RegisterLookup()`. - ## License -Zgrab is licensed under Apache 2.0 and ISC. For more information, see the LICENSE file. +ZGrab2.0 is licensed under Apache 2.0 and ISC. For more information, see the LICENSE file. diff --git a/cmd/zgrab2/main.go b/cmd/zgrab2/main.go index bea3ba7..d67568b 100644 --- a/cmd/zgrab2/main.go +++ b/cmd/zgrab2/main.go @@ -8,7 +8,7 @@ import ( flags "github.com/ajholland/zflags" log "github.com/sirupsen/logrus" "github.com/zmap/zgrab2" - _ "github.com/zmap/zgrab2/zmodules" + _ "github.com/zmap/zgrab2/modules" ) func main() { @@ -53,14 +53,14 @@ func main() { s.Init(flag) zgrab2.RegisterScan(moduleType, s) } - m := zgrab2.MakeMonitor() + monitor := zgrab2.MakeMonitor() start := time.Now() log.Infof("started grab at %s", start.Format(time.RFC3339)) - zgrab2.Process(m) + zgrab2.Process(monitor) end := time.Now() log.Infof("finished grab at %s", end.Format(time.RFC3339)) s := Summary{ - StatusesPerModule: m.GetStatuses(), + StatusesPerModule: monitor.GetStatuses(), StartTime: start.Format(time.RFC3339), EndTime: end.Format(time.RFC3339), Duration: end.Sub(start).String(), diff --git a/zmodules/http.go b/modules/http.go similarity index 99% rename from zmodules/http.go rename to modules/http.go index 31d18d1..0214bf2 100644 --- a/zmodules/http.go +++ b/modules/http.go @@ -1,4 +1,4 @@ -package zmodules +package modules import ( log "github.com/sirupsen/logrus" diff --git a/zmodules/ssh.go b/modules/ssh.go similarity index 98% rename from zmodules/ssh.go rename to modules/ssh.go index 25ddbe5..fb505aa 100644 --- a/zmodules/ssh.go +++ b/modules/ssh.go @@ -1,4 +1,4 @@ -package zmodules +package modules import ( log "github.com/sirupsen/logrus" diff --git a/zmodules/tls.go b/modules/tls.go similarity index 99% rename from zmodules/tls.go rename to modules/tls.go index 4e53204..7024864 100644 --- a/zmodules/tls.go +++ b/modules/tls.go @@ -1,4 +1,4 @@ -package zmodules +package modules import ( log "github.com/sirupsen/logrus"