diff --git a/source/tools/detect/net_diag/netinfo/__init__.py b/source/tools/detect/net_diag/netinfo/__init__.py index 4e7476e3e2cc220bf5218fc1f5eba7a1f53a6948..97fbed291ac883a6a2d948146691994555008701 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 85abc2f8cc2b7253a261d9909a46a8169ccf3997..b4b51796f3e0a61c18d8e1fe979e4498586a7294 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 7421067d5fa7bb6c26ee5ce82940342258ee4b77..597073bc8f9f24f05079a33fd911b503c105c257 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 55d3b958bd4b14d86abf8e5ff791e3da4e304a60..fb98271684184c4f0f24af05b97d1bb46e0e785e 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 0e425c46fcac747c9e37e68d8168657d78303844..8a96c988592662256bcef89bc725886f818e70e3 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 88b6716d5033a05f5a80b9297a02de668642ac92..9b3fc3a8f4c355553201d43d7f21080ac59496e4 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 004ab9fcd0629839645928479a7f640ba081c588..edfbc4b08ad3f71a9b760b24928365ff53b234c1 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 fac7dea6dc88db57add95705ce7fa3a19874097c..11db44c67114eef11dcd7449e6f7345244d43766 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 b720f9dd2ecd5988cd7f38492567e1c6aad28c36..257742c3ff0faa9f682f43f90cebb81eebed11cc 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 c478b9bba31471649e329ace88491af264146f73..aac95973f51632932f32258b0ada961125dfc4b4 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 5407b52feeb36ae28baa304a85460243bd73976d..6d2318a6f091b97096b694f7ff0179340481744b 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 07d46740a2cfb362b478b09807f0072f8d4f2abc..41c2a13c01e77c35dd1fe51bd6ba36c5d2d86759 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 29b43e4d56b51d17ca31f36deeb461954f3ed60c..42b12a1869cb7f073857f1bbdd10ab4094a834c8 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 654007dcea1542338b3dbba3d240802b3fc99859..b6a7e0a49fd3c18702251a8f0ec4c09934572e60 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 fd27064a54f60709885b7f2d8ce7e9ea071e21fe..829313938d67ee03826d83654a720a6acfff517f 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 77082bc3fb31e4a6be8e8724241c1d7ed1bf1442..b9f8e3b60c6055498e590cfe7c83373c57e5d78c 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 c7cb7d2009cd5675e1fe949ede6af62cf9ecaed8..a9bab73d3732bcc90c2725627620880db0b34dcf 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 01ecf8e8c621cb766adc0fd78f4d494a18a93f74..324f88db8c61e97821a3a3213920dfa8052fed43 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 799cb5a2034c02b5c90e9b884bc6a35a9cc3271b..e3a927c11fd876de5a9f47a414ae105920f35584 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 4fc6db88ff83afb6f2d67a375adc45a4d0cfaee2..7d5415435f70ac7fa99a7cda40ba9b2f6c4cc6a3 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)