feat: 增加远程参数解析功能并重构扫描逻辑

This commit is contained in:
tongque
2025-04-22 19:04:00 +08:00
parent a3c5092f9b
commit 1f0d11d93e
2 changed files with 118 additions and 17 deletions
+10
View File
@@ -5,6 +5,7 @@ import (
"time"
"github.com/shadow1ng/fscan/Common"
"github.com/shadow1ng/fscan/Core"
pb "github.com/shadow1ng/fscan/RPC/lib"
)
@@ -24,6 +25,15 @@ func (s *FscanService) StartScan(ctx context.Context, req *pb.StartScanRequest)
Common.LogDebug("接收到扫描请求,目标: " + req.Arg + ", " + req.Secret)
// TODO: 在此处实现实际的扫描逻辑,例如调用扫描器、创建任务、存储任务状态等。
// 可以异步执行扫描逻辑,并生成一个唯一的 taskID 进行标识。
var info Common.HostInfo
if err := Common.FlagFromRemote(&info, req.Arg); err != nil {
return nil, err
}
if err := Common.Parse(&info); err != nil {
return nil, err
}
Common.LogDebug("解析参数成功,目标: " + info.Host + ", " + info.Ports)
go Core.Scan(info) // 建议异步执行
return &pb.StartScanResponse{
TaskId: "task_123456", // TODO: 返回真实生成的 taskID