Skip to content

Commit

Permalink
Rename method usage of non-existing method
Browse files Browse the repository at this point in the history
  • Loading branch information
RicoVZ committed Jan 17, 2020
1 parent 84d64b1 commit fca7349
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions httpreplay/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

log = logging.getLogger(__name__)

def inet_to_str(inet):
try:
return socket.inet_ntop(socket.AF_INET, inet)
except ValueError:
return socket.inet_ntop(socket.AF_INET6, inet)

class PcapReader(object):
"""Iterates over a PCAP file and yields all interesting events after
having each packet processed by the various callback functions that can be
Expand Down Expand Up @@ -123,17 +129,17 @@ def process(self):
except InvalidTcpPacketOrder as e:
log.error(
"Invalid TCP packet order. Ts: %s (%s -> %s). %s", ts,
init_to_str(ip.src), init_to_str(ip.dst), e
inet_to_str(ip.src), inet_to_str(ip.dst), e
)
except UnknownTcpSequenceNumber as e:
log.error(
"Unknown TCP sequence number. Ts: %s (%s -> %s). %s",
ts, init_to_str(ip.src), init_to_str(ip.dst), e
ts, inet_to_str(ip.src), inet_to_str(ip.dst), e
)
except UnexpectedTcpData as e:
log.error(
"Unexpected TCP data. Ts: %s (%s -> %s). %s", ts,
init_to_str(ip.src), init_to_str(ip.dst), e
inet_to_str(ip.src), inet_to_str(ip.dst), e
)

if isinstance(packet, dpkt.udp.UDP):
Expand All @@ -155,9 +161,3 @@ def handle(self, s, ts, protocol, sent, recv, tlsinfo=None):
self.values.append((s, ts, protocol, sent, recv, tlsinfo))
else:
self.values.append((s, ts, protocol, sent, recv))

def inet_to_str(inet):
try:
return socket.inet_ntop(socket.AF_INET, inet)
except ValueError:
return socket.inet_ntop(socket.AF_INET6, inet)

0 comments on commit fca7349

Please sign in to comment.