From 9152304cb17486a3bf38f583edad2ef9bbeed64d Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 12 Jan 2024 10:02:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8A=93=E5=8C=85=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8D=95=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/trace/controller/tcpdump.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/modules/trace/controller/tcpdump.go b/src/modules/trace/controller/tcpdump.go index 62dc4f62..d4ffabea 100644 --- a/src/modules/trace/controller/tcpdump.go +++ b/src/modules/trace/controller/tcpdump.go @@ -70,6 +70,10 @@ func (s *TcpdumpController) NeTask(c *gin.Context) { c.JSON(200, result.ErrMsg(err.Error())) return } + if strings.Contains(msg, "command not found") { + c.JSON(200, result.ErrMsg("Command [tcpdump] Not Found")) + return + } c.JSON(200, result.OkData(map[string]any{ "cmd": cmdStr, @@ -211,6 +215,14 @@ func (s *TcpdumpController) NeUPFTask(c *gin.Context) { c.JSON(200, result.ErrMsg(err.Error())) return } + if strings.Contains(msg, "command not found") { + c.JSON(200, result.ErrMsg("Command [expect] Not Found")) + return + } + if strings.Contains(msg, "Unable to connect to remote host") { + c.JSON(200, result.ErrMsg("Connection Refused")) + return + } s := strings.Index(msg, "pcap dispatch trace:") if s != -1 { e := strings.Index(msg, "\r\nupfd1#")