Esempio n. 1
0
def main(conf_path, mountpoint, foreground):
    FUSE(CombinedFS(conf_path),
         mountpoint,
         foreground=foreground,
         ro=True,
         default_permissions=True,
         allow_other=True)
Esempio n. 2
0
def main(mountpoint):
    FUSE(BoxFuseFS(),
         mountpoint,
         nothreads=False,
         foreground=True,
         allow_other=True,
         max_readahead=262144,
         max_read=262144)
Esempio n. 3
0
 def run(self):
     try:
         self.fuse = FUSE(
             self.fs,
             self.mountpath,
             foreground=True,
             nothreads=True,
             allow_other=False,
         )
     except (ValueError, InvalidToken, binascii.Error):
         print("Wrong key for the ~/.manualbox")
Esempio n. 4
0
def main(root, mountpoint=None):
    if mountpoint is None:
        mountpoint = root + ".ocffs"

    with OCFFS(root, mountpoint) as ocffs:
        try:
            FUSE(ocffs,
                 mountpoint,
                 nothreads=True,
                 foreground=True,
                 debug=True,
                 allow_other=True)
        except RuntimeError:
            print(" -- mountpoint %s is only usable for current user." %
                  mountpoint,
                  file=sys.stderr)
            FUSE(ocffs,
                 mountpoint,
                 nothreads=True,
                 foreground=True,
                 debug=True,
                 allow_other=False)
Esempio n. 5
0
            # Each submission is in a subdirectory with the name of the student.
            sub_path = f"{a_path}/{sub['student_name']}"
            # Students that haven't submitted still show up, but submitted_at is non-existing. This gives us a 0 epoch time.
            add_entry(DirEntry(sub_path, sub, time_entry='submitted_at'))
            add_entry(MetaEntry(sub_path, sub, time_entry='submitted_at', filter_entries={'submission_history'}))
            for s in sub['submission_history']:
                # Each version of the submission is listed in a separate subdirectory
                if s['attempt'] is None:
                    # Student hasn't submitted anything.
                    continue
                attempt_path = f"{sub_path}/{s['attempt']}"
                add_entry(DirEntry(attempt_path, s, time_entry='submitted_at'))
                add_entry(MetaEntry(attempt_path, s, time_entry='submitted_at'))
                for att in s.get('attachments', []):
                    # Each file in the submission
                    fpath = f"{attempt_path}/{att['filename']}"
                    if fpath.lower().endswith('.zip'):
                        # Note: the 'unp' directory is not added until the zip file is downloaded (by reading it)
                        # The reason for this is to avoid triggering downloads of all zip files using "find", file managers etc.
                        add_entry(ZipEntry(fpath, att, time_entry='modified_at'))
                    else:
                        add_entry(Entry(fpath, att, time_entry='modified_at'))
    print("Ready")
    if DEBUG:
        print("Debug dump to ", DEBUG_FILE)
        with open(DEBUG_FILE, 'w') as f:
            json.dump(ZipEntry.debuglst, f)

    fuse = FUSE(
        Context(), args.mount, foreground=True, ro=True, allow_other=True)
Esempio n. 6
0
#

from fusepy import FUSE
import sys

from AEpy.AELink import AELinkSerial
from AEpy.AESession import AESession
from AEpy.AEFuse import AEFuse
from AEpy import FusePatches

if __name__ == '__main__':
    # Monkey patch fusepy
    FusePatches.patch_max_readahead(512)

    serspeed = 19200

    if len(sys.argv) - 1 < 2:
        print('Only ' + str(len(sys.argv) - 1) + ' arguments given.')
        print('Usage: ' + sys.argv[0] +
              ' <mount point> <serial device> [serial speed]')

        sys.exit(-1)

    if len(sys.argv) - 1 > 2:
        serspeed = int(sys.argv[3])

    link = AELinkSerial(sys.argv[2], serspeed)
    session = AESession(link)
    fuse = AEFuse(session)
    FUSE(fuse, sys.argv[1], nothreads=True, foreground=True)
