Exemple #1
0
 def main(self, *a, **kw):
     # Setup physical memory
     if hasattr(self, "domain"):
         self.xai = pyxa_instance(self.domain)
     else:
         self.parser.error("PyXaFS: must provide a Xen domain to mount")
     Fuse.main(self, *a, **kw)
Exemple #2
0
 def main(self, *a, **kw):
     # Setup physical memory
     if hasattr(self, "domain"):
         self.vm = pyvmi.init(self.domain, "partial")
     else:
         self.parser.error("PyVmiFS: must provide a Xen domain to mount")
     Fuse.main(self, *a, **kw)
Exemple #3
0
 def main(self, *a, **kw):
     # Setup physical memory
     if hasattr(self, "domain"):
         self.vm = pyvmi.init(self.domain, "partial")
     else:
         self.parser.error("PyVmiFS: must provide a Xen domain to mount")
     Fuse.main(self, *a, **kw)
Exemple #4
0
 def main(self, *a, **kw):
     # Setup physical memory
     if hasattr(self, "domain"):
         self.xai = pyxa_instance(self.domain)
     else:
         self.parser.error("PyXaFS: must provide a Xen domain to mount")
     Fuse.main(self, *a, **kw)
Exemple #5
0
    def main(self, *a, **kw):
        """
        Main entry point. Mounts filesystem and daemonizes.
        """

        self.file_class = self.UnfsFile
        return Fuse.main(self, *a, **kw)
Exemple #6
0
    def main(self):
      options, args = self.parser.parse_args()
      if not args:
          print("No image file specied.")
          return

      self.session = session.Session(
          filename=args[0], logging=2, profile=options.profile)

      # List all processes and hold on to their address spaces.
      self.tasks = {}
      for task in self.session.plugins.pslist(session=self.session).list_eprocess():
          address_space = task.get_process_address_space()
          process_name = u"%s_%s" % (task.UniqueProcessId, task.ImageFileName)

          # Remove funky chars from the filename
          process_name = re.sub("[^a-zA-Z0-9._]", "_", process_name)

          if address_space:
              self.tasks[process_name] = address_space

      # Make a special entry for the kernel here.
      self.tasks['kernel'] = self.session.kernel_address_space

      ## Prepare the file class - this will be used to read specific
      ## files:
      self.file_class = self.ASFuseFile
      self.file_class.fs = self

      if self.session.profile.metadata("memory_model") == "64bit":
          self.address_space_size = 0xfffffffffffffff
      else:
          self.address_space_size = 0xffffffff

      return Fuse.main(self)
Exemple #7
0
 def main(self, *a, **kw):
     """
     Main entry
     :param a:
     :param kw:
     :return:
     """
     return Fuse.main(self, *a, **kw)
Exemple #8
0
  def main(self, args=None):
    '''
    Mainline of the FUSE client filesystem. This directly overrides
    the Fuse.main() method to allow us to manually shutdown things
    after the FUSE event loop has finished.
    '''

    class FuseFileWrapper(tsumufs.FuseFile):
      '''
      Inner class to wrap the FuseFile class with the reference to this thread,
      allowing us to get at the GetContext() call. Essentially we're creating a
      closure here. Ugly, but it's the only way to get the uid and gid into the
      FuseFile thread.

      Idea borrowed directly from Robie Basak in his email to fuse-dev, which is
      visible at <http://www.nabble.com/Python%3A-Pass-parameters-to-file_class-to18301066.html#a20066429>.
      '''

      def __new__(cls, path, *args, **kwargs):
        kwargs.update(self.GetContext())

        klass = tsumufs.getManager(path).getFileClass(path) or tsumufs.FuseFile

        return klass(path, *args, **kwargs)

      def __init__(self2, *args, **kwargs):
        kwargs.update(self.GetContext())
        tsumufs.FuseFile.__init__(self2, *args, **kwargs)

    self.file_class = FuseFileWrapper

    self._debug('Trying fsinit()')
    if self.fsinit():
      result = Fuse.main(self, args)

      self._debug('Fuse main event loop exite')

      self._debug('Setting event and condition states.')
      tsumufs.unmounted.set()

      self._debug('Waiting for the sync thread to finish.')
      self._syncThread.join()

      self._debug('Shutdown complete.')
      self._debug("---BEGIN-GEN-BENCHMARK-REPORT---")

      metrics=""
      for key in tsumufs.metrics._metrics.keys():
        self._debug(" %s: %s " % (str(key) , str(tsumufs.metrics._metrics[key])))
      self._debug("---END-GEN-BENCHMARK-REPORT---")

    else:
      self._debug('fsinit() failed...')
      result = False

    return result
