RuCTF Quals 2014 hardware 100 Write up
問題文
問題タイトル: IR dump
What credit card number has been typed?Dump(zipファイルへのリンク)
答え
zipをダウンロードして解凍すると、次のようなdump.txtが出てきます。
RMC364GY00000000000000000000000000000000000000000000000000000000 ...(ひたすら0か1が続く)
先頭のRMC364GYで検索すると、JVCというメーカのテレビのリモコンがヒットします。
問題タイトルがIR dumpなので、このファイルはリモコンの信号のダンプだと推測できます。
JVCリモコンの仕様を調べると、次のようなページがヒットします。
http://www.sbprojects.com/knowledge/ir/jvc.php
http://users.telenet.be/davshomepage/jvc.htm
これらの情報をもとに、デコードを行えばOKです。
まず、dump.txt連続する文字とその個数で表したファイルに変換しました。
R 1 M 1 C 1 3 1 6 1 4 1 G 1 Y 1 0 572686 1 1584 0 767 1 110 0 271 1 112 0 277 1 111 ...
0と1の数から大体どれがスタートコードでどれがリピートコードか、などのあたりをつけ、作成したデコーダが以下です。
#!/usr/bin/python2 f = open('converted.txt', 'r') data = f.read() array = data.split('\n') array = array[9:] repeating = False count = 0 starting = False address = 0 command = 0 for line in array: if line != '': c, n = line.split(' ') n = int(n) if starting: starting = False continue if repeating: if c == '0' and 5000 < n: repeating = False else: if c == '1' and 1000 < n < 2000: starting = True elif count == 16: print hex(address), hex(command) address = 0 command = 0 count = 0 repeating = True elif c == '0': if n < 150: v = 0 else: v = 1 if count < 8: address += v << count else: command += v << (count - 8) count += 1 f.close()
実行結果
% ./decode.py 0x3 0x24 0x3 0x24 0x3 0x28 0x3 0x25 0x3 0x22 0x3 0x24 0x3 0x28 0x3 0x24 0x3 0x20 0x3 0x29 0x3 0x24 0x3 0x29 0x3 0xa5 0x3 0x29 0x3 0x29 0x3 0x22
JVCリモコンのコマンドの詳細な仕様書にキーコードテーブルがあるので、それを参照します。
http://support.jvc.com/consumer/support/documents/RemoteCodes.pdf
0x20〜0x29が数字のボタンらしいので、一番下の桁を読めばOKです(0xa5はおそらくデコードミス)。
Flag:
4485248409495992