(self)
Calculates the percentage of bytes that are binary vs ascii
Calculates the percentage of bytes that are binary vs ascii
Calculates the percentage of bytes that are binary vs ascii
def binary_percent(self):
        """Calculates the percentage of bytes that are binary vs ascii"""
        ascii_bytes = 0
        binary_bytes = 0
        for i in range(0,self.features.get('data_len')):
            if self.data[i] > 7 and self.data[i] < 127:
                ascii_bytes += 1
            else:
                binary_bytes += 1
        self.features['binary_bytes'] = binary_bytes
        self.features['ascii_bytes'] = ascii_bytes
        data_len = self.features.get('data_len')
        self.features['binary_ratio'] = (ascii_bytes * 1.0) / data_len
def binary_percent ( self ) : ascii_bytes = 0 binary_bytes = 0 for i in range ( 0 , self . features . get ( 'data_len' ) ) : if self . data [ i ] > 7 and self . data [ i ] < 127 : ascii_bytes += 1 else : binary_bytes += 1 self . features [ 'binary_bytes' ] = binary_bytes self . features [ 'ascii_bytes' ] = ascii_bytes data_len = self . features . get ( 'data_len' ) self . features [ 'binary_ratio' ] = ( ascii_bytes * 1.0 ) / data_len