Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from ._common import _to_unicode
from ._interface import PingParserInterface
from ._logger import logger
from ._parser import (
AlpineLinuxPingParser,
LinuxPingParser,
MacOsPingParser,
NullPingParser,
WindowsPingParser,
)
from ._stats import PingStats
from .error import ParseError, ParseErrorReason
class PingParsing(PingParserInterface):
"""
Parser class to parsing ping command output.
"""
def __init__(self):
self.__parser = NullPingParser()
self.__stats = None
@property
def parser_name(self):
return self.__parser._parser_name
@property
def destination(self):
# deprecated
return self.__stats.destination
import abc
import re
import pyparsing as pp
import typepy
from typepy import DateTime
from ._common import _to_unicode
from ._interface import PingParserInterface
from ._logger import logger
from ._stats import PingStats
from .error import ParseError, ParseErrorReason
class PingParser(PingParserInterface):
_IPADDR_PATTERN = r"(\d{1,3}\.){3}\d{1,3}"
_ICMP_SEQ_PATTERN = r"icmp_seq=(?P\d+)"
_TTL_PATTERN = r"ttl=(?P\d+)"
_TIME_PATTERN = r"time=(?P<time>[0-9\.]+)"
@abc.abstractproperty
def _parser_name(self): # pragma: no cover
pass
@abc.abstractproperty
def _icmp_reply_pattern(self): # pragma: no cover
pass
@property
def _duplicate_packet_pattern(self):</time>