Exemple #9
0
    def main(self, *args, **kwargs):
        fuse = self

        class FileClass(GstreamerFS.File):
            def __init__(self, *args, **kwargs):
                syslog.syslog('fuse: %s' % fuse)
                syslog.syslog('self: %s' % self)
                GstreamerFS.File.__init__(self, fuse, *args, **kwargs)

        self.file_class = FileClass
        return Fuse.main(self, *args, **kwargs)
Exemple #10
0
    def main(self):
      options, args = self.parser.parse_args()
      self.img = images.SelectImage(options.type, args)
      self.offset = parse_int(options.offset)

      self.fs = pytsk3.FS_Info(self.img, offset = self.offset)

      ## Prepare the file class - this will be used to read specific
      ## files:
      self.file_class = self.TSKFuseFile
      self.file_class.fs = self.fs

      return Fuse.main(self)
Exemple #11
0
    def main(self, *a, **kw):
        self.restore = int(self.restore) != 0
        self.shares = int(self.shares)
        self.required = int(self.required)
        assert self.required >= 1
        assert self.required <= self.shares
        if self.restore:
            self.file_class = self.ZfecRestoreFile
            self.decoder = zfec.Decoder(self.required, self.shares)
        else:
            self.file_class = self.ZfecFile
            self.encoder = zfec.Encoder(self.required, self.shares)

        return Fuse.main(self, *a, **kw)
Exemple #12
0
  def main(self, *a, **kw):
    if not self.fuse_args.getmod('showhelp'):
      self._validate_args()
      self.db = PhotoDb(self.root)
      self.views = GetViews(self.db)

      if self.db.TryLock():
        logging.info('Acquired database lock, will write/update it')
      else:
        logging.error(('Failed to acquire database lock, '
                       'another instance is already running'))
        sys.exit(0)

    return Fuse.main(self, *a, **kw)
Exemple #13
0
    def main(self):
        self.offset = parse_int(self.offset)
        args = self.cmdline[1]
        if len(args) != 1:
            raise RuntimeError( "You must specify a single image name to load - try -h for help ")

        print "Opening filesystem in %s" % args[0]
        self.img = Img_Info(args[0])
        self.fs = pytsk3.FS_Info(self.img, offset = self.offset)

        ## Prepare the file class - this will be used to read specific
        ## files:
        self.file_class = self.TSKFuseFile
        self.file_class.fs = self.fs

        return Fuse.main(self)
Exemple #14
0
    def main(self):
        self.offset = parse_int(self.offset)
        args = self.cmdline[1]
        if len(args) != 1:
            raise RuntimeError(
                "You must specify a single image name to load - try -h for help "
            )

        print "Opening filesystem in %s" % args[0]
        self.img = Img_Info(args[0])
        self.fs = pytsk3.FS_Info(self.img, offset=self.offset)

        ## Prepare the file class - this will be used to read specific
        ## files:
        self.file_class = self.TSKFuseFile
        self.file_class.fs = self.fs

        return Fuse.main(self)
Exemple #15
0
    def main(self, *a, **kw):

        if not os.path.isdir(self.local_cache_dir):
            print("Creating local cache directory: {}".format(
                self.local_cache_dir))
            os.mkdir(self.local_cache_dir)

        if self.local_cache_dir[-1] == '/':
            self.local_cache_dir = self.local_cache_dir[:-1]

        self.log_fh = open(self.log_file, "a")

        parent = "{}:{}".format(self.host, self.port)
        self.fs = HashFS_Core(parent_node=parent,
                              local_cache_dir=self.local_cache_dir,
                              local_run=self.local_run,
                              hash_alg=self.hash_alg)

        return Fuse.main(self, *a, **kw)
    def main(self):
        options, args = self.parser.parse_args()
        if not args:
            print "No image file specied."
            return

        self.session = session.Session(filename=args[0],
                                       logging=2,
                                       profile=options.profile)

        # List all processes and hold on to their address spaces.
        self.tasks = {}
        for task in self.session.plugins.pslist(
                session=self.session).list_eprocess():
            address_space = task.get_process_address_space()
            process_name = u"%s_%s" % (task.UniqueProcessId,
                                       task.ImageFileName)

            # Remove funky chars from the filename
            process_name = re.sub("[^a-zA-Z0-9._]", "_", process_name)

            if address_space:
                self.tasks[process_name] = address_space

        # Make a special entry for the kernel here.
        self.tasks['kernel'] = self.session.kernel_address_space

        ## Prepare the file class - this will be used to read specific
        ## files:
        self.file_class = self.ASFuseFile
        self.file_class.fs = self

        if self.session.profile.metadata("memory_model") == "64bit":
            self.address_space_size = 0xfffffffffffffff
        else:
            self.address_space_size = 0xffffffff

        return Fuse.main(self)
