diff --git a/scapy/arch/windows/__init__.py b/scapy/arch/windows/__init__.py index 44f3569b939809e68b667f9931f4647d59316923..0d1f34babb7e822b45c1fb61feed3dd981c5a585 100755 --- a/scapy/arch/windows/__init__.py +++ b/scapy/arch/windows/__init__.py @@ -650,7 +650,7 @@ L2socket: use the provided L2socket r = prn(p) if r is not None: print r - if count > 0 and c >= count: + if 0 < count <= c: break except KeyboardInterrupt: break diff --git a/scapy/contrib/eigrp.py b/scapy/contrib/eigrp.py index 94be657140cc76698568e138e1c66a444595a476..fed3e21309d9ecd92c32aaac839b862575e796f5 100644 --- a/scapy/contrib/eigrp.py +++ b/scapy/contrib/eigrp.py @@ -267,7 +267,7 @@ class ShortVersionField(ShortField): return (major << 8) | minor - elif type(x) is int and x >= 0 and x <= 65535: + elif type(x) is int and 0 <= x <= 65535: return x else: if self.default != None: diff --git a/scapy/layers/dns.py b/scapy/layers/dns.py index 3396a66435063b3899d4fac12b8fcb9329dc08a8..5315e07b1e97c7ae67ce8fb32df340757508e733 100644 --- a/scapy/layers/dns.py +++ b/scapy/layers/dns.py @@ -415,7 +415,7 @@ def RRlist2bitmap(lst): for wb in xrange(min_window_blocks, max_window_blocks+1): # First, filter out RR not encoded in the current window block # i.e. keep everything between 256*wb <= 256*(wb+1) - rrlist = filter(lambda x: 256*wb <= x and x < 256*(wb+1), lst) + rrlist = filter(lambda x: 256 * wb <= x < 256 * (wb + 1), lst) rrlist.sort() if rrlist == []: continue @@ -436,7 +436,7 @@ def RRlist2bitmap(lst): for tmp in xrange(bytes): v = 0 # Remove out of range Ressource Records - tmp_rrlist = filter(lambda x: 256*wb+8*tmp <= x and x < 256*wb+8*tmp+8, rrlist) + tmp_rrlist = filter(lambda x: 256 * wb + 8 * tmp <= x < 256 * wb + 8 * tmp + 8, rrlist) if not tmp_rrlist == []: # 1. rescale to fit into 8 bits tmp_rrlist = map(lambda x: (x-256*wb)-(tmp*8), tmp_rrlist) diff --git a/scapy/layers/dot11.py b/scapy/layers/dot11.py index b340dd855a4974bd623061d003a75e5132427031..df91e104516b7a1ff5307e72852107d75bbca622 100644 --- a/scapy/layers/dot11.py +++ b/scapy/layers/dot11.py @@ -167,7 +167,7 @@ class Dot11(Packet): def mysummary(self): return self.sprintf("802.11 %Dot11.type% %Dot11.subtype% %Dot11.addr2% > %Dot11.addr1%") def guess_payload_class(self, payload): - if self.type == 0x02 and (self.subtype >= 0x08 and self.subtype <=0xF and self.subtype != 0xD): + if self.type == 0x02 and (0x08 <= self.subtype <= 0xF and self.subtype != 0xD): return Dot11QoS elif self.FCfield & 0x40: return Dot11WEP diff --git a/scapy/sendrecv.py b/scapy/sendrecv.py index 1d1d2afbebb95b2674ce8429acd49099e999c23d..37a42940611955735c87c93c6b42b8a7b28cd67b 100644 --- a/scapy/sendrecv.py +++ b/scapy/sendrecv.py @@ -619,7 +619,7 @@ interfaces) if stop_filter and stop_filter(p): stop_event = True break - if count > 0 and c >= count: + if 0 < count <= c: stop_event = True break except KeyboardInterrupt: @@ -689,7 +689,7 @@ stop_filter: python function applied to each packet to determine if stop_filter and stop_filter(p): stop_event = True break - if count > 0 and c >= count: + if 0 < count <= c: stop_event = True break except KeyboardInterrupt: