From 5afb14d842d7852f182b894775e88be99853df16 Mon Sep 17 00:00:00 2001 From: JiChen Date: Mon, 17 Jan 2022 11:45:14 +0800 Subject: [PATCH] =?UTF-8?q?replace=20=EF=BC=9A(chinese=20punctuation)=20wi?= =?UTF-8?q?th=20:=20in=20source=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: JiChen --- .../tools/detect/net_diag/netinfo/__init__.py | 4 +- .../tools/detect/net_diag/netinfo/compile.py | 4 +- .../detect/net_diag/netinfo/influxSend.py | 4 +- .../tools/detect/net_diag/netinfo/longBase.py | 4 +- source/tools/detect/net_diag/netinfo/main.py | 4 +- .../detect/net_diag/netinfo/netCollect.py | 4 +- .../detect/net_diag/netinfo/netinfoMon.py | 4 +- .../tools/detect/net_diag/netinfo/pingSls.py | 4 +- .../tools/detect/net_diag/netinfo/pktMon.py | 4 +- .../tools/detect/net_diag/netinfo/pktdrop.py | 4 +- .../detect/net_diag/netinfo/pylcc/__init__.py | 4 +- .../detect/net_diag/netinfo/pylcc/lbcBase.py | 4 +- .../detect/net_diag/netinfo/pylcc/lbcCon.py | 4 +- .../detect/net_diag/netinfo/pylcc/lbcMaps.py | 4 +- .../net_diag/netinfo/pylcc/localExceptions.py | 4 +- .../detect/net_diag/netinfo/retransMon.py | 4 +- .../detect/net_diag/netinfo/runlatency.py | 4 +- .../detect/net_diag/netinfo/socketStat.py | 4 +- source/tools/detect/surftrace/surftrace.py | 40 +++++++++---------- .../tools/monitor/mon_connect/mon_connect.py | 24 +++++------ 20 files changed, 68 insertions(+), 68 deletions(-) diff --git a/source/tools/detect/net_diag/netinfo/__init__.py b/source/tools/detect/net_diag/netinfo/__init__.py index 4e7476e3..97fbed29 100644 --- a/source/tools/detect/net_diag/netinfo/__init__.py +++ b/source/tools/detect/net_diag/netinfo/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: __init__.py + File Name: __init__.py Description : Author : liaozhaoyan - date: 2021/6/27 + date: 2021/6/27 ------------------------------------------------- Change Activity: 2021/6/27: diff --git a/source/tools/detect/net_diag/netinfo/compile.py b/source/tools/detect/net_diag/netinfo/compile.py index 85abc2f8..b4b51796 100644 --- a/source/tools/detect/net_diag/netinfo/compile.py +++ b/source/tools/detect/net_diag/netinfo/compile.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: compile + File Name: compile Description : Author : liaozhaoyan - date: 2021/9/8 + date: 2021/9/8 ------------------------------------------------- Change Activity: 2021/9/8: diff --git a/source/tools/detect/net_diag/netinfo/influxSend.py b/source/tools/detect/net_diag/netinfo/influxSend.py index 7421067d..597073bc 100644 --- a/source/tools/detect/net_diag/netinfo/influxSend.py +++ b/source/tools/detect/net_diag/netinfo/influxSend.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: influxSend + File Name: influxSend Description : Author : liaozhaoyan - date: 2021/6/26 + date: 2021/6/26 ------------------------------------------------- Change Activity: 2021/6/26: diff --git a/source/tools/detect/net_diag/netinfo/longBase.py b/source/tools/detect/net_diag/netinfo/longBase.py index 55d3b958..fb982716 100644 --- a/source/tools/detect/net_diag/netinfo/longBase.py +++ b/source/tools/detect/net_diag/netinfo/longBase.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: longBase + File Name: longBase Description : Author : liaozhaoyan - date: 2021/8/14 + date: 2021/8/14 ------------------------------------------------- Change Activity: 2021/8/14: diff --git a/source/tools/detect/net_diag/netinfo/main.py b/source/tools/detect/net_diag/netinfo/main.py index 0e425c46..8a96c988 100644 --- a/source/tools/detect/net_diag/netinfo/main.py +++ b/source/tools/detect/net_diag/netinfo/main.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: main + File Name: main Description : Author : liaozhaoyan - date: 2021/8/12 + date: 2021/8/12 ------------------------------------------------- Change Activity: 2021/8/12: diff --git a/source/tools/detect/net_diag/netinfo/netCollect.py b/source/tools/detect/net_diag/netinfo/netCollect.py index 88b6716d..9b3fc3a8 100644 --- a/source/tools/detect/net_diag/netinfo/netCollect.py +++ b/source/tools/detect/net_diag/netinfo/netCollect.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: netCollect.py + File Name: netCollect.py Description : Author : liaozhaoyan - date: 2021/8/5 + date: 2021/8/5 ------------------------------------------------- Change Activity: 2021/8/5: diff --git a/source/tools/detect/net_diag/netinfo/netinfoMon.py b/source/tools/detect/net_diag/netinfo/netinfoMon.py index 004ab9fc..edfbc4b0 100644 --- a/source/tools/detect/net_diag/netinfo/netinfoMon.py +++ b/source/tools/detect/net_diag/netinfo/netinfoMon.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: netinfoMon + File Name: netinfoMon Description : Author : liaozhaoyan - date: 2021/7/14 + date: 2021/7/14 ------------------------------------------------- Change Activity: 2021/7/14: diff --git a/source/tools/detect/net_diag/netinfo/pingSls.py b/source/tools/detect/net_diag/netinfo/pingSls.py index fac7dea6..11db44c6 100644 --- a/source/tools/detect/net_diag/netinfo/pingSls.py +++ b/source/tools/detect/net_diag/netinfo/pingSls.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: pingSls.py + File Name: pingSls.py Description : Author : liaozhaoyan - date: 2021/8/3 + date: 2021/8/3 ------------------------------------------------- Change Activity: 2021/8/3: diff --git a/source/tools/detect/net_diag/netinfo/pktMon.py b/source/tools/detect/net_diag/netinfo/pktMon.py index b720f9dd..257742c3 100644 --- a/source/tools/detect/net_diag/netinfo/pktMon.py +++ b/source/tools/detect/net_diag/netinfo/pktMon.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: pktMon + File Name: pktMon Description : Author : liaozhaoyan - date: 2021/6/27 + date: 2021/6/27 ------------------------------------------------- Change Activity: 2021/6/27: diff --git a/source/tools/detect/net_diag/netinfo/pktdrop.py b/source/tools/detect/net_diag/netinfo/pktdrop.py index c478b9bb..aac95973 100644 --- a/source/tools/detect/net_diag/netinfo/pktdrop.py +++ b/source/tools/detect/net_diag/netinfo/pktdrop.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: pktdrop + File Name: pktdrop Description : Author : liaozhaoyan - date: 2021/6/22 + date: 2021/6/22 ------------------------------------------------- Change Activity: 2021/6/22: diff --git a/source/tools/detect/net_diag/netinfo/pylcc/__init__.py b/source/tools/detect/net_diag/netinfo/pylcc/__init__.py index 5407b52f..6d2318a6 100644 --- a/source/tools/detect/net_diag/netinfo/pylcc/__init__.py +++ b/source/tools/detect/net_diag/netinfo/pylcc/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: __init__.py + File Name: __init__.py Description : Author : liaozhaoyan - date: 2021/7/15 + date: 2021/7/15 ------------------------------------------------- Change Activity: 2021/7/15: diff --git a/source/tools/detect/net_diag/netinfo/pylcc/lbcBase.py b/source/tools/detect/net_diag/netinfo/pylcc/lbcBase.py index 07d46740..41c2a13c 100644 --- a/source/tools/detect/net_diag/netinfo/pylcc/lbcBase.py +++ b/source/tools/detect/net_diag/netinfo/pylcc/lbcBase.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: lbcBase + File Name: lbcBase Description : Author : liaozhaoyan - date: 2021/7/20 + date: 2021/7/20 ------------------------------------------------- Change Activity: 2021/7/20: diff --git a/source/tools/detect/net_diag/netinfo/pylcc/lbcCon.py b/source/tools/detect/net_diag/netinfo/pylcc/lbcCon.py index 29b43e4d..42b12a18 100644 --- a/source/tools/detect/net_diag/netinfo/pylcc/lbcCon.py +++ b/source/tools/detect/net_diag/netinfo/pylcc/lbcCon.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: lbcCon + File Name: lbcCon Description : Author : liaozhaoyan - date: 2021/9/8 + date: 2021/9/8 ------------------------------------------------- Change Activity: 2021/9/8: diff --git a/source/tools/detect/net_diag/netinfo/pylcc/lbcMaps.py b/source/tools/detect/net_diag/netinfo/pylcc/lbcMaps.py index 654007dc..b6a7e0a4 100644 --- a/source/tools/detect/net_diag/netinfo/pylcc/lbcMaps.py +++ b/source/tools/detect/net_diag/netinfo/pylcc/lbcMaps.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: lbcMaps + File Name: lbcMaps Description : Author : liaozhaoyan - date: 2021/7/20 + date: 2021/7/20 ------------------------------------------------- Change Activity: 2021/7/20: diff --git a/source/tools/detect/net_diag/netinfo/pylcc/localExceptions.py b/source/tools/detect/net_diag/netinfo/pylcc/localExceptions.py index fd27064a..82931393 100644 --- a/source/tools/detect/net_diag/netinfo/pylcc/localExceptions.py +++ b/source/tools/detect/net_diag/netinfo/pylcc/localExceptions.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: localExceptions + File Name: localExceptions Description : Author : liaozhaoyan - date: 2021/7/20 + date: 2021/7/20 ------------------------------------------------- Change Activity: 2021/7/20: diff --git a/source/tools/detect/net_diag/netinfo/retransMon.py b/source/tools/detect/net_diag/netinfo/retransMon.py index 77082bc3..b9f8e3b6 100644 --- a/source/tools/detect/net_diag/netinfo/retransMon.py +++ b/source/tools/detect/net_diag/netinfo/retransMon.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: retransMon + File Name: retransMon Description : Author : liaozhaoyan - date: 2021/7/14 + date: 2021/7/14 ------------------------------------------------- Change Activity: 2021/7/14: diff --git a/source/tools/detect/net_diag/netinfo/runlatency.py b/source/tools/detect/net_diag/netinfo/runlatency.py index c7cb7d20..a9bab73d 100644 --- a/source/tools/detect/net_diag/netinfo/runlatency.py +++ b/source/tools/detect/net_diag/netinfo/runlatency.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: runlantency + File Name: runlantency Description : Author : liaozhaoyan - date: 2021/7/28 + date: 2021/7/28 ------------------------------------------------- Change Activity: 2021/7/28: diff --git a/source/tools/detect/net_diag/netinfo/socketStat.py b/source/tools/detect/net_diag/netinfo/socketStat.py index 01ecf8e8..324f88db 100644 --- a/source/tools/detect/net_diag/netinfo/socketStat.py +++ b/source/tools/detect/net_diag/netinfo/socketStat.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: socketStat + File Name: socketStat Description : Author : liaozhaoyan - date: 2021/7/1 + date: 2021/7/1 ------------------------------------------------- Change Activity: 2021/7/1: diff --git a/source/tools/detect/surftrace/surftrace.py b/source/tools/detect/surftrace/surftrace.py index 799cb5a2..e3a927c1 100755 --- a/source/tools/detect/surftrace/surftrace.py +++ b/source/tools/detect/surftrace/surftrace.py @@ -2,10 +2,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: surftrace + File Name: surftrace Description : Author : liaozhaoyan - date: 2021/1/4 + date: 2021/1/4 ------------------------------------------------- Change Activity: 2021/1/4: @@ -227,7 +227,7 @@ class CasyncPipe(Thread): self.__pipe = open(f, 'r') self.__loop = True self.start() - + def newCb(self, func): self.__callBack = func @@ -1008,7 +1008,7 @@ class surftrace(ftrace): for ePath in self._events: self._echoPath(ePath, 0) self._events = [] - + def __transFilter(self, filter, i, beg): decisions = ('==', '!=', '~', '>=', '<=', '>', '<') s = filter[beg:i] @@ -1099,13 +1099,13 @@ class surftrace(ftrace): if res is None: raise ExprException("error in expr %s." % e) return res - + def _splitXpr(self, xpr): for i, c in enumerate(xpr): if c in ('.', '-'): return xpr[:i], xpr[i:] return xpr, '' - + def __checkVar(self, var): if var in probeReserveVars: raise ExprException('%s is reserve word, can not used for args' % var) @@ -1113,7 +1113,7 @@ class surftrace(ftrace): def __checkSkbStruct(self, sStrcut): if sStrcut.strip("* ") not in self._netStructs: raise ExprException("type: %s is no not a legal struct." % sStrcut) - + def __filtType(self, s): try: return self._reBrackets.findall(s)[0] @@ -1125,7 +1125,7 @@ class surftrace(ftrace): if self._reLayer.match(pr): pr = pr[2:] return pr - + def showTypeSize(self, sType): multi = 1 if "[" in sType: @@ -1183,15 +1183,15 @@ class surftrace(ftrace): except DbException as e: raise ExprException('db get %s return %s' % (sType, e.message)) return res - + def _getVmFunc(self, func): try: res = self._parser.getFunc(func) except DbException as e: raise ExprException('db get %s return %s' % (func, e.message)) return res - - def __getExprArgi(self, e): + + def __getExprArgi(self, e): # expression: a=@(struct iphdr *)l4%1->saddr uesrs=!(struct task_struct *)%0->mm->mm_users # e is already checked at self.__checkBegExpr var, expr = e.split("=", 1) @@ -1221,7 +1221,7 @@ class surftrace(ftrace): argt = types regArch = '$retval' return showType, regArch, argt, xpr - + def _splitPr(self, argt, prs): cells = [] beg = 0 @@ -1269,7 +1269,7 @@ class surftrace(ftrace): raise ExprException("remote type %s error" % name) if iMem >= iName: raise ExprException("%s max index is %d, you set %d, overflow" % (name, iName, iMem)) - + def _fxprAddPoint(self, off): self._strFxpr = "+0x%x(" % off + self._strFxpr + ')' @@ -1315,7 +1315,7 @@ class surftrace(ftrace): else: raise ExprException( "last cell type: %s, can not show." % (lastCell["type"])) - + def _procSkb(self, member, sStruct, layer): # struct is already checked in _cellCheck __getCellMem, func off = self.showMemberOffset('data', 'struct sk_buff') @@ -1374,13 +1374,13 @@ class surftrace(ftrace): if sym == '@': v = self.__netParse(sType, v) return sType, v - + def _cellCheck(self, cells, reg): if reg == "$retval": self._strFxpr = reg else: self._strFxpr = "%" + reg - + i = 0; end = len(cells); lastCell = None sMem = ""; origType = sType = "unkown"; tStruct = None; origMode = '->' @@ -1431,7 +1431,7 @@ class surftrace(ftrace): i += 2 self._fxprAddSuffix(lastCell) return lastCell - + def _checkExpr(self, e): self.__checkBegExpr(e) self.__checkFormat(e) @@ -1470,7 +1470,7 @@ class surftrace(ftrace): if not self._checkAvailable(func): raise InvalidArgsException("%s is not in available_filter_functions" % func) cmd += "%s" % symbol - + vars = [] for expr in splitExpr(res['args']): if expr == "": @@ -1496,7 +1496,7 @@ class surftrace(ftrace): self._echoPath(fPath, "'%s'" % filter) fPath = self.baseDir + "/tracing/instances/surftrace/events/kprobes/" + name + "/enable" self._echoPath(fPath, 1) - + self._probes.append(name) def _initEvents(self, args): @@ -1536,7 +1536,7 @@ class surftrace(ftrace): if res == name: return True return False - + def _cbLine(self, line): print("%s" % line) diff --git a/source/tools/monitor/mon_connect/mon_connect.py b/source/tools/monitor/mon_connect/mon_connect.py index 4fc6db88..7d541543 100755 --- a/source/tools/monitor/mon_connect/mon_connect.py +++ b/source/tools/monitor/mon_connect/mon_connect.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- """ ------------------------------------------------- - File Name: mon_connect + File Name: mon_connect Description : Author : liaozhaoyan - date: 2021/4/1 + date: 2021/4/1 ------------------------------------------------- Change Activity: 2021/4/1: @@ -88,12 +88,12 @@ class CconnAna(): #include #include #include - + struct cell{ u32 ip; u16 port; }; - + BPF_HASH(close_var, u16, u64, 4); BPF_HASH(in_port_var, struct cell, u64, 65536); BPF_HASH(out_port_var, u16, u64, 65536); @@ -110,7 +110,7 @@ class CconnAna(): v ++; in_port_var.update(&k, &v); } - + static void increase_out_port_val(u16 k){ u64 v = 0; u64 *r; @@ -122,7 +122,7 @@ class CconnAna(): v ++; out_port_var.update(&k, &v); } - + static void increase_udp_port_val(u16 k){ u64 v = 0; u64 *r; @@ -134,12 +134,12 @@ class CconnAna(): v ++; udp_port_var.update(&k, &v); } - + int kretprobe__inet_csk_accept(struct pt_regs *ctx) { struct cell k; struct sock *sk = (struct sock *)PT_REGS_RC(ctx); - + if (sk == NULL) { return 0; } @@ -148,13 +148,13 @@ class CconnAna(): increase_in_port_val(k); return 0; } - + int kretprobe__tcp_close(struct pt_regs *ctx) { close_var.increment(0); return 0; } - + int j_tcp_v4_conn_request(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) { struct cell k; k.port = sk->__sk_common.skc_num; @@ -162,14 +162,14 @@ class CconnAna(): increase_in_port_val(k); return 0; } - + int j_tcp_connect(struct pt_regs *ctx, struct sock *sk) { u16 dport; dport = sk->__sk_common.skc_dport; increase_out_port_val(dport); return 0; } - + int j_udp_sendmsg(struct pt_regs *ctx, struct sock *sk, struct msghdr *msg, size_t len) { u16 dport; if (sk->__sk_common.skc_dport == 0) -- Gitee