-
Notifications
You must be signed in to change notification settings - Fork 12
/
process.py
143 lines (128 loc) · 4.63 KB
/
process.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import requests
import datetime,pytz
from firebase import firebase
from creds import cred
firebase = firebase.FirebaseApplication(cred.DB_URL)
date=datetime.datetime.utcnow()
date2=date.replace(tzinfo=pytz.UTC)
date=date2.astimezone(pytz.timezone("Asia/Kolkata"))
date=str(date)
date=date[0:10]
today_date = int(date.replace("-", ""))
def check(chatids):
chatid = chatids
data = {
"uname": chatid,
"count": 0,
"date": today_date
}
result = firebase.get('/users', chatid)
if result:
date = result["date"]
count = result["count"]
if not date == today_date:
firebase.put('/users', chatid, data)
out = "not yet"
else:
if count > 5:
out = "limit reached"
else:
count += 1
data2 = {
"uname": chatid,
"count": count,
"date": today_date
}
firebase.put('/users', chatid, data2)
out = "not yet"
else:
firebase.put('/users', chatid, data)
out = "not yet"
return out
def truecaller_search(token, num):
g = "https://account-asia-south1.truecaller.com/v2.1/credentials/check?encoding=json"
h = {
"Host": "account-asia-south1.truecaller.com",
"authorization": token,
"content-type": "application/json; charset=UTF-8",
"content-length": "42",
"accept-encoding": "gzip",
"user-agent": "Truecaller/11.5.7 (Android;10)"
}
requests.post(g, headers=h, timeout=5, data={"reason": "restored_from_account_manager"})
turl = "https://search5-noneu.truecaller.com/v2/search?q=" + num + "&countryCode=IN&type=4&locAddr=&placement=SEARCHRESULTS%2CHISTORY%2CDETAILS&encoding=json"
theaders = {
"user-agent": "Truecaller/11.5.7 (Android;10)",
"Accept-Encoding": "gzip",
"authorization": token,
"Host": "search5-noneu.truecaller.com"
}
tresponse = requests.get(turl, headers=theaders, timeout=5)
return tresponse
def eyecon_search(num):
url = "https://api.eyecon-app.com/app/getnames.jsp?cli=91" + num + "&lang=en&is_callerid=true&is_ic=true&cv=vc_312_vn_2.0.312_a&requestApi=URLconnection&source=Other"
headers = {
"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 10; GM1903 Build/QKQ1.190716.003)",
"Accept": "application/json",
"Accept-Encoding": "gzip",
"Connection": "Keep-Alive",
"e-auth-v": cred.E_AUTH_V,
"e-auth-c": cred.E_AUTH_C,
"e-auth": cred.E_AUTH,
"content-type": "application/x-www-form-urlencoded",
"Host": "api.eyecon-app.com"
}
response = requests.post(url, headers=headers, timeout=5)
return response
def fb_search(num):
fburl = "https://api.eyecon-app.com/app/pic?cli=91" + num + "&is_callerid=true&size=big&type=0&cancelfresh=0&cv=vc_312_vn_2.0.312_a"
fbheaders = {
"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 10; GM1903 Build/QKQ1.190716.003)",
"Accept": "application/json",
"Accept-Encoding": "gzip",
"Connection": "Keep-Alive",
"e-auth-v": cred.E_AUTH_V,
"e-auth-c": cred.E_AUTH_C,
"e-auth": cred.E_AUTH,
"Host": "api.eyecon-app.com"
}
fbres = requests.get(fburl, headers=fbheaders)
return fbres
def searches():
a = firebase.get('/stats', 'total_searches')
data = {
"total_searches": a['total_searches'] + 1
}
firebase.put('/stats', 'total_searches', data)
def log():
knowho_users = firebase.get('/users', '')
searches = firebase.get('/stats', 'total_searches')
lst1 = []
act = []
for k, v in knowho_users.items():
lst1.append("u")
if (v['date'] == today_date):
act.append("d")
total_search = f"{searches['total_searches']}"
total_users = f"{lst1.count('u')}"
active_today = f"{act.count('d')}"
data={
"active_users":active_today,
"total_searches":total_search,
"total_users":total_users
}
firebase.put('/stats',date,data)
def logreturn():
knowho_users = firebase.get('/users', '')
searches = firebase.get('/stats', 'total_searches')
lst1 = []
act = []
for k, v in knowho_users.items():
lst1.append("u")
if (v['date'] == today_date):
act.append("d")
total_search = f"`Total numbers searched` : **{searches['total_searches']}**"
total_users = f"`Total bot users` : **{lst1.count('u')}**"
active_today = f"`Active users today` : **{act.count('d')}**"
stato=f"\n{total_search}\n{total_users}\n{active_today}"
return stato