Esempio n. 7
0
    def parse_args():
        docstrings = __doc__.split('\n')
        name = docstrings[0]
        description = docstrings[-1]
        parser = ArgumentParser(name, description=description)
        parser.add_argument('-v', '--version', action='version',
                            version='%(prog)s ' + __version__,
                            help=SUPPRESS)
        parser.add_argument('ROOT', help='directory to encrypt')
        parser.add_argument('MOUNTPOINT', help='where to mount, must be empty')
        parser.add_argument('KEY', help='master key used for encryption')
        parser.add_argument('-d', '--decrypt', action='store_true',
                            help='decrypt a copy of the encrypted filesystem')
        parser.add_argument('-n', '--no-auth', action='store_false',
                            dest='verify',
                            help='skips authentication checks with --decrypt')
        args = parser.parse_args()
        if (not args.verify and not args.decrypt):
            parser.error('-n/--no-auth requires -d/--decrypt')
        return args


    args = parse_args()
    key = sha256(args.KEY.encode()).digest()
    if args.decrypt:
        fs = RencFSDecrypt(args.ROOT, key, args.verify)
    else:
        fs = RencFSEncrypt(args.ROOT, key)
    FUSE(fs, args.MOUNTPOINT, nothreads=True, foreground=True)
Esempio n. 8
0
if __name__ == "__main__":
    conf1 = "./bitcoinfs.conf"
    conf2 = "~/.bitcoinfs.conf"
    conf3 = gentmpfname()
    if len(argv) < 2:
        print('usage: %s <mountpoint> <filelist txid>' % argv[0])
        exit(1)
    if argv[1] in ["-h", "--help"]:
        print(
            'usage: %s <mountpoint> <filelist txid>\nNeeds the bitcoinfs.conf in the same folder as executable or as ~/.bitcoinfs.conf in home folder, alternatively we can fetch the file list directly from the blockchain using the txid as a third argument.\n'
            % (argv[0]))
    if len(argv) == 3:
        confd = txid2boptreturn(argv[2])
        f = open(conf3, "wb")
        f.write(confd)
        f.close()
        conf = conf3
    elif os.path.isfile(conf1):
        conf = conf1
    elif os.path.isfile(conf2):
        conf = conf2
    else:
        print('No configuration file found')
        exit()
    try:
        data = parseconf(conf)
        logging.getLogger().setLevel(logging.DEBUG)
        fuse = FUSE(BitcoinFS(data), argv[1], foreground=True)
    except:
        traceback.print_exc()
Esempio n. 9
0
def main(mountpoint, root):
    FUSE(Passthrough(root), mountpoint, nothreads=True, foreground=True)
Esempio n. 10
0
                    'st_ctime': 0,
                    'st_gid': 0,
                    # consultar man inode, stat
                    'st_mode': stat.S_IFREG | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH,
                    'st_size': len('%d' % self.consecutivo),
                    'st_mtime': 0,
                    'st_nlink': 1,
                    'st_uid': 0}
        else:
            return FuseOSError(errno.ENOENT)

    def read(self,path,size,offset,fh):
        self.consecutivo = self.consecutivo + 1
        return str( self.consecutivo )

    def readdir(self,path,fh):
        return ['.', '..', 'data']


if __name__== '__main__':
    if len(sys.argv) != 2 or (not os.path.isdir(sys.argv[1])):
        print('Error de invocación: ', sys.argv[0], '<punto_mnt>')
        print('<punto_mnt>: ruta de un directorio en el que el usuario actual tenga')
        print('             permisos de lectura, escritura y ejecución, donde se ')
        print('             montará el sistema de archivos..')
        sys.exit(1)

    mountpoint = sys.argv[1]
#    logging.basicConfig(level=logging.DEBUG)
    FUSE(AumentandoFS(), mountpoint, nothreads=True, foreground=True)
def main(mount_point, serial_device):
    server = UbootMmc(serial_device)
    FUSE(server, mount_point, nothreads=True, foreground=True)
Esempio n. 12
0
        else:
           print('STATUS: ERROR')
           for block in range(1,len(self.n_chain.chain)):
               curBlock = self.n_chain.chain[block]
               logBlock = ("Block Index: " + str(curBlock.index) + "\n\nHash: " + curBlock.nHash + "\n\n" + curBlock.data + "\n\nPHash: " + curBlock.pHash + "\n\n" + "Status: " + status + "\n\n" +"\n\nChain is Invaild, Error Log")
               # Write Data to Log File
               self.bcl.writeToLogFile(self.bcl.DIR,logBlock)
               status="ERROR"

        print(status)
        # Get length of chain
        chainlength = (len(self.n_chain.chain)-1)
        # Get Newest Block block[chain-length]
        getCurrentBlock = self.n_chain.chain[chainlength]
        # Create Log Data
        logBlock = ("Block Index: " + str(getCurrentBlock.index) + "\n\nHash: " + getCurrentBlock.nHash + "\n\n" + getCurrentBlock.data + "\n\nPHash: " + getCurrentBlock.pHash + "\n\n" + "Status: " + status + "\n\n")
        # Write Data to Log File
        self.bcl.writeToLogFile(self.bcl.DIR,logBlock)
        
