示例#1
0
    def m_file(root_file):
        '''
        type for argparse

        @param string root_file:    path of file
        @return string
        '''

        roo = u_dir_abs(root_file)
        if(not u_file_exists(roo)):
            raise ArgumentTypeError('File not found!')
        else:
            return roo
示例#2
0
    def end(self):
        '''
        check created file and print elapsed time
        only if isn't a hash function

        @return void
        '''

        tot = self.others[3]
        for iii in range(0, tot - 1):    # remove temporary file
            u_file_del(self._tmp_r[iii])
            u_file_del(self._tmp_w[iii])

        if(self.others[4]):    # stats
            print()
            print('Reading average time: %.3f sec' % (self.__stat[0] / tot))
            print('Working average time: %.3f sec' % (self.__stat[1] / tot))
            print('Total time: %.3f sec' % (self.__stat[0] + self.__stat[1]))

        if(not self.others[2][self._counter - 1]):    # end info
            if(not u_file_exists(self.file[1])):
                print('File error!\a')
        return
示例#3
0
                    SIZE = 224
                    TYPE = 'sha3_224'

            COUNTER += 1
            APP1((PSW, SIZE, ACTION, TYP, THREADS, ASH))
            APP2(ASH)
            APP3(TYPE)
            if(ASH):
                break

        # question problem
        if(True in HASH):
            ACTION = 'E'    # override
            QUESTION = 'encrypt'
            THREADS = 1
        if(u_file_exists(NAME) and NAME != ROOT and not FORCE and not ASH):
            if(not u_user_input(\
                r'New file already exist, do you wanna proceed? [Y/N] ')):
                m_quit()
        if(FLAG):
            PSW = u_user_check(r'[A-Za-z0-9@#$%^&+=]{6,20}', \
                              'Insert your password: '******'Do you wanna %s your file with ' % QUESTION
        for i in range(COUNTER):    # reset

            if(i > 0):
                QUESTION = '%s%s' % (QUESTION, ', ')
            QUESTION = '%s%s' % (QUESTION, L_TYPE[i])

            # all same
            if(L_TYPE[i] in L_TYPE[0:i] or \