Exemple #17
0
 def main(self):
 
     if hasattr(self, "image"):
         path = self.image
     else:
         raise ADFS_Error, "No path specified"
     
     try:
     
         self.adffile = open(path, "rb")
         self.adfsdisc = ADFSlib.ADFSdisc(self.adffile, verify = 1)
     
     except IOError:
     
         raise ADFS_Error, "Failed to open the image file specified"
     
     except ADFSlib.ADFS_exception:
     
         self.adffile.close()
         raise ADFS_Error
     
     self.root_time = time.time()
     
     return Fuse.main(self)
Exemple #18
0
 def main(self, *a, **kw):
     """This is the main method of MogamiFS.
     """
     self.file_class = self.MogamiFile
     return Fuse.main(self, *a, **kw)
Exemple #19
0
    def main(self, *a, **kw):

        self.file_class = self.TagFSFile
        self.fsinit()

        return Fuse.main(self, *a, **kw)
Exemple #20
0
 def main(self, *a, **kw):
     self.file_class = self.AFF4FuseFile
     return Fuse.main(self, *a, **kw)
Exemple #21
0
 def main(self, *a, **kw):
     #self.file_class = self.Sha1File
     return Fuse.main(self, *a, **kw)
Exemple #22
0
    def main(self, *a, **kw):
        debug("PyFuseMongo.main()")

        self.file_class = self.PyFuseMongoFile

        return Fuse.main(self, *a, **kw)
Exemple #23
0
    def main(self, *a, **kwargs):

        """Start and lose control"""
        
        Fuse.main(self, *a, **kwargs)
Exemple #24
0
    def main(self, *a, **kw):

        self.file_class = self.MiGAccessFile

        return Fuse.main(self, *a, **kw)
Exemple #25
0
    def main(self, *a, **kw):

        self.file_class = self.PyFlagVFSFile
        return Fuse.main(self, *a, **kw)
Exemple #26
0
    def main(self, *a, **kw):
        self.file_class = self.MeetingFile

        return Fuse.main(self, *a, **kw)
Exemple #27
0
    def main(self, *a, **kw):

        self.file_class = self.AmnesiaFSFile

        return Fuse.main(self, *a, **kw)
Exemple #28
0
 def main(self, *args, **kwargs):
     return Fuse.main(self, *args, **kwargs)
Exemple #29
0
 def main(self, *a, **kw):
     """This is the main method of MogamiFS.
     """
     self.file_class = self.MogamiFile
     return Fuse.main(self, *a, **kw)
Exemple #30
0
 def main(self, *a, **kw):        
     self.file_class = GRSFile
     # this crashes and is not needed: self.dir_class = GRSDirectory
     return Fuse.main(self, *a, **kw)
Exemple #31
0
	def main(self):
		self.connect(self.server, (self.username, self.password))
		Fuse.main(self)
Exemple #32
0
 def main(self, *a, **kw):
     self.SNFile.tree = self.tree
     self.file_class = self.SNFile
     return Fuse.main(self, *a, **kw)
Exemple #33
0
    def main(self, *a, **kw):

        self.file_class = self.MusicFSFile
        return Fuse.main(self, *a, **kw)
 def main(self, *a, **kw):
     return Fuse.main(self, *a, **kw)
Exemple #35
0
    def main(self):
      options, args = self.parser.parse_args()
      self.fd = images.SelectImage(options.type, args)

      return Fuse.main(self)
Exemple #36
0
    def main(self, *a, **kw):

        self.file_class = self.PyFlagVFSFile
        return Fuse.main(self, *a, **kw)
Exemple #37
0
	def main(self, *a, **kw):
		dir_struct_module = importlib.import_module('dir_structure.' + self.struct)
		self.dir_struct = dir_struct_module.get_dir_structure()
		self.file_class = self.get_file_class(self.dir_struct)
		return Fuse.main(self, *a, **kw)
Exemple #38
0
 def main(self, *args, **kwargs):
     return Fuse.main(self, *args, **kwargs)
