Exemplo n.º 1
0
 def inferLen(self, datas, lenDatas):
     datasLenBig = Converter.bytesToBigInt(datas)
     datasLittle = Converter.bytesToLittleInt(datas)
     personBig = base_analyzer.pearson(datasLenBig, lenDatas)
     personLittle = base_analyzer.pearson(datasLittle, lenDatas)
     if personBig > self.lengthThreshold or personLittle > self.lengthThreshold:
         return 1
     else:
         return 0
 def inferSeriesId(self, datas):
     ids = []
     for i, data in enumerate(datas):
         ids.append(i)
     datasBigInt = Converter.bytesToBigInt(datas)
     datasLittle = Converter.byteToLittle(datas)
     tRate = max(base_analyzer.pearson(ids, datasBigInt),
                 base_analyzer.pearson(ids, datasLittle))
     if (tRate > self.idThreshold):
         return 1
     else:
         return 0
Exemplo n.º 3
0
 def inferLen(self, Los=None, datas=None):
     if Los != None:
         datas = self.cverter.getDatasByLocs(self.messages, Los)
     lens = [len(data) for data in datas]
     datasLenBig = Converter.bytesToBigInt(datas)
     datasLittle = Converter.bytesToLittleInt(datas)
     personBig = base_analyzer.pearson(datasLenBig, lens)
     personLittle = base_analyzer.pearson(datasLittle, lens)
     if personBig > self.lengthThreshold or personLittle > self.lengthThreshold:
         return 1
     else:
         return 0
Exemplo n.º 4
0
 def inferSeriesId(self, Los=None, datas=None):
     if Los != None:
         datas = self.cverter.getDatasByLocs(self.messages, Los)
     ids = []
     for i, data in enumerate(datas):
         ids.append(i)
     datasBigInt = Converter.bytesToBigInt(datas)
     datasLittle = Converter.bytesToLittleInt(datas)
     tRate = max(base_analyzer.pearson(ids, datasBigInt),
                 base_analyzer.pearson(ids, datasLittle))
     if (tRate > self.idThreshold):
         return 1
     else:
         return 0
Exemplo n.º 5
0
 def inferLenAccau(self, Los=None, datas=None):
     if Los != None:
         datas = self.cverter.getDatasByLocs(self.messages, Los)
     lens = []
     for msg in self.messages:
         if len(msg) > Los[-1]:
             lens.append(len(msg) - Los[-1])
         else:
             lens.append(-1)
     datasLenBig = Converter.bytesToBigInt(datas)
     datasLittle = Converter.bytesToLittleInt(datas)
     acc_big = 0
     for i in range(len(datasLenBig)):
         if (abs((datasLenBig[i] - lens[i])) <= 1):
             acc_big = acc_big + 1
     acc_small = 0
     for i in range(len(datasLittle)):
         if (abs((datasLittle[i] - lens[i])) <= 1):
             acc_small = acc_small + 1
     if ((acc_small / len(datas)) > self.lengthThreshold
             or (acc_big / len(datas)) > self.lengthThreshold):
         return 1
     else:
         return 0