# Path: Peach/agent.py
# class Monitor(object):
#     """
#     Extend from this to implement a Monitor.
#     Monitors are run by an Agent and must operate in an async manner.
#     Any blocking tasks must be performed in another thread.
# 
#     Agent: onTestStarting()
#     Agent: onTestFinished()
#     Agent: redoTest()
#     Agent: Sending redoTest result [False]
#     Agent: detectFault()
#     Agent: Detected fault!
#     Agent: Sending detectFault result [True]
#     Agent: getMonitorData()
#     Agent: onFault()
#     Agent: stopRun()
#     Agent: onShutdown()
#     """
# 
#     def __init__(self, args):
#         """
#         Arguments are supplied via the Peach XML file.
# 
#         @type	args: Dictionary
#         @param	args: Dictionary of parameters
#         """
#         self._name = None
# 
#     def OnTestStarting(self):
#         """Called right before start of test case or variation."""
#         pass
# 
#     def OnTestFinished(self):
#         """Called right after a test case or variation."""
#         pass
# 
#     def GetMonitorData(self):
#         """Get any monitored data from a test case."""
#         return None
# 
#     def RedoTest(self):
#         """Should the current test be re-performed."""
#         return False
# 
#     def DetectedFault(self):
#         """Check if a fault was detected."""
#         return False
# 
#     def OnFault(self):
#         """Called when a fault was detected."""
#         pass
# 
#     def OnShutdown(self):
#         """Called when Agent is shutting down, typically at end of a test run or when a Stop-Run occurs."""
#         pass
# 
#     def StopRun(self):
#         """Return True to force test run to fail. This should return True if an unrecoverable error occurs."""
#         return False
# 
#     def PublisherCall(self, method):
#         """Called when a call action is being performed.
#         Call actions are used to launch programs, this gives the monitor a chance to determine if it should be
#         running the program under a debugger instead. Note: This is a bit of a hack to get this working.
#         """
#         pass


import sys
import threading
import os
import re
import socket
        import pcap
        import pcap
from Peach.agent import Monitor
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.



try:
    def search_file(filename):
        """Find a file in a search path."""
        search_path = os.getenv("path")
        paths = search_path.split(os.path.pathsep)
        for path in paths:
            if os.path.exists(os.path.join(path, filename)):
                return True
        return False
    if sys.platform == 'win32' and search_file("wpcap.dll"):
    elif sys.platform != 'win32':
except:
    pass



# Path: Peach/agent.py
# class Monitor(object):
#     """
#     Extend from this to implement a Monitor.
#     Monitors are run by an Agent and must operate in an async manner.
#     Any blocking tasks must be performed in another thread.
# 
#     Agent: onTestStarting()
#     Agent: onTestFinished()
#     Agent: redoTest()
#     Agent: Sending redoTest result [False]
#     Agent: detectFault()
#     Agent: Detected fault!
#     Agent: Sending detectFault result [True]
#     Agent: getMonitorData()
#     Agent: onFault()
#     Agent: stopRun()
#     Agent: onShutdown()
#     """
# 
#     def __init__(self, args):
#         """
#         Arguments are supplied via the Peach XML file.
# 
#         @type	args: Dictionary
#         @param	args: Dictionary of parameters
#         """
#         self._name = None
# 
#     def OnTestStarting(self):
#         """Called right before start of test case or variation."""
#         pass
# 
#     def OnTestFinished(self):
#         """Called right after a test case or variation."""
#         pass
# 
#     def GetMonitorData(self):
#         """Get any monitored data from a test case."""
#         return None
# 
#     def RedoTest(self):
#         """Should the current test be re-performed."""
#         return False
# 
#     def DetectedFault(self):
#         """Check if a fault was detected."""
#         return False
# 
#     def OnFault(self):
#         """Called when a fault was detected."""
#         pass
# 
#     def OnShutdown(self):
#         """Called when Agent is shutting down, typically at end of a test run or when a Stop-Run occurs."""
#         pass
# 
#     def StopRun(self):
#         """Return True to force test run to fail. This should return True if an unrecoverable error occurs."""
#         return False
# 
#     def PublisherCall(self, method):
#         """Called when a call action is being performed.
#         Call actions are used to launch programs, this gives the monitor a chance to determine if it should be
#         running the program under a debugger instead. Note: This is a bit of a hack to get this working.
#         """
#         pass


# Path: Peach/Agent/network.py
import sys
import threading
import os
import re
import socket
        import pcap
        import pcap
from Peach.agent import Monitor

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.



try:
    def search_file(filename):
        """Find a file in a search path."""
        search_path = os.getenv("path")
        paths = search_path.split(os.path.pathsep)
        for path in paths:
            if os.path.exists(os.path.join(path, filename)):
                return True
        return False
    if sys.platform == 'win32' and search_file("wpcap.dll"):
    elif sys.platform != 'win32':
except:
    pass



class PingMonitor(Monitor):