示例#1
0
 def test_http_status(self):
     obj = Pcap2(
         "tests/files/pcap/status-code.pcap", None, tempfile.mkdtemp()
     ).run()
     assert len(obj["http_ex"]) == 1
     assert not obj["https_ex"]
     assert obj["http_ex"][0]["status"] == 301
示例#2
0
    def test_smtp_ex(self):
        obj = Pcap2("tests/files/pcap/smtp.pcap", None,
                    tempfile.mkdtemp()).run()

        assert len(obj["smtp_ex"]) == 1
        assert obj["smtp_ex"][0]["req"]["username"] == "galunt"
        assert obj["smtp_ex"][0]["req"]["password"] == "V1v1tr0n"
        assert obj["smtp_ex"][0]["req"]["mail_to"] == [
            "*****@*****.**",
        ]
        assert obj["smtp_ex"][0]["req"]["mail_from"] == [
            "*****@*****.**",
        ]
        assert len(obj["smtp_ex"][0]["req"]["headers"]) == 10
        assert obj["smtp_ex"][0]["resp"]["banner"] == (
            "220 smtp006.mail.xxx.xxxxx.com ESMTP\r\n")
示例#3
0
 def test_http_nostatus(self):
     obj = Pcap2(
         "tests/files/pcap/not-http.pcap", None, tempfile.mkdtemp()
     ).run()
     assert len(obj["http_ex"]) == 1