From c6118e1448c91e7aed648e5ee01388df4ab48570 Mon Sep 17 00:00:00 2001 From: _Frky <3105926+Frky@users.noreply.github.com> Date: Wed, 16 Feb 2022 12:07:48 +0100 Subject: [PATCH] Fix bug in HTTP segmented test + clean --- src/proto/smb.rs | 1 - test/src/tests/http.py | 6 ++++-- test/src/tests/rpc.py | 4 ++-- test/src/tests/stun.py | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/proto/smb.rs b/src/proto/smb.rs index 682ecd8..d453289 100644 --- a/src/proto/smb.rs +++ b/src/proto/smb.rs @@ -20,7 +20,6 @@ use std::convert::TryInto; use std::time::SystemTime; use crate::client::ClientInfo; -use crate::logger::MetaLogger; use crate::proto::TCPControlBlock; use crate::Masscanned; diff --git a/test/src/tests/http.py b/test/src/tests/http.py index 2e829ff..0e266b7 100644 --- a/test/src/tests/http.py +++ b/test/src/tests/http.py @@ -76,7 +76,7 @@ def test_ipv4_tcp_http(): @test def test_ipv4_tcp_http_segmented(): - sport = 24592 + sport = 24593 dports = [80, 443, 5000, 53228] for dport in dports: seq_init = int(RandInt()) @@ -120,7 +120,9 @@ def test_ipv4_tcp_http_segmented(): assert resp is not None, "expecting answer, got nothing" check_ip_checksum(resp) assert TCP in resp, "expecting TCP, got %r" % resp.summary() - assert resp[TCP].flags == "A" + assert resp[TCP].flags == "A", ( + 'expecting TCP flag "A", got %r' % resp[TCP].flags + ) req = ( Ether(dst=MAC_ADDR) / IP(dst=IPV4_ADDR) diff --git a/test/src/tests/rpc.py b/test/src/tests/rpc.py index 8f2e5ce..86cd140 100644 --- a/test/src/tests/rpc.py +++ b/test/src/tests/rpc.py @@ -63,11 +63,11 @@ def test_rpc_nmap(): assert port["service_name"] in { "rpcbind", "nfs", - }, f"Unexpected service_name: {port['service_name']}" + }, f"Unexpected service_name: {port['service_name']}" assert port["service_extrainfo"] in { "RPC #100000", "RPC #100003", - }, f"Unexpected service_extrainfo: {port['service_extrainfo']}" + }, f"Unexpected service_extrainfo: {port['service_extrainfo']}" assert ( len(port["scripts"]) == 1 ), f"Expected 1 script, got {len(port['scripts'])}" diff --git a/test/src/tests/stun.py b/test/src/tests/stun.py index 4062ec9..373e7f0 100644 --- a/test/src/tests/stun.py +++ b/test/src/tests/stun.py @@ -127,9 +127,9 @@ def test_ipv4_udp_stun_change_port(): assert UDP in resp, "no UDP layer found" udp = resp[UDP] assert ( - udp.sport == (dport + 1) % 2**16 + udp.sport == (dport + 1) % 2 ** 16 ), "expected answer from UDP/{}, got it from UDP/{}".format( - (dport + 1) % 2**16, udp.sport + (dport + 1) % 2 ** 16, udp.sport ) assert ( udp.dport == sport @@ -170,9 +170,9 @@ def test_ipv6_udp_stun_change_port(): assert UDP in resp, "expecting UDP layer in answer, got nothing" udp = resp[UDP] assert ( - udp.sport == (dport + 1) % 2**16 + udp.sport == (dport + 1) % 2 ** 16 ), "expected answer from UDP/{}, got it from UDP/{}".format( - (dport + 1) % 2**16, udp.sport + (dport + 1) % 2 ** 16, udp.sport ) assert ( udp.dport == sport