Skip to content

Instantly share code, notes, and snippets.

@zaruudon
Created November 26, 2020 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaruudon/5d01b848e50d5a63df50479e27b0df9d to your computer and use it in GitHub Desktop.
Save zaruudon/5d01b848e50d5a63df50479e27b0df9d to your computer and use it in GitHub Desktop.
配信されているTEKから生成したRPIを使ってCOCOAをテストする
https://github.com/mh-/exposure-notification-ble-pythonを使って過去分のRPIを日付を戻した端末に送り込んでCOCOAの動作をテストする手順
-TEKを入手する
https://covid19radar-jpn-prod.azureedge.net/c19r/440/list.jsonから適当なzipファイルをダウンロードして、
parse_keys.py(https://github.com/mh-/diagnosis-keys)で中身を確認する
-exposure-notification-ble-pythonのlib/en_crypto.pyを改変する
import codecsを追加
入手したTEKを使うように変更
#self.tek = get_random_bytes(16)
self.tek = codecs.decode('0123456789abcdef0123456789abcdef', 'hex')
RPIの基準になる時刻をTEKの有効期間内になるようにずらす
7日前のTEKなら7日分引く(UTC基準なので時差に注意)
def get_current_unix_epoch_time_seconds():
#return int(time.time())
return int(time.time() - 86400 * 7)
-端末の日付を戻す
TEKの有効期間に合わせて端末の日付を戻す(時差に注意)
-既存のDBを消去
「ランダムなIDを削除」を実行して端末を再起動
-ビーコンを送信する
端末の日時がTEKの有効期間内になっていること、濃厚接触の可能性検出機能が有効になっていることを確認する
exposure-notification.pyを起動(カーネルパッチを当てていない場合は--triggertxを付ける)
1m以内かつ15分以上の条件を確実に満たすと思われる状態で端末に受信させる
-判定処理を走らせる
アプリの設定にある使用中止ボタンを押してアプリのデータを消去する
端末を再起動してからアプリを立ち上げ、日付を元に戻して初期設定を完了させる
@zaruudon
Copy link
Author

@moonmile
手動でpybleno入れてませんか?手順通りにやったらパッチ入りのやつが入ったと思います。

@moonmile
Copy link

いけました。

pip3 uninstall pyblueno

してから、

pip3 install -r requirements.txt

すれば大丈夫そう。

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment