comm

package
v0.0.0-...-2dbdbee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 35 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WorkerStatusMutex sync.Mutex
	WorkerStatus      = make(map[string]*ampq.WorkerStatus)
)
View Source
var (
	RsaPrivateKeyText []byte
	RsaPublicKeyText  []byte
)
View Source
var (

	// MainTaskResult 缓存汇总各个子任务、保存任务的结果
	MainTaskResult      map[string]MainTaskResultMap
	MainTaskResultMutex sync.Mutex
	// TLSEnabled 是否启用TLS加密
	TLSEnabled  bool
	TLSCertFile string
	TLSKeyFile  string
)
View Source
var WorkerName string

Functions

func CallXClient

func CallXClient(serviceMethod string, args interface{}, reply interface{}) error

CallXClient RPC远程调用

func DoKeepAlive

func DoKeepAlive(ws *ampq.WorkerStatus) bool

DoKeepAlive worker请求keepAlive

func GenerateRSAKey

func GenerateRSAKey() (err error)

GenerateRSAKey 生成web的RSA公、私钥

func GetWorkerNameByDaemon

func GetWorkerNameByDaemon() string

func GetWorkerNameBySelf

func GetWorkerNameBySelf() string

func KillWorker

func KillWorker() bool

KillWorker 停止当前worker进程

func StartFileSyncMonitor

func StartFileSyncMonitor()

StartFileSyncMonitor server文件变化检测并同步worker

func StartFileSyncServer

func StartFileSyncServer()

StartFileSyncServer 启动文件同步服务

func StartRPCServer

func StartRPCServer()

StartRPCServer 启动RPC server

func StartSaveRuntimeLog

func StartSaveRuntimeLog(source string)

func StartWorker

func StartWorker() bool

StartWorker 启动worker进程

func StartWorkerDaemon

func StartWorkerDaemon()

StartWorkerDaemon 启动worker的daemon

func WatchWorkerProcess

func WatchWorkerProcess()

WatchWorkerProcess worker进程状态监控

Types

type IconHashResultArgs

type IconHashResultArgs struct {
	WorkspaceId  int
	IconHashInfo []fingerprint.IconHashInfo
}

IconHashResultArgs icconhash保存的结果值

type KeepAliveDaemonInfo

type KeepAliveDaemonInfo struct {
	ManualReloadFlag       bool
	ManualFileSyncFlag     bool
	ManualUpdateOptionFlag bool
	WorkerRunOption        *WorkerOption
}

func DoDaemonKeepAlive

func DoDaemonKeepAlive() (replay KeepAliveDaemonInfo, err error)

DoDaemonKeepAlive worker请求keepAlive

type KeepAliveWorkerInfo

type KeepAliveWorkerInfo struct {
	WorkerStatus ampq.WorkerStatus
}

type LoadDomainOpenedPortArgs

type LoadDomainOpenedPortArgs struct {
	WorkspaceId int
	Target      map[string]struct{}
}

type LoadIPOpenedPortArgs

type LoadIPOpenedPortArgs struct {
	WorkspaceId int
	Target      string
}

type MainTaskResultMap

type MainTaskResultMap struct {
	IPResult         map[string]map[int]interface{}
	DomainResult     map[string]interface{}
	VulResult        map[string]map[string]interface{}
	ScreenShotResult int
	IPNew            int
	PortNew          int
	DomainNew        int
	VulnerabilityNew int
}

type NewTaskArgs

type NewTaskArgs struct {
	TaskName      string
	ConfigJSON    string
	MainTaskID    string
	LastRunTaskId string
}

NewTaskArgs 新建任务请求与返回参数

type RuntimeLogArgs

type RuntimeLogArgs struct {
	Source     string
	LogMessage []byte
}

type ScanResultArgs

type ScanResultArgs struct {
	TaskID              string
	MainTaskId          string
	IPConfig            *portscan.Config
	DomainConfig        *domainscan.Config
	IPResult            map[string]*portscan.IPResult
	DomainResult        map[string]*domainscan.DomainResult
	VulnerabilityResult []pocscan.Result
}

ScanResultArgs IP与域名扫描结果请求参数

type ScreenshotResultArgs

type ScreenshotResultArgs struct {
	MainTaskId  string
	WorkspaceId int
	FileInfo    []fingerprint.ScreenshotFileInfo
}

ScreenshotResultArgs screenshot结果请求参数

type Service

type Service struct{}

Service RPC服务

func (*Service) CheckTask

func (s *Service) CheckTask(ctx context.Context, args *string, replay *TaskStatusArgs) error

CheckTask 检查任务在数据库中的状态:任务是否存在、是否被取消,任务状态、结果

func (*Service) KeepAlive