#Initial Start Method
if __name__ == '__main__':
    #Initialise Parser
    parser = argparse.ArgumentParser()
    #Pass Mount Argument to Mout Virtual Disk
    parser.add_argument('mount')
    #Execute Parser Command
    args = parser.parse_args()
    #Create FusePy Instanace
    #logging.basicConfig(level=logging.DEBUG)
    fuse = FUSE(BLOCK_FS(), args.mount, foreground=True, nonempty=False, allow_other=True)
Esempio n. 13
0
File: atfs.py Progetto: Idloj/atfs
        def files():
            with open(real(path), 'r+') as f:
                f.truncate(length)

        def tags():
            raise FuseOSError(EISDIR)

        return self.tags_operation(path, files, tags)

    def flush(self, path, fh):
        return os.fsync(fh)

    def release(self, path, fh):
        return os.close(fh)


if __name__ == '__main__':
    if len(argv) != 2:
        print('usage: %s <root>' % argv[0])
        exit(1)

    root_fd = os.open(os.path.realpath(argv[1]), os.O_RDONLY)
    fuse = FUSE(Atfs(root_fd),
                argv[1],
                fsname='atfs',
                foreground=True,
                nothreads=True,
                nonempty=True,
                allow_other=True,
                debug=True)
Esempio n. 14
0
def run_fuse():
    FUSE(RepoFS(),
         str(core.config['mount_dir']),
         nothreads=True,
         foreground=True)
Esempio n. 15
0
        # regresamos una cadena vacía
        if offset < datalen:
            # ¿El punto de inicio mas el tamaño solicitado caen dentro
            # del total del archivo? Si no, recortamos el total a
            # devolver.
            if offset + length > datalen:
                size = datalen - offset
            return data[offset:offset + length]
        else:
            return b''


if __name__ == '__main__':
    if len(sys.argv) != 3 or (not os.path.isfile(
            sys.argv[1])) or (not os.path.isdir(sys.argv[2])):
        print('Error de invocación: ', sys.argv[0], '<archivo> <punto_mnt>')
        print('<archivo>: nombre de un archivo YAML válido.')
        print(
            '<punto_mnt>: ruta de un directorio en el que el usuario actual tenga'
        )
        print(
            '             permisos de lectura, escritura y ejecución, donde se '
        )
        print('             montará el sistema de archivos..')
        sys.exit(1)

    basefs = sys.argv[1]
    mountpoint = sys.argv[2]
    logging.basicConfig(level=logging.DEBUG)
    FUSE(YamlFS(basefs), mountpoint, nothreads=True, foreground=True)
Esempio n. 16
0
def mount(root: Directory, mountpoint: str, **kwargs):
    kwargs.setdefault('fsname', 'www-fuse')
    kwargs.setdefault('nothreads', True)
    if not os.geteuid():
        kwargs.setdefault('allow_other', True)
    FUSE(Operations(root), mountpoint, **kwargs)
Esempio n. 17
0
def mount(mailfile, mountpoint, verbose=False):
    mailfile.synchronize()
    FUSE(Mailfile_Fuse(mailfile, verbose),
         mountpoint,
         nothreads=True,
         foreground=True)
Esempio n. 18
0
            'st_size': 0,
            'st_uid': 0
        }

    def statfs(self, path):
        #TODO: come up with useful values
        return {
            'f_bsize': 4096,  # file block size
            'f_frsize': 4096,  # fragment size
            'f_blocks': 10000,  # total file blocks
            'f_bfree': 10000,  # free file blocks
            'f_bavail': 1000,  # free blocks for unpriviledged users
            'f_files': 100000,  # number of inodes
            'f_ffree': 10000,  # free inodes
            'f_favail': 10000,  # free inodes for unpriviledged users
            # fsid not present
            'f_flag': 0,  # mount flag
            'f_namemax': 255  # max length of file names
        }

    def flush(self, path, fh):
        LOG.debug("fuse flush: %s" % (path))
        return os.fsync(fh)

    def release(self, path, fh):
        LOG.debug("fuse release: %s" % (path))
        return os.close(fh)


FUSE(RemarkeableFuse(), "/home/pete/mnt3/", nothreads=True, foreground=True)
Esempio n. 19
0
def main(root, mountpoint, readonly):
    FUSE(Passthrough(root, mountpoint, readonly),
         mountpoint,
         nothreads=True,
         foreground=True,
         allow_other=True)