コード例 #1
0
    def test_dump_file_override(self):
        capture = PacketCapture(self.net)
        capture.start_capture("h1")
        capture.stop_capture()

        file_name = capture.get_file_name()
        first_create_time = os.path.getctime(file_name)

        capture = PacketCapture(self.net)
        capture.start_capture("h1")
        capture.stop_capture()

        second_create_time = os.path.getctime(file_name)
        self.assertTrue(second_create_time > first_create_time, "pcap is overriden on second run")
コード例 #2
0
 def test_dump_file_exists(self):
     capture = PacketCapture(self.net)
     capture.start_capture("h1")
     capture.stop_capture()
     self.assertTrue(os.path.isfile("/tmp/h1-eth0.pcap"), "pcap file exists")
コード例 #3
0
 def test_dump_right_file_name(self):
     capture = PacketCapture(self.net)
     capture.start_capture("h1")
     capture.stop_capture()
     self.assertEqual(capture.get_file_name(), "/tmp/h1-eth0.pcap", "TCP-Dump uses right file.")
コード例 #4
0
    def test_dump_file_override(self):
        capture = PacketCapture(self.net)
        capture.start_capture("h1")
        capture.stop_capture()

        file_name = capture.get_file_name()
        first_create_time = os.path.getctime(file_name)

        capture = PacketCapture(self.net)
        capture.start_capture("h1")
        capture.stop_capture()

        second_create_time = os.path.getctime(file_name)
        self.assertTrue(second_create_time > first_create_time,
                        "pcap is overriden on second run")
コード例 #5
0
 def test_dump_file_exists(self):
     capture = PacketCapture(self.net)
     capture.start_capture("h1")
     capture.stop_capture()
     self.assertTrue(os.path.isfile("/tmp/h1-eth0.pcap"),
                     "pcap file exists")
コード例 #6
0
 def test_dump_right_file_name(self):
     capture = PacketCapture(self.net)
     capture.start_capture("h1")
     capture.stop_capture()
     self.assertEqual(capture.get_file_name(), "/tmp/h1-eth0.pcap",
                      "TCP-Dump uses right file.")