ad: Winterfest-1

Decode off-the-air Winlink message - request for programming help

Discussion in 'Working Different Modes' started by KX4O, Aug 6, 2019.

ad: L-HROutlet
ad: l-rl
ad: L-MFJ
ad: Left-2
ad: MessiPaoloni-1
ad: Subscribe
  1. KX4O

    KX4O Ham Member QRZ Page

    Anyone reasonably good at a linux prompt and the C environment might be interested in helping develop some decode software to take the binary file created by an existing program, tease out the binary payload section and run it through lzhuf for decode to derive its original text.

    Details here...

    A crude proof of concept works, but there is slightly more to it. If interested, please ask questions.
     
    KA0HCP likes this.
  2. KX4O

    KX4O Ham Member QRZ Page

    Essentially, there is a need for a program that can turn this example Winlink/FBB binary data that could have been delivered by any modem...

    00000000 02 fa e2 64 87 03 00 00 ec f5 7a 1c 6d 66 fb cb |...d......z.mf..|
    00000010 e2 e6 f4 ba 37 7c fc 4e 77 13 ad 99 cb 61 fb 40 |....7|.Nw....a.@|
    00000020 3e 31 81 3d e6 f7 8b bb b0 e1 d6 e0 57 60 d7 f0 |>1.=........W`..|
    00000030 b0 a8 4f b6 b5 f0 02 ff 2c 42 fd cf f7 d4 0a 38 |..O.....,B.....8|
    00000040 82 54 9b ca 2f df e6 5c ae be 2f 03 a9 de 90 9e |.T../..\../.....|
    00000050 1c 99 78 17 e3 92 ef c8 d1 ce 9b 1c 03 ee fb 59 |..x............Y|
    00000060 7b ec e5 ca 7c f1 0e d6 0c 7f 62 ac 9a af 29 57 |{...|.....b...)W|
    00000070 ff b3 8a 77 fa f8 3a c6 85 f7 f0 a5 47 dd e8 13 |...w..:.....G...|
    00000080 16 8e 9c 4e 42 14 66 24 72 78 42 dc bf 7c 58 40 |...NB.f$rxB..|X@|
    00000090 eb 14 5c 22 83 45 02 57 2c 90 41 2d 2d 5e b4 77 |..\".E.W,.A--^.w|
    000000a0 bf b1 8a 8a 98 91 ae 02 37 e5 f7 dd 0e 0c 84 9c |........7.......|
    000000b0 11 f8 81 61 13 41 c2 ec c1 42 f2 a5 94 25 f5 46 |...a.A...B...%.F|
    000000c0 88 b1 06 1a 7f 81 bb fe 9a c7 2e ba 24 f3 c3 43 |............$..C|
    000000d0 f5 fd d2 2d e4 60 f6 bb 43 52 7b e6 85 82 f1 99 |...-.`..CR{.....|
    000000e0 74 ae f6 0a b4 48 80 35 c3 63 b1 f5 f5 de 8c 6e |t....H.5.c.....n|
    000000f0 88 b7 20 9d 1d 99 9b 00 50 61 b7 84 02 fa 9f fb |.. .....Pa......|
    00000100 3f 9d ae c5 f8 cd b5 10 cb 8a bd fe ab dd e6 47 |?..............G|
    00000110 e6 d3 53 97 97 05 eb a9 5e f3 8e 61 ea b8 22 a2 |..S.....^..a..".|
    00000120 18 55 d6 6a eb 7d 2a fc cc f9 61 da da 07 57 f2 |.U.j.}*...a...W.|
    00000130 d5 76 0c 88 fa ee 69 97 f8 9e ee ce 6b 69 14 f5 |.v....i.....ki..|
    00000140 57 44 b9 59 b6 80 b8 32 37 c8 7d 56 b2 34 ff 09 |WD.Y...27.}V.4..|
    00000150 b2 39 ed f1 5d 0c eb 74 84 7e 79 8f 3d 1a a6 61 |.9..]..t.~y.=..a|
    00000160 d4 b9 3e 9e d0 c7 ec 72 64 11 df 7d 79 7c 52 0e |..>....rd..}y|R.|
    00000170 db 9f 74 ce 62 1f 22 ec e3 e9 25 bf c8 2c 82 18 |..t.b."...%..,..|
    00000180 e9 a9 cc 1b 78 b1 98 ec 44 9c 34 dc e5 bb 9a 4f |....x...D.4....O|
    00000190 ce b7 b4 9c 6f b6 6a 14 5e 87 af 35 e9 a7 61 f1 |....o.j.^..5..a.|
    000001a0 2b 61 d5 d9 e7 41 60 25 b5 70 91 19 4a 42 4a d3 |+a...A`%.p..JBJ.|
    000001b0 54 d1 5c 98 ca 1f b9 40 d1 45 37 8c 05 5c dd 8c |T.\....@.E7..\..|
    000001c0 9a dd fa 51 54 a3 c3 be 05 77 48 b5 2c 2d 9a 37 |...QT....wH.,-.7|
    000001d0 f5 d5 6d 14 1e 9f 06 aa 25 51 31 c8 5e 9e fa 1e |..m.....%Q1.^...|
    000001e0 c9 3c ee a5 55 24 6d 6c 60 de aa d8 7b ae be 95 |.<..U$ml`...{...|
    000001f0 0d d8 b0 8a 11 ca 26 98 02 5b 1a 62 58 b1 34 81 |......&..[.bX.4.|
    00000200 6b 13 09 de 10 9a 67 e8 88 ef 8f 40 4b df 31 bd |k.....g....@K.1.|
    00000210 4b 93 f5 50 c4 c6 14 80 4d 02 a6 fa 08 a3 a1 18 |K..P....M.......|
    00000220 e3 5a 4a 8a 72 92 44 04 6d 24 18 59 d3 3d 01 78 |.ZJ.r.D.m$.Y.=.x|
    00000230 8d 5a 97 a0 bb 72 b2 82 a6 82 86 dc 97 35 79 37 |.Z...r.......5y7|
    00000240 53 00 8f c6 95 61 5a 80 01 a2 07 03 66 34 e5 88 |S....aZ.....f4..|
    00000250 cb 53 20 4f e0 04 59 |.S O..Y|


    ... into its uncompressed version. Frame markers are marked in red with the last one being an end of file marker 04 and a one-byte checksum. The above binary file is available here...

    https://www.hamradio.me/graphs/WinlinkTests/Message_2_Packet_All3.bin
     
    Last edited: Aug 6, 2019
  3. KX4Z

    KX4Z Ham Member QRZ Page

    I have found the original lzhuf.c code from 1999 and am placing it here. In a next message i'll place the code from Wiseman's BPQ. look at the VERY LAST part of this file for the calling sequence.

    Hmmm..... I can't post a .c file here....so I'll post the .zip from which it came... It is from 1999 and is for use for non commercial amateur radio. An explanatory file is included. My libre office was able to read it.

    There is even a .exe in there---probably for DOS.
     

    Attached Files:

  4. KX4Z

    KX4Z Ham Member QRZ Page

    A key issue that I don't understand, is what you do with the 02 fa and similar head of packet and end-of-file (04 59, the end of file and checksum) markers. I've asked John Wiseman whether they "stay in" before decompression or get "stripped out". Have read through several C source code files but still cannot figure this out.

    Theoretically, the decompression software might just ignore them or decode them into somethig that doesn't bother us.........but I know so little about LZHUF compression that I'm not sure.
    Gordon
     
  5. KX4Z

    KX4Z Ham Member QRZ Page

    And I would like to thank KX4O for requesting help here. Some of you software folks can help us in a jiffy.
    Gordon
     
  6. KX4Z

    KX4Z Ham Member QRZ Page

    I now have your files downloaded, and have compiled lzhuf. My keyboard was improperly specified which cost me 30 minutes before I could edit and compile. I don't yet have the code working from my compile. running on a raspberry pi. This is big progress for me, however. Gordon
     
  7. KX4Z

    KX4Z Ham Member QRZ Page

    It looks to me like I should edit the codce to stop at the 04 end of file. For some dumb reason it isn't properly dealing with the size of the file. Not sure why it never stops. Took me a while to figure that out (grin).
    Gordon
     
  8. KX4Z

    KX4Z Ham Member QRZ Page

    OK, I put a limit in an iterator so it doesn't go past 591 and it no longer goes forever.... but I'm doing something WRONG because this is how it is coming out:

    pi@raspberrypi:~/monitor/lzhuf $ /home/pi/monitor/lzhuf/lzhuf d Message_2_Packet_01.bin outputfile2
    Char: �
    Char: w
    Char: t
    Char: 7
    Char: #
    Char: �
    Char: '
    Char: �
    Char: �
    Char:
    Char:
    Char: �
    Char: �
    Char: �
    Char: �
    Char: �
    Char: !
    har:
    Char: �
    Char: �
    Char: {
    Char:
    Char: �
    Char: �
    Char: �
    Char: �
    Char: 9
    Char: /
    Char: �
    Char: 7
    Char: 9
    Char: �
    Char: �
    Char: #
    Char: �
    Char: �
    Char: }
    Char: a
    Char:
    Char: �
    Char: ?
    Char: �
     
  9. KX4Z

    KX4Z Ham Member QRZ Page

    Here is the output file:
    pi@raspberrypi:~/monitor/lzhuf $ cat outputfile2
    �wt � �� ����! ��{����9/�79�� ��}a �?� SĜ8�?0Som�9K�4HR� SĜ8�?0Som�9K�4HR� SĜ8�?0Som�9K�4H9 SĜ8�?0Som�;�3����胏N
    Hgw ����! ��{����9/�79�� ;L7����s ��g/; pi@raspberrypi:~/monitor/lzhuf $ ^C


    ANy idea what I'm doing wrong???
     
  10. KX4Z

    KX4Z Ham Member QRZ Page

    The Decode algorithm in the c code that you sent, is expected an unsigned LONG length of the file at the beginning of the file (start of file is positon 0) That is a problem I still am at the very beginning of understanding this, but that doesn't work for our 02 fa......which is serving a comletely different function.....



    void Decode(void) /* recover */
    {
    int i, j, k, r, c;
    unsigned long int count;
    unsigned long tw; <<<---- local variable to hold the size of the text to be decoded.


    if (fread(&tw, sizeof tw, 1, infile) < 1) <<<---- reads the first unsigned long size of data, and believes it is the text size.
    Error("Can't read"); /* read size of text */
    textsize = i86ul_to_host(tw);
    if (textsize == 0)
    return;
    StartHuff();
    for (i = 0; i < N - F; i++)
    text_buf = ' ';
    r = N - F;
     
    KX4O likes this.

Share This Page