func (s *Service) KeepAlive(ctx context.Context, args *KeepAliveWorkerInfo, replay *string) error

KeepAlive worker通过RPC,保持与server的心跳与同步

func (*Service) KeepDaemonAlive

func (s *Service) KeepDaemonAlive(ctx context.Context, args *string, replay *KeepAliveDaemonInfo) error

KeepDaemonAlive worker的daemon通过RPC,保持与server的心跳与同步

func (*Service) LoadDomainByOrgId

func (s *Service) LoadDomainByOrgId(ctx context.Context, args *int, replay *map[string]*domainscan.DomainResult) error

LoadDomainByOrgId 根据组织ID读取Domain资产

func (*Service) LoadDomainOpenedPort

func (s *Service) LoadDomainOpenedPort(ctx context.Context, args *LoadDomainOpenedPortArgs, replay *map[string]map[int]struct{}) error

LoadDomainOpenedPort 获取域名关联的IP的端口

func (*Service) LoadIpByOrgId

func (s *Service) LoadIpByOrgId(ctx context.Context, args *int, replay *map[string]*portscan.IPResult) error

LoadIpByOrgId 根据组织ID读取IP资产

func (*Service) LoadOpenedPort

func (s *Service) LoadOpenedPort(ctx context.Context, args *LoadIPOpenedPortArgs, replay *string) error

LoadOpenedPort 读取指定IP已开放的全部端口

func (*Service) NewTask

func (s *Service) NewTask(ctx context.Context, args *NewTaskArgs, replay *string) error

NewTask 创建一个新执行任务

func (*Service) SaveICPResult

func (s *Service) SaveICPResult(ctx context.Context, args *map[string]*onlineapi.ICPInfo, replay *string) error

SaveICPResult 保存ICP查询结果到服务器的查询缓存文件中

func (*Service) SaveIconImageResult

func (s *Service) SaveIconImageResult(ctx context.Context, args *IconHashResultArgs, replay *string) error

SaveIconImageResult 保存IconImage结果到Server

func (*Service) SaveRuntimeLog

func (s *Service) SaveRuntimeLog(ctx context.Context, args *RuntimeLogArgs, replay *string) error

SaveRuntimeLog 保存RuntimeLog

func (*Service) SaveScanResult

func (s *Service) SaveScanResult(ctx context.Context, args *ScanResultArgs, replay *string) error

SaveScanResult 保存IP与域名的扫描结果

func (*Service) SaveScreenshotResult

func (s *Service) SaveScreenshotResult(ctx context.Context, args *ScreenshotResultArgs, replay *string) error

SaveScreenshotResult 保存Screenshot的结果到Server

func (*Service) SaveVulnerabilityResult

func (s *Service) SaveVulnerabilityResult(ctx context.Context, args *ScanResultArgs, replay *string) error

SaveVulnerabilityResult 保存漏洞结果

func (*Service) SaveWhoisResult

func (s *Service) SaveWhoisResult(ctx context.Context, args *map[string]*whoisparser.WhoisInfo, replay *string) error

SaveWhoisResult 保存whois查询结果到服务器的查询缓存文件中

func (*Service) UpdateTask

func (s *Service) UpdateTask(ctx context.Context, args *TaskStatusArgs, replay *bool) error

UpdateTask 更新任务状态到数据库中

type TaskStatusArgs

type TaskStatusArgs struct {
	TaskID     string
	IsExist    bool
	IsRevoked  bool
	IsFinished bool
	State      string
	Worker     string
	Result     string
}

TaskStatusArgs 任务状态请求与返回参数

type WorkerDaemonOption

type WorkerDaemonOption struct {
	Concurrency       int
	WorkerPerformance int
	NoFilesync        bool
	NoProxy           bool
	WorkerRunTaskMode string
	TaskWorkspaceGUID string
	ManualSyncHost    string
	ManualSyncPort    string
	ManualSyncAuth    string
	TLSEnabled        bool
	DefaultConfigFile string
}
var DaemonRunOption *WorkerDaemonOption

type WorkerOption

type WorkerOption struct {
	Concurrency       int                 `json:"concurrency" form:"concurrency"`
	WorkerPerformance int                 `json:"worker_performance" form:"worker_performance"`
	WorkerRunTaskMode string              `json:"worker_run_task_mode" form:"worker_run_task_mode"`
	TaskWorkspaceGUID string              `json:"task_workspace_guid" form:"task_workspace_guid"`
	WorkerTopic       map[string]struct{} `json:"-"`
	TLSEnabled        bool                `json:"-"`
	DefaultConfigFile string              `json:"default_config_file" form:"default_config_file"`
	NoProxy           bool                `json:"no_proxy" form:"no_proxy"`
}
var WorkerRunOption *WorkerOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL