Logo Search packages:      
Sourcecode: scapy version File versions  Download package

def scapy::PacketList::sr (   self,
  multi = 0 
)

sr([multi=1]) -> (SndRcvList, PacketList)
match packets in the list and return ( (matched couples), (unmatched packets) )

Definition at line 2380 of file scapy.py.

02380                         :
        """sr([multi=1]) -> (SndRcvList, PacketList)
        match packets in the list and return ( (matched couples), (unmatched packets) )"""
        remain = self.res[:]
        sr = []
        i = 0
        while i < len(remain):
            s = remain[i]
            j = i
            while j < len(remain)-1:
                j += 1
                r = remain[j]
                if r.answers(s):
                    sr.append((s,r))
                    if multi:
                        remain[i]._answered=1
                        remain[j]._answered=2
                        continue
                    del(remain[j])
                    del(remain[i])
                    i -= 1
                    break
            i += 1
            print i, len(remain)
        if multi:
            remain = filter(lambda x:not hasattr(x,"_answered"), remain)
        return SndRcvList(sr),PacketList(remain)
        


        


class Dot11PacketList(PacketList):


Generated by  Doxygen 1.6.0   Back to index