コード例 #1
0
ファイル: AndroScript.py プロジェクト: faheemfayyaz/androlyze
 def gen_unique_id(self):
     ''' Generate an unique id = sha256(apk hash + script name) '''
     try:
         return sha256(self.res.apk.hash + self.name)
     except AttributeError:
         log.warn('Could not calculate unique id for %s', self)
         raise
コード例 #2
0
 def get_hash(self):
     '''
     Get the sha256 message digest of the file
     and store it.
     
     Returns
     -------
     str
         sha256 message digest as hexstring
     None
         If path is None
         
     Raises
     ------
     OSError
         If the file could no be opened
     '''
     if self._get_hash() is None:
         if self.path is None:
             # cannot calculate message digest from file
             return None
         else:
             with open(self.path, "rb") as apkf:
                 self.hash = sha256(apkf.read())
                 log.debug("Calculated hash for %s by reading file %s",
                           self, self.path)
     return self._get_hash()
コード例 #3
0
ファイル: AndroScript.py プロジェクト: umr-ds/androlyze
 def gen_unique_id(self):
     ''' Generate an unique id = sha256(apk hash + script name) '''
     try:
         return sha256(self.res.apk.hash + self.name)
     except AttributeError:
         log.warn('Could not calculate unique id for %s', self)
         raise
コード例 #4
0
ファイル: Hashable.py プロジェクト: faheemfayyaz/androlyze
 def get_hash(self):
     '''
     Get the sha256 message digest of the file
     and store it.
     
     Returns
     -------
     str
         sha256 message digest as hexstring
     None
         If path is None
         
     Raises
     ------
     OSError
         If the file could no be opened
     '''
     if self._get_hash() is None:
         if self.path is None:
             # cannot calculate message digest from file
             return None
         else:
             with open(self.path, "rb") as apkf:
                 self.hash = sha256(apkf.read())
                 log.debug("Calculated hash for %s by reading file %s", self, self.path)
     return self._get_hash()