Run Black

This commit is contained in:
_Frky 2022-05-30 15:28:05 +02:00
parent 9fdecf5be7
commit f696afa45d
3 changed files with 10 additions and 22 deletions

View file

@ -47,10 +47,10 @@ def test(f):
def w(m): def w(m):
try: try:
# check that masscanned is still running # check that masscanned is still running
assert(m.poll() is None), "masscanned not running" assert m.poll() is None, "masscanned not running"
f() f()
# check that masscanned is still running # check that masscanned is still running
assert(m.poll() is None), "masscanned terminated unexpectedly" assert m.poll() is None, "masscanned terminated unexpectedly"
LOG.info("{}{}".format(fname, OK)) LOG.info("{}{}".format(fname, OK))
except AssertionError as e: except AssertionError as e:
LOG.error("{}{}: {}".format(fname, KO, e)) LOG.error("{}{}: {}".format(fname, KO, e))

View file

@ -24,28 +24,23 @@ from scapy.volatile import RandInt
from ..conf import IPV4_ADDR, IPV6_ADDR, MAC_ADDR from ..conf import IPV4_ADDR, IPV6_ADDR, MAC_ADDR
from ..core import test, check_ip_checksum, check_ipv6_checksum from ..core import test, check_ip_checksum, check_ipv6_checksum
@test @test
def test_ipv4_tcp_empty(): def test_ipv4_tcp_empty():
for p in [0, 80, 443]: for p in [0, 80, 443]:
req = ( req = Ether(dst=MAC_ADDR) / IP(dst=IPV4_ADDR, proto=6) / Raw() # UDP
Ether(dst=MAC_ADDR)
/ IP(dst=IPV4_ADDR, proto=6) # UDP
/ Raw()
)
repl = srp1(req, timeout=1) repl = srp1(req, timeout=1)
assert repl is None, "expecting no answer, got one" assert repl is None, "expecting no answer, got one"
@test @test
def test_ipv6_tcp_empty(): def test_ipv6_tcp_empty():
for p in [0, 80, 443]: for p in [0, 80, 443]:
req = ( req = Ether(dst=MAC_ADDR) / IPv6(dst=IPV6_ADDR, nh=6) / Raw() # UDP
Ether(dst=MAC_ADDR)
/ IPv6(dst=IPV6_ADDR, nh=6) # UDP
/ Raw()
)
repl = srp1(req, timeout=1) repl = srp1(req, timeout=1)
assert repl is None, "expecting no answer, got one" assert repl is None, "expecting no answer, got one"
@test @test
def test_tcp_syn(): def test_tcp_syn():
##### SYN-ACK ##### ##### SYN-ACK #####

View file

@ -28,21 +28,14 @@ from ..core import test, check_ip_checksum, check_ipv6_checksum
@test @test
def test_ipv4_udp_empty(): def test_ipv4_udp_empty():
for p in [0, 53, 1000]: for p in [0, 53, 1000]:
req = ( req = Ether(dst=MAC_ADDR) / IP(dst=IPV4_ADDR, proto=17) / Raw() # UDP
Ether(dst=MAC_ADDR)
/ IP(dst=IPV4_ADDR, proto=17) # UDP
/ Raw()
)
repl = srp1(req, timeout=1) repl = srp1(req, timeout=1)
assert repl is None, "expecting no answer, got one" assert repl is None, "expecting no answer, got one"
@test @test
def test_ipv6_udp_empty(): def test_ipv6_udp_empty():
for p in [0, 53, 1000]: for p in [0, 53, 1000]:
req = ( req = Ether(dst=MAC_ADDR) / IPv6(dst=IPV6_ADDR, nh=17) / Raw() # UDP
Ether(dst=MAC_ADDR)
/ IPv6(dst=IPV6_ADDR, nh=17) # UDP
/ Raw()
)
repl = srp1(req, timeout=1) repl = srp1(req, timeout=1)
assert repl is None, "expecting no answer, got one" assert repl is None, "expecting no answer, got one"