python-ping icon indicating copy to clipboard operation
python-ping copied to clipboard

Incorrect packet length due to padding encoding

Open bitflogger opened this issue 4 years ago • 0 comments

hi,

I noticed that the packets sent in pyping are way too big. After some investigation I found out the padding is 4x larger than expected. It looks like the encoding will add 4 bytes to the datagram for every int in the padBytes array.

I fixed this by changing 'data = bytes(padBytes)' to 'str(bytearray(padBytes))' in /pyping/core.py function 'send_one_ping'.

I understand that bytearray is only available since python 2.6, so to preserve backward compatibility, you may want to use a slightly different method.

I use python 2.7.17 by the way.

regards, /steven

ps; sorry if i did not put a savvy diff in here. i'm new to this.

bitflogger avatar Apr 29 '20 07:04 bitflogger