def onCommandDec(self): """""" done = True if self.o.outputfile is None : self.o.outputfile = self.a[1][:-4] if self.a[1][-4:] == Kirmah.EXT else self.a[1] if not Sys.g.QUIET : self.parser.print_header() if Io.file_exists(self.o.outputfile) and not self.o.force: Sys.pwarn((('the file ',(self.o.outputfile, Sys.Clz.fgb3), ' already exists !'),)) done = Sys.pask('Are you sure to rewrite this file') self.stime = Sys.datetime.now() if done : try : if (self.o.multiprocess is not None and not represents_int(self.o.multiprocess)) or (not self.o.multiprocess is None and not(int(self.o.multiprocess)>=2 and int(self.o.multiprocess) <=8)) : self.parser.error_cmd((('invalid option ',('-j, --multiprocess', Sys.Clz.fgb3), ' value (', ('2',Sys.Clz.fgb3),' to ', ('8',Sys.Clz.fgb3),')'),)) nproc = int(self.o.multiprocess) if not self.o.multiprocess is None and int(self.o.multiprocess)>=2 and int(self.o.multiprocess) <=8 else 1 Sys.ptask() key = Io.get_data(self.o.keyfile) km = Kirmah(key) km.decrypt(self.a[1], self.o.outputfile, nproc) except BadKeyException: done = False Sys.pwarn((('BadKeyException : ',('wrong key ',Sys.CLZ_WARN_PARAM), ' !'),), False) if not Sys.g.QUIET : self.onend_cmd('Kirmah Decrypt', self.stime, done, self.o.outputfile)
def onCommandDec(self): """""" done = True if self.o.outputfile is None: self.o.outputfile = self.a[1][:-4] if self.a[1][ -4:] == Kirmah.EXT else self.a[1] if not Sys.g.QUIET: self.parser.print_header() if Io.file_exists(self.o.outputfile) and not self.o.force: Sys.pwarn((('the file ', (self.o.outputfile, Sys.Clz.fgb3), ' already exists !'), )) done = Sys.pask('Are you sure to rewrite this file') self.stime = Sys.datetime.now() if done: try: if (self.o.multiprocess is not None and not represents_int(self.o.multiprocess)) or ( not self.o.multiprocess is None and not (int(self.o.multiprocess) >= 2 and int(self.o.multiprocess) <= 8)): self.parser.error_cmd( (('invalid option ', ('-j, --multiprocess', Sys.Clz.fgb3), ' value (', ('2', Sys.Clz.fgb3), ' to ', ('8', Sys.Clz.fgb3), ')'), )) nproc = int(self.o.multiprocess ) if not self.o.multiprocess is None and int( self.o.multiprocess) >= 2 and int( self.o.multiprocess) <= 8 else 1 Sys.ptask() key = Io.get_data(self.o.keyfile) km = Kirmah(key) km.decrypt(self.a[1], self.o.outputfile, nproc) except BadKeyException: done = False Sys.pwarn((('BadKeyException : ', ('wrong key ', Sys.CLZ_WARN_PARAM), ' !'), ), False) if not Sys.g.QUIET: self.onend_cmd('Kirmah Decrypt', self.stime, done, self.o.outputfile)