====== Pktdump ======
pktdump is a utility to dump the headers and optionally the body of raw FTN packets.

====== Usage ======
pktdump [-body] <file1.pkt> [file2.pkt] [...]

===== Example =====
/sbbs/exec/pktdump /sbbs/ftn/out/fidonet/*.?ut

===== scripting examples =====
It is possible for pkts to be abandoned when a mailer deletes .flo files without sending the pkts listed inside it. If you don't want that mail to be lost, you can use some oneliners that use pktdump to retrieve the destination addresses from the pkts and create new .flo files for them.

First run through all the pkts and output a list of destination addresses.
<code>
# make a list of pkt destination addresses
/sbbs/exec/pktdump /sbbs/fido/outbound/*.pkt | \
  egrep -e "Packet Type .* from $MYFTNADDR to " | \
  cut -d " " -f 12 | sort -V | uniq
</code>

Now, use one of the above addresses in place of $DESTADDR and your FTN address in place of $MYFTNADDR to move all the pkts for the destination system to the /sbbs/tmp directory.
<code>
# choose an address from the above list
# get a list of pkts destined there and
# move those pkts to the tmp directory
/sbbs/exec/pktdump /sbbs/fido/outbound/*.pkt | \
  egrep -e "Packet Type .* from $MYFTNADDR to $DESTADDR" | \
  cut -d " " -f 1 | tr '\n' '\0' | \
  xargs -0 -n1 -i mv '{}' /sbbs/tmp
</code>

Now that we have moved the pkts, lets create a .flo file with them for the destination address. Put the destination system's net number in place of $DESTNET and its node number in place of $DESTNODE.
<code>
# create a flo file with the pkts
printf "$(ls -d -1 $PWD/*.pkt | \
  sed 's/^/\^/')\n" > \
  $(printf "%04x%04x.flo\n" $DESTNET $DESTNODE)
</code>

The above can be done a bit better by not moving the pkts to the tmp directory first but this works fine with some manual work added. Once the .flo file is created, it is a simple matter to manually move it to the proper outbound directory and wait for the mailer to transit and delete the pkts listed in it before handling the next system in the list of destinations.

The above can be fixed up into a proper script that doesn't need to move the files at all. There should be some .bsy file creation to prevent the tosser and mailer from trying to process mail for the same system you are working with while the pkts are processed and the .flo file is created.

These example oneliners helped a least one hub system to recover several thousand pkts that were abandoned due to a problem accessing them.

===== See Also =====
  * [[:util:|util index]]

{{tag>}}
