Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import struct
import time

class Target(object):
class Target:

def __init__(self, target):
self.name = target
Expand All @@ -20,7 +20,7 @@ def __init__(self, target):
def __str__(self):
return '{name} [{address}]'.format(name=self.name, address=self.address[0])

class IcmpEcho(object):
class IcmpEcho:

def __init__(self, type=8, code=0, checksum=0, identifier=0, sequence_number=0, payload=b''):
self.type = type
Expand Down Expand Up @@ -69,13 +69,13 @@ def from_bytes(data):
return ret

def __repr__(self):
return 'IcmpEcho(type={type}, code={code}, checksum={checksum}, identifier={identifier}, sequence_number={sequence_number}, payload={payload})'.format(
return 'IcmpEcho(type={type}, code={code}, checksum={checksum}, identifier={identifier}, sequence_number={sequence_number}, payload={payload!r})'.format(
type=self.type,
code=self.code,
checksum=self.checksum,
identifier=self.identifier,
sequence_number=self.sequence_number,
payload=repr(self.payload)
payload=self.payload
)

def ping(target, timeout=5.0):
Expand Down