Skip to content

Commit

Permalink
Merge pull request #17 from compscidr/jason/fix-trailing-space
Browse files Browse the repository at this point in the history
fix a trailing space issue
  • Loading branch information
compscidr authored Aug 23, 2024
2 parents 68c519f + 66b0c67 commit da0233f
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class TextFilePacketDumper(
}
return
}
val output = stringDumper.dumpBufferToString(buffer, offset, length, addresses, etherType)
// extra space added so that the hexdump import doesn't skip the last byte, see:
// https://osqa-ask.wireshark.org/questions/39177/wireshark-import-hex-dump-always-strip-last-byte-of-the-packet/
val output = stringDumper.dumpBufferToString(buffer, offset, length, addresses, etherType) + " "
file.writeText(output)
}

Expand All @@ -63,8 +65,8 @@ class TextFilePacketDumper(
): ByteBuffer {
val stringDumper = StringPacketDumper()
val file = File(filename)
var text = file.readText()
logger.debug("raw text: $text")
var text = file.readText().trimEnd() // handle the last space added in dumpBuffer
logger.debug("raw text: '$text'")

if (addresses) {
val lines = text.split("\n")
Expand Down

0 comments on commit da0233f

Please sign in to comment.