diff --git a/src/genmai/ExplorerSystem.go b/src/genmai/ExplorerSystem.go index 80b6057..5d64425 100644 --- a/src/genmai/ExplorerSystem.go +++ b/src/genmai/ExplorerSystem.go @@ -65,8 +65,8 @@ type ExplorerSystem struct { /////////////////////////////// // ExplorerSystem functions -func (ek *ExplorerSystem)GetExplorerConfigSystem() (config *ExplorerConfigSystem, rc error) { - cf, ret := ek.ExplorerCommon.EcConfig.(*ExplorerConfigSystem) +func (es *ExplorerSystem)GetExplorerConfigSystem() (config *ExplorerConfigSystem, rc error) { + cf, ret := es.ExplorerCommon.EcConfig.(*ExplorerConfigSystem) /* */ if (true == ret) { rc = nil @@ -79,14 +79,14 @@ func (ek *ExplorerSystem)GetExplorerConfigSystem() (config *ExplorerConfigSystem return config, rc } -func (ek *ExplorerSystem)SetupSandbox(sb sandbox.SandboxBase) { - ek.EsSandbox = sb +func (es *ExplorerSystem)SetupSandbox(sb sandbox.SandboxBase) { + es.EsSandbox = sb /* */ - ek.isSetup = true + es.isSetup = true } -func (ek *ExplorerSystem)startWithPath(execpath string, args ...string) error { - interio , rc := ek.EsSandbox.Process(execpath, args...) +func (es *ExplorerSystem)startWithPath(execpath string, args ...string) error { + interio , rc := es.EsSandbox.Process(execpath, args...) /* */ if (nil != rc) { A_DEBUG_ERROR("startWithPath()->Process() error! rc = ", rc) @@ -94,7 +94,7 @@ func (ek *ExplorerSystem)startWithPath(execpath string, args ...string) error { return rc } - config, rc1 := ek.GetExplorerConfigSystem() + config, rc1 := es.GetExplorerConfigSystem() rc = rc1 if (nil != rc) { A_DEBUG_ERROR("startWithPath()->GetExplorerConfigSystem() error ! rc = ", rc) @@ -144,8 +144,8 @@ func (ek *ExplorerSystem)startWithPath(execpath string, args ...string) error { return rc } -func (ek *ExplorerSystem)Start(path string) (rc error) { - config, rc_t := ek.GetExplorerConfigSystem() +func (es *ExplorerSystem)Start() (rc error) { + config, rc_t := es.GetExplorerConfigSystem() rc = rc_t if (nil != rc) { A_DEBUG_ERROR("Start()->GetExplorerConfigSystem() error! rc = ", rc) @@ -154,7 +154,7 @@ func (ek *ExplorerSystem)Start(path string) (rc error) { } for _, im := range config.SiteRequests.ImArray { - rc = ek.startWithPath(ek.ExplorerCommon.EcConfigFilePrefix + + rc = es.startWithPath(es.ExplorerCommon.EcConfigFilePrefix + string(os.PathSeparator) + im.Exec , im.Args ) @@ -163,6 +163,20 @@ func (ek *ExplorerSystem)Start(path string) (rc error) { return rc } +/////////////////////////////// +// override ExplorerBase functions +func (es *ExplorerSystem)Explore(configfile string) (rp ReportCommon, rc error) { + es.Setup(&ConfigParserYAML{}, &ExplorerConfigSystem{}) + es.LoadConfig(configfile) + + es.SetupSandbox(&sandbox.SandboxDefault{}) + + es.Start() + + // TODO: + return ReportCommon{}, nil +} + /////////////////////////////// // override functions diff --git a/src/genmai/ReportWeb.go b/src/genmai/ReportWeb.go new file mode 100644 index 0000000..371df0e --- /dev/null +++ b/src/genmai/ReportWeb.go @@ -0,0 +1,75 @@ +//////////////////////////////////////////////////////////////// +// +// Filename: ReportWeb.go +// +// Version: 1.0 +// Created: 2022年11月17日 18时06分56秒 +// Revision: none +// Compiler: go +// +// Author: alpha +// Organization: alpha +// Contacts: chenxinquan@kylinos.com +// +//////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +// Description: +//////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +// Log: +//////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +// Todo: +// +//////////////////////////////////////////////////////////////// + +package genmai + +import ( + "time" +) + +type ReportWeb struct { + ReportCommon +} + +func GetADefaultReportWeb() ReportWeb { + return ReportWeb{ + ReportCommon { + RCServerUUID: "1234-5678-1234-5678", + RCServerName: "aServer", + RCFamily: "RCFamily", + RCRelease: "RCRelease", + RCContainer: "RCContainer", + /* */ + RCExploredTimeAt: time.Now(), + RCExploredMode: "RCExploredMode", + RCExploredVersion: "RCExploredVersion", + RCExploredRevision: "RCExploredRevision", + RCExploredBy: "RCExploredBy", + RCExploredVia: "RCExploredVia", + //RCExploredIPv4Addrs: + //RCExploredIPv6Addrs: + /* */ + RCReportedAt: time.Now(), + RCReportedVersion: "RCReportedVersion", + RCReportedBy: "RCReportedBy", + /* */ + RCErrors: "RCErrors", + RCWarnings: "RCWarnings", + + RCExploredVulns: "RCExploredVulns", // TBD: type + RCReunningKernelInfo:ReportKernelInfo { + "0.0", + "0.0", + false, + }, + RCPackages: "RCPackages", // TBD: type + RCSrcPackages: "RCSrcPackages", // TBD: type + RCOptional: "RCOptional", // TBD: type + }, + } +}