def get_constone(self, lo_b, lo_e): conster = words_base() t_messages = [] for message in self.messages: t_messages.append(message.data) t_r, t_l, _ = conster.get_pureproinfo(t_messages, lo_b, lo_e) return int.from_bytes(t_l[0][0], byteorder='little', signed=False)
def find_lenbyaccu(self, datas, lo_s, lo_e): t_lener = words_base() t_messages = [] for message in self.messages: t_messages.append(message.data) t_dataone, t_datatwo, t_lens = t_lener.get_lengthinfo( t_messages, lo_s, lo_e) print(t_datatwo) print(t_lens) acc_big = 0 for i in range(len(t_dataone)): if (abs((t_dataone[i] - t_lens[i])) <= 1): acc_big = acc_big + 1 acc_small = 0 for i in range(len(t_datatwo)): if (abs((t_datatwo[i] - t_lens[i])) <= 1): acc_small = acc_small + 1 print(acc_big) print(acc_small) print(len(t_dataone)) if ((acc_small / len(t_dataone)) > 0.8 or (acc_big / len(t_dataone)) > 0.8): return 1 else: return 0
def findserienum(self, messages, lo_s, lo_e): t_lener = words_base() t_messages = [] for message in messages: t_messages.append(message.data) t_dataone, t_datatwo, t_series = t_lener.get_seidinfo( t_messages, lo_s, lo_e) j_one = self.pearson(t_dataone, t_series) j_two = self.pearson(t_datatwo, t_series) j_final = max(j_one, j_two) return j_final
def find_constone(self, lo_b, lo_e): #develop absolute or relative conster = words_base() t_messages = [] for message in self.messages: t_messages.append(message.data) t_r, t_l, _ = conster.get_logapinfo(t_messages, lo_b, lo_e) if (t_l[0][1] > 0.98): return 1 else: return 0
def find_constfunc(self, lo_b, lo_e, data="no"): conster = words_base() t_messages = [] if data == "no": for message in self.messages: t_messages.append(message.data) else: t_messages = self.messages t_r, t_l, _ = conster.get_logapinfo(t_messages, lo_b, lo_e) t_en = 0 for t_pro in t_l: t_en = t_en + t_pro[1] * np.log(t_pro[1]) t_en = -t_en return t_en, len(t_l)
def find_constfunc(self, lo_b, lo_e, L): #develop absolute or relative conster = words_base() t_messages = [] for message in self.messages: t_messages.append(message.data) t_r, t_l, _ = conster.get_logapinfo(t_messages, lo_b, lo_e) t_lo = 1 - lo_b / L t_num = 1 - len(t_r) / 255 t_en = 0 for t_pro in t_l: t_en = t_en + t_pro[1] * np.log(t_pro[1]) t_en = -t_en return t_lo * t_num * t_en
def find_const(self): #develop absolute or relative conster = words_base() t_messages = [] for message in self.messages: t_messages.append(message.data) t_r, t_l = conster.get_loinfo(t_messages, 20) t_tol = len(self.messages) i = 0 t_len = len(t_r) while (i < t_len): t_idom = t_r[i] t_max = t_idom[0][1] if (t_max / t_tol >= 0.95): self.const.append(i) i = i + 1
def find_len(self, datas, lo_s, lo_e): t_lener = words_base() t_messages = [] for message in self.messages: t_messages.append(message.data) t_dataone, t_datatwo, t_lens = t_lener.get_lengthinfo( t_messages, lo_s, lo_e) print(t_datatwo) print(t_lens) p_one = self.pearson(t_dataone, t_lens) p_two = self.pearson(t_datatwo, t_lens) print(p_one) print(p_two) if (p_one > 0.9 or p_two > 0.9): return 1 else: return 0