예제 #1
0
    def deconvolve(self):
        target = gauss(self.vbi, self.gauss_sd)
        self.target = normalise(target)

        self.make_guess_mask()
        self.make_possible_bytes(Vbi.possible_bytes)

        self._oldbytes = np.zeros(42, dtype=np.uint8)

        self._deconvolve()

        packet = "".join([chr(x) for x in self.g.bytes])

        F = finders.test(self.finders, packet)
        if F:
                sys.stderr.write("matched by finder "+F.name+"\n");
                sys.stderr.flush()               
                self.make_possible_bytes(F.possible_bytes)
                self._deconvolve()
                F.find(self.g.bytes)
                packet = F.fixup()
                return packet

        # if the packet did not match any of the finders then it isn't 
        # a packet 0 (or 30). if the packet still claims to be a packet 0 it 
        # will mess up the page splitter. so redo the deconvolution but with 
        # packet 0 (and 30) header removed from possible bytes.

        # note: this doesn't work. i am not sure why. a packet in 63322
        # does not match the finders but still passes through this next check
        # with r=0. which should be impossible.
        ((m,r),e) = mrag(self.g.bytes[:2])
        if r == 0:
            sys.stderr.write("packet falsely claimed to be packet %d\n" % r);
            sys.stderr.flush()
            if not self.allow_unmatched:
                self._nzdeconvolve()
            packet = "".join([chr(x) for x in self.g.bytes])
        # if it's a link packet, it is completely hammed
        elif r == 27:
            self.make_possible_bytes([hammbytes]*42)
            self._deconvolve()
            packet = "".join([chr(x) for x in self.g.bytes])

        return packet
예제 #2
0
    def __init__(self, tt):

        self.sequence = PacketHolder.sequence
        PacketHolder.sequence += 1

        (self.m,self.r),e = mrag(np.fromstring(tt[:2], dtype=np.uint8))
        match = False
        F = finders.test(finders.all_headers, tt)
        if F:
            self.r = 0
            F.check_page_info()
            self.me = False #F.me
            self.pe = False #F.pe
            self.p = F.p
            match = True
                
        if not match and self.r == 0:
            self.r = -1
            self.m = -1
        self.tt = tt
        self.used = False