Example #1
0
def test_match_tcp_generators():
    assert MatchTcpFlags.match_ack() == MatchTcpFlags(
        TcpFlags(ack=True), useAck=True)
    assert MatchTcpFlags.match_rst() == MatchTcpFlags(
        TcpFlags(rst=True), useRst=True)
    assert len(MatchTcpFlags.match_established()) == 2
    assert MatchTcpFlags.match_established() == [MatchTcpFlags.match_ack(),
                                                 MatchTcpFlags.match_rst()]
Example #2
0
def test_match_tcp_generators():
    assert MatchTcpFlags.match_ack() == MatchTcpFlags(TcpFlags(ack=True), useAck=True)
    assert MatchTcpFlags.match_rst() == MatchTcpFlags(TcpFlags(rst=True), useRst=True)
    assert MatchTcpFlags.match_syn() == MatchTcpFlags(TcpFlags(syn=True), useSyn=True)
    assert MatchTcpFlags.match_synack() == MatchTcpFlags(
        TcpFlags(ack=True, syn=True), useAck=True, useSyn=True
    )
    assert len(MatchTcpFlags.match_established()) == 2
    assert MatchTcpFlags.match_established() == [
        MatchTcpFlags.match_ack(),
        MatchTcpFlags.match_rst(),
    ]
    assert MatchTcpFlags.match_not_established() == [
        MatchTcpFlags(useAck=True, useRst=True, tcpFlags=TcpFlags(ack=False, rst=False))
    ]