Exemple #39
0
	def main(self, *a, **kw):

		# Define the file class locally as that seems to be the easiest way to
		# inject instance specific data into it...

		server = self

		if server.fuse_args.mount_expected():
			server.__initialize()

		class DhtfsFile(object):

			def __init__(self, path, flags, *mode):
				# set logger
				self.logger = server.logger
				self.logger.info("###### Initiating file object In function : %s" % sys._getframe().f_code.co_name)

				# set the dirs which are associated with this file
				self.dirs = [x for x in os.path.dirname(path).split(os.path.sep) if x != '']

				# Get actual path for the specified path
				actualPath = server.getActualPath(path)

				newCreated = False
				if os.path.basename(actualPath) == Dhtfs.MISSING_FILE:
					# File is not yet created. Create file
					self.logger.info("Actual path missing")
					actualPath = server.generateNewFileName()
					newCreated = True
					if path in server.fileCache:
						self.logger.info("CACHE: Remove entry for path %s" % path)
						del server.fileCache[path]

				self.file = os.fdopen(os.open(os.path.join(server.root, actualPath), flags, *mode),
										flag2mode(flags))
				self.fd = self.file.fileno()

				filename = os.path.basename(path)
				self.fi = TagFile(actualPath, filename)

				if newCreated:
					self.logger.info("Adding tags %s, to file %s" %(self.dirs, self.fi))
					# Add tag information for the newly created file
					server.tagdir.addDirsToFiles([self.fi], self.dirs)

			def read(self, length, offset):
				self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
				self.file.seek(offset)
				return self.file.read(length)

			def write(self, buf, offset):
				self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
				self.file.seek(offset)
				self.file.write(buf)
				return len(buf)

			def release(self, flags):
				self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
				self.file.close()

			def fsync(self, isfsyncfile):
				self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
				if isfsyncfile and hasattr(os, 'fdatasync'):
					os.fdatasync(self.fd)
				else:
					os.fsync(self.fd)

			def flush(self):
				self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
				self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
				self.file.flush()
				# cf. xmp_flush() in fusexmp_fh.c
				os.close(os.dup(self.fd))

			def fgetattr(self):
				self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
				return os.fstat(self.fd)

			def ftruncate(self, len):
				self.logger.info("In function : %s" % sys._getframe().f_code.co_name)
				self.file.truncate(len)

		self.file_class = DhtfsFile

		return Fuse.main(self, *a, **kw)
Exemple #40
0
 def main(self, *a, **kw):
     self.file_class = self.AFF4FuseFile
     return Fuse.main(self, *a, **kw)
Exemple #41
0
 def main(self, *a, **kw):
   #self.file_class = self.Sha1File
   return Fuse.main(self, *a, **kw)
Exemple #42
0
	def main(self, *a, **kw):
		self.file_class = fs45gFile
		fs45gFile.myFS = self
		return Fuse.main(self, *a, **kw)
Exemple #43
0
    def main(self, *a, **kw):

        self.file_class = self.XmpFile

        return Fuse.main(self, *a, **kw)
Exemple #44
0
    def main(self, *a, **kw):

        self.file_class = self.MiGAccessFile

        return Fuse.main(self, *a, **kw)
Exemple #45
0
 def main(self, *args, **kw):
     import os
     fullpath = os.path.abspath(os.path.expanduser(os.path.expandvars(
         self.db_path)))
     self.__backend = DBDumpFS("sqlite:"+fullpath)
     Fuse.main(self, *args, **kw)
Exemple #46
0
 def main(self, *a, **kw):
     self.file_class = self.CloudNcfsFile
     return Fuse.main(self, *a, **kw)
Exemple #47
0
    def main(self, *a, **kw):

        self.file_class = self.MusicFSFile
        return Fuse.main(self, *a, **kw)
Exemple #48
0
    def main(self, *a, **kw):

        self.file_class = self.LindFuseFSFile

        return Fuse.main(self, *a, **kw)
Exemple #49
0
 def main(self, *a, **kw):
     self.file_class = fs45gFile
     fs45gFile.myFS = self
     return Fuse.main(self, *a, **kw)
Exemple #50
0
 def main(self, *a, **kw):
     return Fuse.main(self, *a, **kw)
Exemple #51
0
 def main(self, *a, **kw):
     self.file_class = GRSFile
     # this crashes and is not needed: self.dir_class = GRSDirectory
     return Fuse.main(self, *a, **kw)
Exemple #52
0
    def main(self, *a, **kw):

        self.file_class = self.XmpFile

        return Fuse.main(self, *a, **kw)
Exemple #53
0
 def main(self, *a, **kw):
     self.file_class = TNFS_File
     return Fuse.main(self, *a, **kw)
Exemple #54
0
 def main(self, *a, **kw):
     self.file_class = self.CloudNcfsFile
     return Fuse.main(self, *a, **kw)
Exemple #55
0
    def main(self, *a, **kw):

        self.file_class = self.LindFuseFSFile

        return Fuse.main(self, *a, **kw)