(self, filename)
return filetype
Get the file architecture
Get the file architecture
Get the file architecture
def get_filetype(self, filename):
        """Get the file architecture"""
        filetype = ""
        if not filename.startswith(self._root_dir):
            filename = self._root_dir + '/' + filename
        if os.path.islink(filename):
            f_path = os.readlink(filename)
            if not f_path.startswith('/'):
                f_path = os.path.dirname(filename) + '/' + f_path
            return self.get_filetype(f_path)
        if os.path.isfile(filename):
            filetype = Uprocess().get_output(["file", filename])
            if not filetype:
                filetype = Uprocess().get_output(["readelf", "-h", filename])
        return filetype
def get_filetype ( self , filename ) : filetype = "" if not filename . startswith ( self . _root_dir ) : filename = self . _root_dir + '/' + filename if os . path . islink ( filename ) : f_path = os . readlink ( filename ) if not f_path . startswith ( '/' ) : f_path = os . path . dirname ( filename ) + '/' + f_path return self . get_filetype ( f_path ) if os . path . isfile ( filename ) : filetype = Uprocess ( ) . get_output ( [ "file" , filename ] ) if not filetype : filetype = Uprocess ( ) . get_output ( [ "readelf" , "-h" , filename ] ) return filetype