Ejemplo n.º 1
0
    def _create_round_samplesets(self):
        state = {
            'knownalphabet': self._round.knownalphabet,
            'knownsecret': self._round.knownsecret
        }

        self._round.batch += 1
        self._round.save()

        candidate_alphabets = self._build_candidates(state)

        alignmentalphabet = ''
        if self._round.check_block_align():
            alignmentalphabet = list(
                self._round.victim.target.alignmentalphabet)
            random.shuffle(alignmentalphabet)
            alignmentalphabet = ''.join(alignmentalphabet)

        logger.debug('\tAlignment alphabet: {}'.format(alignmentalphabet))

        for candidate in candidate_alphabets:
            SampleSet.create_sampleset({
                'round': self._round,
                'candidatealphabet': candidate,
                'alignmentalphabet': alignmentalphabet,
                'batch': self._round.batch
            })
Ejemplo n.º 2
0
    def _create_round_samplesets(self):
        state = {
            'knownalphabet': self._round.knownalphabet,
            'knownsecret': self._round.knownsecret
        }

        self._round.batch += 1
        self._round.save()

        candidate_alphabets = self._build_candidates(state)

        alignmentalphabet = ''
        if self._round.check_block_align():
            alignmentalphabet = list(self._round.victim.target.alignmentalphabet)
            random.shuffle(alignmentalphabet)
            alignmentalphabet = ''.join(alignmentalphabet)

        logger.debug('\tAlignment alphabet: {}'.format(alignmentalphabet))

        for candidate in candidate_alphabets:
            SampleSet.create_sampleset({
                'round': self._round,
                'candidatealphabet': candidate,
                'alignmentalphabet': alignmentalphabet,
                'batch': self._round.batch
            })
Ejemplo n.º 3
0
 def _handle_sampleset_success(self, capture, sampleset):
     '''Save capture of successful sampleset
     or mark sampleset as failed and create new sampleset for the same element that failed.'''
     if capture:
         sampleset.success = True
         sampleset.data = capture['data']
         sampleset.records = capture['records']
         sampleset.save()
     else:
         SampleSet.create_sampleset({
             'round': self._round,
             'candidatealphabet': sampleset.candidatealphabet,
             'alignmentalphabet': sampleset.alignmentalphabet,
             'batch': sampleset.batch
         })
Ejemplo n.º 4
0
 def _handle_sampleset_success(self, capture, sampleset):
     '''Save capture of successful sampleset
     or mark sampleset as failed and create new sampleset for the same element that failed.'''
     if capture:
         sampleset.success = True
         sampleset.data = capture['data']
         sampleset.records = capture['records']
         sampleset.save()
     else:
         SampleSet.create_sampleset({
             'round': self._round,
             'candidatealphabet': sampleset.candidatealphabet,
             'alignmentalphabet': sampleset.alignmentalphabet,
             'batch': sampleset.batch
         })