def test_single_rogue(): """ Title: Single Malicious Host Scenario 1: When: Given a bridge with 4 ports (port1-port4) Then: A UDP is reachable from port2 to port1 scanning ports from port4 to port3 Note: bindings1: no tunnel bindings2: port2 -> port1 over tunnel bindings3: port4 -> port3 over tunnel """ rogue1 = BM.get_iface_for_port('bridge-000-001', 4) mc = rogue1._delegate._proxy._concrete scanner1 = ScanPortFailure(mc._get_nsname(), mc._get_peer_ifname(), ('172.16.1.4', '1-10000'), ('172.16.1.3', '1-10000'), '100') scanner1.inject() try: time.sleep(30) check_honest_with_random_udp() # under port scanning finally: scanner1.eject() time.sleep(10)
def test_two_rogue(): """ Title: Two Malicious Hosts Scenario 1: When: Given a bridge with 6 ports (port1-port6) Then: A UDP is reachable from port2 to port1 scanning ports from port4 to port3 and from port6 to port5 Note: bindings1: no tunnel bindings2: port2 -> port1 over tunnel bindings3: port4 -> port3 over tunnel """ # rogue1 may be over tunnel (e.g. bindings3), so delay is set # to a slightly larger value decreasing the total load of two # agents. rogue1 = BM.get_iface_for_port('bridge-000-001', 4) mc = rogue1._delegate._proxy._concrete scanner1 = ScanPortFailure(mc._get_nsname(), mc._get_peer_ifname(), ('172.16.1.4', '1-10000'), ('172.16.1.3', '1-10000'), '200') rogue2 = BM.get_iface_for_port('bridge-000-001', 6) mc = rogue2._delegate._proxy._concrete scanner2 = ScanPortFailure(mc._get_nsname(), mc._get_peer_ifname(), ('172.16.1.6', '1-10000'), ('172.16.1.5', '1-10000'), '200') scanner1.inject() try: scanner2.inject() try: time.sleep(30) check_honest_with_random_udp() # under port scanning finally: scanner2.eject() finally: scanner1.eject() time.sleep(10)