Re^2: CAS-5A jpg trick?2023年03月05日 08時34分

Re^2: CAS-5A jpg trick?
JE9PEL, Mineo Wakita
On Sat, Mar 4, 2023 at 14:07 UTC

Thanks for CAS-5A ipg structure.
I re-edited my site referring to your advice.
Look at the bottom of that site.
By the way, what binary editor are you using?

Re:Re^2: CAS-5A jpg trick?
K4KDR, Scott

First, one additional tip....
Instead of downloading several different pictures, I recommend
(if there is time in a pass) to download the SAME picture as many times as you can.
That way, you might get packets from download #2 that you missed in download #1.

I like the FRHED hex editor (https://frhed.sourceforge.net/en/) on Windows.

But to make it easier to work with partial files, I convert to TEXT & use the GEANY
text editor for all my copy/paste operations.  When I have ALL the packets, remove
all the INFO bytes (everything up to 'FF D8' on line #1 and the same number of bytes
on every other line), THEN I remove the line feeds so that I have a single line of
text going all the way from 'FF D8' to 'FF D9'. The final step is to convert back
to binary hex. Then I have a JPG file!

In a rough form, the steps look like this (with example commands):
------------------------------------------------------------------
- obtain KSS file from live capture

- convert from KSS to true HEX in GNU Radio while removing 1st 16 bytes (ax.25 header)
    from each packet

- in hex editor, verify (or cut) start of file to confirm '03 xx xx' bytes are at
     start of file

- chop file into 256 byte lines & convert to TEXT file:
    
    cat cas-5a_22-n6rfm--cut.hex | xxd -p -c 256|more (confirm that each line starts
    with '03 xx xx')
    
    cat cas-5a_22-n6rfm--cut.hex | xxd -p -c 256 > cas-5a_22-n6rfm--0301.txt
    
- repeat for any other captures of same JPG file download

- open TEXT files & editor & remove 1st 3 bytes so that each line starts
    w/ sequence # bytes (line #1 should start with '0001' - if you got the 1st packet)

- find missing packets by sequence number & fill from other downloads

- once all packets are present, remove 1st 26 characters from each line so that file
    starts with 'FF D8'
    cat cas-5a_22-combo.txt | cut -c 27- > 22-combo-less-27.txt
    
- remove line feeds so that entire text file (starting w/ 'FF D8') is on a single line

    cat 22-combo-less-27.txt | tr '\n' ' ' > 22-combo-one-line.txt
    
- convert single line TEXT file to binary hex file w/ .JPG extension

    cat 22-combo-one-line.txt | xxd -r -p > 22-combo.jpg
------------------------------------------------------------------

FYI, we got most of #23 last night - I'll try again today to get the remaining bytes.
#23 is HUGE!  794 packets.... that nice #22 picture that I posted with the satellite's
antenna was only something like 408 packets, I think.  So, I hope #23 is good and not
just lens flare.

Re:Re^2: CAS-5A jpg trick?2023年03月05日 11時33分

(訳)
まず、追加のヒントを1つ....
いくつかの異なる画像をダウンロードする代わりに、(パスに時間があるならば)
同じ画像をできるだけ何度もダウンロードすることをお勧めします。そうすれば
ダウンロード#1 で見逃したパケットをダウンロード#2 から取得できる可能性が
あります。私は、Windows上の FRHED hex editor を好んで使っています。

https://frhed.sourceforge.net/en/

しかし、部分的なファイルを扱いやすくするために、私は TEXT に変換し、全て
のコピー/貼付操作に GEANY text editor を使用しています。全てのパケットを
取得したら、全ての INFO バイト(行#1 の「FF D8」までの全てと1行ごとに同じ
バイト数)を削除します。次に 改行を削除して、「FF D8」から「FF D9」までの
1行のテキストを作成します。最後に バイナリ16進数ファイルに変換して、一つ
の JPG file にします!

大まかな手順は次のようになります。(コマンドの例を含む)
-------------------------------------------------------
- obtain KSS file from live capture

- convert from KSS to true HEX in GNU Radio while removing 1st 16 bytes (ax.25 header)
    from each packet

- in hex editor, verify (or cut) start of file to confirm '03 xx xx' bytes are at
     start of file

- chop file into 256 byte lines & convert to TEXT file:
    
    cat cas-5a_22-n6rfm--cut.hex | xxd -p -c 256|more (confirm that each line starts
    with '03 xx xx')
    
    cat cas-5a_22-n6rfm--cut.hex | xxd -p -c 256 > cas-5a_22-n6rfm--0301.txt
    
- repeat for any other captures of same JPG file download

- open TEXT files & editor & remove 1st 3 bytes so that each line starts
    w/ sequence # bytes (line #1 should start with '0001' - if you got the 1st packet)

- find missing packets by sequence number & fill from other downloads

- once all packets are present, remove 1st 26 characters from each line so that file
    starts with 'FF D8'
    cat cas-5a_22-combo.txt | cut -c 27- > 22-combo-less-27.txt
    
- remove line feeds so that entire text file (starting w/ 'FF D8') is on a single line

    cat 22-combo-less-27.txt | tr '\n' ' ' > 22-combo-one-line.txt
    
- convert single line TEXT file to binary hex file w/ .JPG extension

    cat 22-combo-one-line.txt | xxd -r -p > 22-combo.jpg
------------------------------------------------------------------

参考までに、昨夜は #23 のほとんどを取得しました。残りのバイトを取得する
ために、今日もう一度試してみます。 #23 は巨大で 794パケットもあります!
私が衛星アンテナと共に投稿した素敵な #22 の写真は、408パケット程度だった
と思います。だから、レンズフレアだけでなくて、#23 が良い写真であることを
願っています。 https://twitter.com/scott23192