修改优化src/genmai/ExplorerSystem.go,编写ReportWeb.go制定初步报告结构

This commit is contained in:
chenxinquan 2022-11-17 18:10:14 +08:00
parent 0378cb1495
commit 7198b018f9
2 changed files with 100 additions and 11 deletions

View File

@ -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

75
src/genmai/ReportWeb.go Normal file
View File

@ -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
},
}
}