| @@ -591,64 +591,6 @@ type NodeAsset { | |||||
| ParticipantId int64 `json:"ParticipantId"` // 集群动态信息id | ParticipantId int64 `json:"ParticipantId"` // 集群动态信息id | ||||
| } | } | ||||
| type SaveHashcatReq { | |||||
| CrackTaskId string `json:"crackTaskId"` // 任务id | |||||
| CrackContainerId string `json:"crackContainerId"` // 容器id | |||||
| CrackStatus string `json:"crackStatus"` // 状态 | |||||
| CrackStartTime string `json:"crackStartTime"` //开始时间 | |||||
| CrackEstimatedTime string `json:"crackEstimatedTime"` // 预计时间 | |||||
| CrackProgress string `json:"crackProgress"` // 进度 | |||||
| CrackResult string `json:"crackResult"` // 结果 | |||||
| Started string `json:"started"` // 开始时间 | |||||
| Stopped string `json:"stopped"` // 结束时间 | |||||
| KernelFeature string `json:"kernelFeature"` | |||||
| HashMode string `json:"hashMode"` | |||||
| Rejected string `json:"rejected"` | |||||
| Session string `json:"session"` | |||||
| HashTarget string `json:"hashTarget"` | |||||
| Speed string `json:"speed"` | |||||
| Candidates string `json:"candidates"` | |||||
| RestorePoint string `json:"restorePoint"` | |||||
| Recovered string `json:"recovered"` | |||||
| GuessQueue string `json:"guessQueue"` | |||||
| CandidateEngine string `json:"candidateEngine"` | |||||
| GuessMask string `json:"guessMask"` | |||||
| RestoreSub string `json:"restoreSub"` | |||||
| } | |||||
| type getHashcatHandlerReq { | |||||
| CrackTaskId string `path:"crackTaskId"` // 任务id | |||||
| } | |||||
| type getHashcatHandlerResp { | |||||
| HashCatList []HashCat `json:"hashCatList"` | |||||
| } | |||||
| type HashCat { | |||||
| CrackTaskId string `json:"crackTaskId"` // 任务id | |||||
| CrackContainerId string `json:"crackContainerId"` // 容器id | |||||
| CrackStatus string `json:"crackStatus"` // 状态 | |||||
| CrackStartTime string `json:"crackStartTime"` //开始时间 | |||||
| CrackEstimatedTime string `json:"crackEstimatedTime"` // 预计时间 | |||||
| CrackProgress string `json:"crackProgress"` // 进度 | |||||
| CrackResult string `json:"crackResult"` // 结果 | |||||
| Started string `json:"started"` // 开始时间 | |||||
| Stopped string `json:"stopped"` // 结束时间 | |||||
| KernelFeature string `json:"kernelFeature"` | |||||
| HashMode string `json:"hashMode"` | |||||
| Rejected string `json:"rejected"` | |||||
| Session string `json:"session"` | |||||
| HashTarget string `json:"hashTarget"` | |||||
| Speed string `json:"speed"` | |||||
| Candidates string `json:"candidates"` | |||||
| RestorePoint string `json:"restorePoint"` | |||||
| Recovered string `json:"recovered"` | |||||
| GuessQueue string `json:"guessQueue"` | |||||
| CandidateEngine string `json:"candidateEngine"` | |||||
| GuessMask string `json:"guessMask"` | |||||
| RestoreSub string `json:"restoreSub"` | |||||
| } | |||||
| type participantListResp { | type participantListResp { | ||||
| Participants []Participant `json:"participants"` | Participants []Participant `json:"participants"` | ||||
| } | } | ||||
| @@ -108,14 +108,6 @@ service pcm { | |||||
| @handler nodeAssetsHandler | @handler nodeAssetsHandler | ||||
| get /core/assets returns (NodeAssetsResp) | get /core/assets returns (NodeAssetsResp) | ||||
| @doc "保存hashcat" | |||||
| @handler saveHashcatHandler | |||||
| post /core/saveHashcat (SaveHashcatReq) | |||||
| @doc "获取hashcat" | |||||
| @handler getHashcatHandler | |||||
| get /core/getHashcat/:crackTaskId (getHashcatHandlerReq) returns (getHashcatHandlerResp) | |||||
| @doc "Center Resources top3" | @doc "Center Resources top3" | ||||
| @handler centerResourcesHandler | @handler centerResourcesHandler | ||||
| get /core/centerResources returns (centerResourcesResp) | get /core/centerResources returns (centerResourcesResp) | ||||
| @@ -1,39 +0,0 @@ | |||||
| /* | |||||
| Copyright (c) [2023] [pcm] | |||||
| [pcm-coordinator] is licensed under Mulan PSL v2. | |||||
| You can use this software according to the terms and conditions of the Mulan PSL v2. | |||||
| You may obtain a copy of Mulan PSL v2 at: | |||||
| http://license.coscl.org.cn/MulanPSL2 | |||||
| THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | |||||
| EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | |||||
| MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | |||||
| See the Mulan PSL v2 for more details. | |||||
| */ | |||||
| package core | |||||
| import ( | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func GetHashcatHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.GetHashcatHandlerReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewGetHashcatLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetHashcat(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,39 +0,0 @@ | |||||
| /* | |||||
| Copyright (c) [2023] [pcm] | |||||
| [pcm-coordinator] is licensed under Mulan PSL v2. | |||||
| You can use this software according to the terms and conditions of the Mulan PSL v2. | |||||
| You may obtain a copy of Mulan PSL v2 at: | |||||
| http://license.coscl.org.cn/MulanPSL2 | |||||
| THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | |||||
| EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | |||||
| MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | |||||
| See the Mulan PSL v2 for more details. | |||||
| */ | |||||
| package core | |||||
| import ( | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/core" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func SaveHashcatHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.SaveHashcatReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewSaveHashcatLogic(r.Context(), svcCtx) | |||||
| err := l.SaveHashcat(&req) | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | |||||
| } | |||||
| @@ -126,16 +126,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | |||||
| Path: "/core/assets", | Path: "/core/assets", | ||||
| Handler: core.NodeAssetsHandler(serverCtx), | Handler: core.NodeAssetsHandler(serverCtx), | ||||
| }, | }, | ||||
| { | |||||
| Method: http.MethodPost, | |||||
| Path: "/core/saveHashcat", | |||||
| Handler: core.SaveHashcatHandler(serverCtx), | |||||
| }, | |||||
| { | |||||
| Method: http.MethodGet, | |||||
| Path: "/core/getHashcat/:crackTaskId", | |||||
| Handler: core.GetHashcatHandler(serverCtx), | |||||
| }, | |||||
| { | { | ||||
| Method: http.MethodGet, | Method: http.MethodGet, | ||||
| Path: "/core/centerResources", | Path: "/core/centerResources", | ||||
| @@ -1,50 +0,0 @@ | |||||
| /* | |||||
| Copyright (c) [2023] [pcm] | |||||
| [pcm-coordinator] is licensed under Mulan PSL v2. | |||||
| You can use this software according to the terms and conditions of the Mulan PSL v2. | |||||
| You may obtain a copy of Mulan PSL v2 at: | |||||
| http://license.coscl.org.cn/MulanPSL2 | |||||
| THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | |||||
| EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | |||||
| MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | |||||
| See the Mulan PSL v2 for more details. | |||||
| */ | |||||
| package core | |||||
| import ( | |||||
| "context" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils" | |||||
| ) | |||||
| type GetHashcatLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewGetHashcatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHashcatLogic { | |||||
| return &GetHashcatLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *GetHashcatLogic) GetHashcat(req *types.GetHashcatHandlerReq) (resp *types.GetHashcatHandlerResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| var hashcatList []*models.THashcat | |||||
| tx := l.svcCtx.DbEngin.Where("crack_task_id = ?", req.CrackTaskId).Find(&hashcatList) | |||||
| if tx.Error != nil { | |||||
| return nil, tx.Error | |||||
| } | |||||
| result := types.GetHashcatHandlerResp{} | |||||
| utils.Convert(hashcatList, &result.HashCatList) | |||||
| return &result, nil | |||||
| } | |||||
| @@ -1,49 +0,0 @@ | |||||
| /* | |||||
| Copyright (c) [2023] [pcm] | |||||
| [pcm-coordinator] is licensed under Mulan PSL v2. | |||||
| You can use this software according to the terms and conditions of the Mulan PSL v2. | |||||
| You may obtain a copy of Mulan PSL v2 at: | |||||
| http://license.coscl.org.cn/MulanPSL2 | |||||
| THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | |||||
| EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | |||||
| MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | |||||
| See the Mulan PSL v2 for more details. | |||||
| */ | |||||
| package core | |||||
| import ( | |||||
| "context" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils" | |||||
| ) | |||||
| type SaveHashcatLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewSaveHashcatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SaveHashcatLogic { | |||||
| return &SaveHashcatLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *SaveHashcatLogic) SaveHashcat(req *types.SaveHashcatReq) error { | |||||
| var hashcat models.THashcat | |||||
| utils.Convert(req, &hashcat) | |||||
| hashcat.Id = utils.GenSnowflakeID() | |||||
| tx := l.svcCtx.DbEngin.Save(hashcat) | |||||
| if tx.Error != nil { | |||||
| return tx.Error | |||||
| } | |||||
| return nil | |||||
| } | |||||
| @@ -557,64 +557,6 @@ type NodeAsset struct { | |||||
| ParticipantId int64 `json:"ParticipantId"` // 集群动态信息id | ParticipantId int64 `json:"ParticipantId"` // 集群动态信息id | ||||
| } | } | ||||
| type SaveHashcatReq struct { | |||||
| CrackTaskId string `json:"crackTaskId"` // 任务id | |||||
| CrackContainerId string `json:"crackContainerId"` // 容器id | |||||
| CrackStatus string `json:"crackStatus"` // 状态 | |||||
| CrackStartTime string `json:"crackStartTime"` //开始时间 | |||||
| CrackEstimatedTime string `json:"crackEstimatedTime"` // 预计时间 | |||||
| CrackProgress string `json:"crackProgress"` // 进度 | |||||
| CrackResult string `json:"crackResult"` // 结果 | |||||
| Started string `json:"started"` // 开始时间 | |||||
| Stopped string `json:"stopped"` // 结束时间 | |||||
| KernelFeature string `json:"kernelFeature"` | |||||
| HashMode string `json:"hashMode"` | |||||
| Rejected string `json:"rejected"` | |||||
| Session string `json:"session"` | |||||
| HashTarget string `json:"hashTarget"` | |||||
| Speed string `json:"speed"` | |||||
| Candidates string `json:"candidates"` | |||||
| RestorePoint string `json:"restorePoint"` | |||||
| Recovered string `json:"recovered"` | |||||
| GuessQueue string `json:"guessQueue"` | |||||
| CandidateEngine string `json:"candidateEngine"` | |||||
| GuessMask string `json:"guessMask"` | |||||
| RestoreSub string `json:"restoreSub"` | |||||
| } | |||||
| type GetHashcatHandlerReq struct { | |||||
| CrackTaskId string `path:"crackTaskId"` // 任务id | |||||
| } | |||||
| type GetHashcatHandlerResp struct { | |||||
| HashCatList []HashCat `json:"hashCatList"` | |||||
| } | |||||
| type HashCat struct { | |||||
| CrackTaskId string `json:"crackTaskId"` // 任务id | |||||
| CrackContainerId string `json:"crackContainerId"` // 容器id | |||||
| CrackStatus string `json:"crackStatus"` // 状态 | |||||
| CrackStartTime string `json:"crackStartTime"` //开始时间 | |||||
| CrackEstimatedTime string `json:"crackEstimatedTime"` // 预计时间 | |||||
| CrackProgress string `json:"crackProgress"` // 进度 | |||||
| CrackResult string `json:"crackResult"` // 结果 | |||||
| Started string `json:"started"` // 开始时间 | |||||
| Stopped string `json:"stopped"` // 结束时间 | |||||
| KernelFeature string `json:"kernelFeature"` | |||||
| HashMode string `json:"hashMode"` | |||||
| Rejected string `json:"rejected"` | |||||
| Session string `json:"session"` | |||||
| HashTarget string `json:"hashTarget"` | |||||
| Speed string `json:"speed"` | |||||
| Candidates string `json:"candidates"` | |||||
| RestorePoint string `json:"restorePoint"` | |||||
| Recovered string `json:"recovered"` | |||||
| GuessQueue string `json:"guessQueue"` | |||||
| CandidateEngine string `json:"candidateEngine"` | |||||
| GuessMask string `json:"guessMask"` | |||||
| RestoreSub string `json:"restoreSub"` | |||||
| } | |||||
| type ParticipantListResp struct { | type ParticipantListResp struct { | ||||
| Participants []Participant `json:"participants"` | Participants []Participant `json:"participants"` | ||||
| } | } | ||||
| @@ -1,50 +0,0 @@ | |||||
| // Code generated by goctl. DO NOT EDIT. | |||||
| package models | |||||
| import ( | |||||
| "github.com/zeromicro/go-zero/core/stores/sqlx" | |||||
| ) | |||||
| type ( | |||||
| defaultTHashcatModel struct { | |||||
| conn sqlx.SqlConn | |||||
| table string | |||||
| } | |||||
| THashcat struct { | |||||
| Id int64 `db:"id"` // id | |||||
| CrackTaskId string `db:"crack_task_id"` // 任务id | |||||
| CrackContainerId string `db:"container_id"` // 任务id | |||||
| CrackStatus string `db:"crack_status"` // 状态 | |||||
| CrackStartTime string `db:"crack_start_time"` //开始时间 | |||||
| CrackEstimatedTime string `db:"crack_estimated_time"` // 预计时间 | |||||
| CrackProgress string `db:"crack_progress"` // 进度 | |||||
| CrackResult string `db:"crack_result"` // 结果 | |||||
| Started string `db:"started"` // 开始时间 | |||||
| Stopped string `db:"stopped"` // 结束时间 | |||||
| CreatedBy int64 `db:"created_by"` // 创建人 | |||||
| UpdatedBy int64 `db:"updated_by"` // 更新人 | |||||
| DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是) | |||||
| KernelFeature string `db:"kernel_feature"` | |||||
| HashMode string `db:"hash_mode"` | |||||
| Rejected string `db:"rejected"` | |||||
| Session string `db:"session"` | |||||
| HashTarget string `db:"hash_target"` | |||||
| Speed string `db:"speed"` | |||||
| Candidates string `db:"candidates"` | |||||
| RestorePoint string `db:"restore_point"` | |||||
| Recovered string `db:"recovered"` | |||||
| GuessQueue string `db:"guess_queue"` | |||||
| CandidateEngine string `db:"candidate_engine"` | |||||
| GuessMask string `db:"guess_mask"` | |||||
| RestoreSub string `db:"restore_sub"` | |||||
| } | |||||
| ) | |||||
| func newTHashcatModel(conn sqlx.SqlConn) *defaultCloudModel { | |||||
| return &defaultCloudModel{ | |||||
| conn: conn, | |||||
| table: "`cloud`", | |||||
| } | |||||
| } | |||||