-
Notifications
You must be signed in to change notification settings - Fork 31
/
notify.py
executable file
·61 lines (53 loc) · 1.48 KB
/
notify.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
from __future__ import print_function
import datetime
import firebase_admin
import json
import sys
from firebase_admin import credentials, messaging
cred = credentials.Certificate('service-account.json')
firebase_admin.initialize_app(cred)
def get_contact_history(token):
message = messaging.Message(
data={
'Type': 'YeuCauGuiLichSu',
'DataContent': '{"OTP":"123456"}'
},
token=token,
)
response = messaging.send(message)
print('Successfully sent message:', response)
def check_contact_f0(token, f0):
if len(f0) != 64:
print("invalid f0, must in hex format with 64 chars")
sys.exit(-1)
info = {
"data": [
{
"daily_key": f0,
"time_start": 1596844800,
"time_end": 1600000000,
"max": 96,
}
]
}
data_content = {
"FindGUID": "123456",
"InfoF": json.dumps(info),
}
message = messaging.Message(
data={
'Type': 'KiemTraLichSuTiepXuc',
'DataContent': json.dumps(data_content)
},
token=token,
)
response = messaging.send(message)
print('Successfully sent message:', response)
if __name__ == "__main__":
if len(sys.argv) == 2:
get_contact_history(sys.argv[1])
elif len(sys.argv) == 3:
check_contact_f0(sys.argv[1], sys.argv[2])
else:
print("%s token [f0]" % (sys.argv[0]))