예제 #1
0
def decode(args):
    """
    Command for decoding paths given paths with 'encfsctl'.
    Will listen on stdin if no path was given.

    Args:
        args (argparse.Namespace):
                        previously parsed arguments

    Raises:
        SystemExit:     0
    """
    force_stdout = setQuiet(args)
    cfg = getConfig(args)
    if cfg.snapshotsMode() not in ('local_encfs', 'ssh_encfs'):
        logger.error("Profile '%s' is not encrypted." % cfg.profileName())
        sys.exit(RETURN_ERR)
    _mount(cfg)
    d = encfstools.Decode(cfg)
    if not args.PATH:
        while True:
            try:
                path = input()
            except EOFError:
                break
            if not path:
                break
            print(d.path(path), file=force_stdout)
    else:
        print('\n'.join(d.list(args.PATH)), file=force_stdout)
    d.close()
    _umount(cfg)
    sys.exit(RETURN_OK)
예제 #2
0
 def btnDecodeClicked(self):
     if not self.decode:
         self.decode = encfstools.Decode(self.config)
     cursor = self.txtLogView.textCursor()
     selection = cursor.selectedText().strip()
     plain = self.decode.path(selection)
     cursor.insertText(plain)
예제 #3
0
 def onBtnDecode(self, checked):
     if checked:
         self.decode = encfstools.Decode(self.config)
         self.last_message = None
         self.updateInfo()
     else:
         self.decode = None
예제 #4
0
 def on_cb_decode(self):
     if self.cb_decode.isChecked():
         self.decode = encfstools.Decode(self.config)
     else:
         if not self.decode is None:
             self.decode.close()
         self.decode = None
     self.update_log()
예제 #5
0
 def cbDecodeChanged(self):
     if self.cbDecode.isChecked():
         self.decode = encfstools.Decode(self.config)
     else:
         if not self.decode is None:
             self.decode.close()
         self.decode = None
     self.updateLog()