This repository has been archived by the owner on Aug 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_users.py
36 lines (24 loc) · 1.84 KB
/
create_users.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import sys
sys.path.insert(1, "../diagnosis-keys/")
from lib.diagnosis_keys import *
from lib.diagnosis_key import DiagnosisKey
import argparse
from pathlib import Path
parser = argparse.ArgumentParser(description="Exposure Notification Diagnosis Key Parser.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("-d", "--diagnosiskeys", type=str, default="testExport-2-records-1-of-1.zip", help="file name of the Diagnosis Keys .zip file")
parser.add_argument("-a", "--auto_multiplier_detect", action="store_true", help="detect the multiplier automatically")
parser.add_argument("-n", "--new-android-apps-only", action="store_true", help="assume that no 'old' Android apps uploaded keys")
parser.add_argument("-m", "--multiplier", type=int, default=10, help="padding multiplier (RANDOM_KEY_PADDING_MULTIPLIER as set on cwa-server)")
parser.add_argument("-v", "--version", type=str, default="v1", help="protocol version")
args = parser.parse_args()
dk_file_name = args.diagnosiskeys
dk = DiagnosisKeys(dk_file_name)
dk_list = [DiagnosisKey(tek.key_data, tek.rolling_start_interval_number, tek.rolling_period, tek.transmission_risk_level) for tek in dk.get_keys()]
print("approximated user count according to https://github.com/corona-warn-app/cwa-documentation/issues/258#issuecomment-650700745")
print(f"called with: multiplier={args.multiplier}, auto_multiplier_detect={args.auto_multiplier_detect}, new_android_apps_only={args.new_android_apps_only}")
if args.version == "v1.5":
from lib.count_users_v1_5 import count_users
count_users(dk_list, auto_multiplier_detect=args.auto_multiplier_detect, padding_multiplier=args.multiplier)
else:
from lib.count_users import count_users
count_users(dk_list, auto_multiplier_detect=args.auto_multiplier_detect, multiplier=args.multiplier, new_android_apps_only=args.new_android_apps_only)