├── LICENSE ├── Procfile ├── README.md ├── app.json ├── creds.py ├── images (1)~2.jpg ├── logo.jpg ├── main.py ├── process.py ├── requirements.txt └── runtime.txt /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 agentnova 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: python3 main.py 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KnowhoBot 2 | 3 | Pluggable 4 | [Telegram](https://telegram.org) bot based on 5 | [Pyrogram](https://github.com/pyrogram/pyrogram). 6 | 7 | ## About the bot 8 | 9 | >Simply the purpose of this bot is to gather information about a phone number(only indian numbers). 10 | 11 | >Combined Results from Truecaller and eyecon app is provided. 12 | 13 | >Saves your time...:-) 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | Mozilla Public License for more details. 19 | 20 | ### Installation 21 | 22 | #### The Easy Way 23 | 24 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/agentnova/KnowhoBot) 25 | 26 | #### Watch video 27 | 28 | 29 | 30 | 31 | 32 | #### The Legacy Way 33 | Simply clone the repository and run the main file: 34 | ```sh 35 | git clone https://github.com/agentnova/KnowhoBot.git 36 | 37 | cd KnowhoBot 38 | 39 | python3 -m venv venv 40 | 41 | . ./venv/bin/activate 42 | 43 | pip install -r requirements.txt 44 | 45 | python3 main.py 46 | 47 | ``` 48 | #### Dont forget to edit the creds.py with your own variables like below with your own values 49 | ```python3 50 | class cred(): 51 | BOT_TOKEN = "your bot token from botfather" 52 | API_ID = "your api id from my.telegram.org!" 53 | API_HASH = "your api hash from my.telegram.org!" 54 | DB_URL = "your database url from google firebase" 55 | T_AUTH = "from telegram app request header" 56 | E_AUTH = "from eyecon app request header" 57 | E_AUTH_V= "from eyecon app request header" 58 | E_AUTH_C= "from eyecon app request header" 59 | 60 | ``` 61 | 62 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Knowho bot", 3 | "description": "A telegram bot which gather information about an indian phone number(Gather results from both Truecaller and eyecon)", 4 | "repository": "https://github.com/agentnova/KnowhoBot", 5 | "logo": "https://raw.githubusercontent.com/agentnova/KnowhoBot/master/logo.jpg", 6 | "keywords": ["Truecaller","telegram","telegram bot","bot","pyrogram","knowho bot","information gathering"], 7 | "env": { 8 | "BOT_TOKEN": { 9 | "description": "Your bot token from @Botfather", 10 | "value": "" 11 | }, 12 | "API_ID": { 13 | "description": "Get this value from my.telegram.org! Please do not steal", 14 | "value": "" 15 | }, 16 | "API_HASH": { 17 | "description": "Get this value from my.telegram.org! Please do not steal", 18 | "value": "" 19 | }, 20 | "DB_URL": { 21 | "description": "Your DATABASE url from firebase.google.com", 22 | "value": "" 23 | }, 24 | "T_AUTH": { 25 | "description": "Your Truecaller auth_id from truecaller app request headers", 26 | "value": "" 27 | }, 28 | "E_AUTH": { 29 | "description": "Your Eyecon auth_id from eyecon app request headers", 30 | "value": "" 31 | }, 32 | "E_AUTH_V": { 33 | "description": "Your Eyecon e_auth_v value from eyecon app request headers", 34 | "value": "" 35 | }, 36 | "E_AUTH_C": { 37 | "description": "Your Eyecon e_auth_c value from eyecon app request headers", 38 | "value": "" 39 | } 40 | }, 41 | "buildpacks": [ 42 | { 43 | "url": "heroku/python" 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /creds.py: -------------------------------------------------------------------------------- 1 | import os 2 | from dotenv import load_dotenv, find_dotenv 3 | 4 | load_dotenv(find_dotenv()) 5 | 6 | 7 | class cred(): 8 | BOT_TOKEN = os.getenv("BOT_TOKEN") #From botfather 9 | API_ID = os.getenv("API_ID") #"Get this value from my.telegram.org! Please do not steal" 10 | API_HASH = os.getenv("API_HASH") #"Get this value from my.telegram.org! Please do not steal" 11 | DB_URL = os.getenv("DB_URL") #From Firebase database 12 | 13 | ####From Truecaller and Eyecon app request headers respectively######## 14 | 15 | T_AUTH = os.getenv("T_AUTH") # Truecaller auth id CA 16 | E_AUTH = os.getenv("E_AUTH") # Eyecon auth id 17 | E_AUTH_V=os.getenv("E_AUTH_V") # Eyecon auth_v 18 | E_AUTH_C=os.getenv("E_AUTH_C") # Eyecon auth_c 19 | -------------------------------------------------------------------------------- /images (1)~2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agentnova/KnowhoBot/e3f37c8c786e3e2c063e2855c9215caebcaa4782/images (1)~2.jpg -------------------------------------------------------------------------------- /logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agentnova/KnowhoBot/e3f37c8c786e3e2c063e2855c9215caebcaa4782/logo.jpg -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import json 2 | from pyrogram import Client, filters 3 | from firebase import firebase 4 | from process import check, searches, truecaller_search, fb_search, logreturn, log, eyecon_search 5 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton 6 | from creds import cred 7 | 8 | firebase = firebase.FirebaseApplication(cred.DB_URL) 9 | app = Client( 10 | "KNOW-WHO-BOT", 11 | api_id=cred.API_ID, 12 | api_hash=cred.API_HASH, 13 | bot_token=cred.BOT_TOKEN 14 | ) 15 | 16 | 17 | @app.on_message(filters.command(["start"])) 18 | def start(client, message): 19 | client.send_message(chat_id=message.chat.id, 20 | text=f"`Hi` **{message.from_user.first_name}**\n `Enter the number to search...`",reply_markup=InlineKeyboardMarkup( 21 | [[InlineKeyboardButton("About", callback_data="about"), 22 | InlineKeyboardButton("Source", callback_data="src")]])) 23 | check_status = check(message.chat.id) 24 | 25 | @app.on_callback_query() 26 | def newbt(client,callback_query): 27 | txt=callback_query.data 28 | if txt=="about": 29 | callback_query.message.edit(text=f"`Bot` : [knowhobot](t.me/knowhobot)\n`Creator :` [agentnova](t.me/agentnova)\n`Language:` [Python3](https://python.org)\n`Library :` [Pyrogram](https://docs.pyrogram.org/) \n`Server :` [Heroku](https://herokuapp.com/)", 30 | disable_web_page_preview=True, reply_markup=InlineKeyboardMarkup( 31 | [[InlineKeyboardButton("Give Feedback", url="t.me/agentnova")]])) 32 | elif txt=="src": 33 | callback_query.message.edit(text="Enjoy...:-D\nhttps://github.com/agentnova/KnowhoBot", disable_web_page_preview=True) 34 | 35 | 36 | 37 | @app.on_message(filters.command(["about"])) 38 | def about(client, message): 39 | client.send_message(chat_id=message.chat.id, reply_to_message_id=message.message_id, 40 | text=f"`Bot` : [knowhobot](t.me/knowhobot)\n`Creator :` [agentnova](t.me/agentnova)\n`Language:` [Python3](https://python.org)\n`Library :` [Pyrogram](https://docs.pyrogram.org/) \n`Server :` [Heroku](https://herokuapp.com/)", 41 | disable_web_page_preview=True, reply_markup=InlineKeyboardMarkup( 42 | [[InlineKeyboardButton("Feedback", url="t.me/agentnova")]])) 43 | 44 | 45 | @app.on_message(filters.command(["log"])) 46 | def stats(client, message): 47 | stat = client.send_message(chat_id=message.chat.id, reply_to_message_id=message.message_id, 48 | text="`Fetching details`") 49 | txt = logreturn() 50 | stat.edit(txt) 51 | 52 | 53 | @app.on_message(filters.text) 54 | def echo(client, message): 55 | actvt = "" 56 | actvt = firebase.get('/stats', 'total_searches') 57 | data = {"total_searches": 1} 58 | if not actvt: 59 | firebase.put('/stats', 'total_searches', data) 60 | global pq 61 | pq = "" 62 | pro = client.send_message(chat_id=message.chat.id, text="Searching...", reply_to_message_id=message.message_id) 63 | r_num = message.text 64 | num = r_num.replace("+91", "").replace(" ", "") 65 | frbseyename = "" 66 | frbsefb = "" 67 | frbsetrname = "" 68 | frbsetrmail = "" 69 | if num.isnumeric and len(num) == 10: 70 | pq = "\n\n**----••Truecaller says----**\n\nLimit exceeded ,try again tomorrow 🤦🏻‍♂️" 71 | tresponse = "" 72 | try: 73 | tresponse = truecaller_search(cred.T_AUTH, num) 74 | if tresponse: 75 | restj = tresponse.json() 76 | trslt = json.dumps(restj) 77 | tjsonload = json.loads(trslt) 78 | if "name" in tjsonload['data'][0]: 79 | if tjsonload['data'][0]['internetAddresses']: 80 | pq = f"\n\n**----••Truecaller says----**\n\nName : `{tjsonload['data'][0]['name']}`\nCarrier : `{tjsonload['data'][0]['phones'][0]['carrier']}` \nE-mail : {tjsonload['data'][0]['internetAddresses'][0]['id']}" 81 | frbsetrname = tjsonload['data'][0]['name'] 82 | frbsetrmail = tjsonload['data'][0]['internetAddresses'][0]['id'] 83 | elif not tjsonload['data'][0]['internetAddresses']: 84 | pq = f"\n\n**----••Truecaller says----**\n\nName : `{tjsonload['data'][0]['name']}`\nCarrier : `{tjsonload['data'][0]['phones'][0]['carrier']}`" 85 | frbsetrname = tjsonload['data'][0]['name'] 86 | else: 87 | pq = "\n\n**----••Truecaller says----**\n\nNo results found 🤦🏻‍♂️" 88 | if tresponse.status_code == 429: 89 | pq = "\n\n**----••Truecaller says----**\n\nLimit exceeded ,try again tomorrow 🤦🏻‍♂️" 90 | except: 91 | pass 92 | response = eyecon_search(num) 93 | fbres = fb_search(num) 94 | fbrslt = fbres.url.replace('https://graph.', '').replace('picture?width=600', '') 95 | if response: 96 | 97 | rslt = response.json() 98 | 99 | if rslt: 100 | temp = json.dumps(rslt).replace('[', '').replace(']', '') 101 | jsonload = json.loads(temp) 102 | 103 | yk = f"\n\n**----••Eyecon says----**\n\nName :`{jsonload['name']}`" 104 | frbseyename = jsonload["name"] 105 | if "facebook.com" in fbrslt: 106 | yk = f"\n\n**----••Eyecon says----**\n\nName : `{jsonload['name']}`\nFacebook : {fbrslt}" 107 | frbseyename = jsonload["name"] 108 | frbsefb = fbrslt 109 | else: 110 | yk = "**----••Eyecon says----**\n\nNo results found 🤦🏻‍♂️" 111 | else: 112 | yk = "**----••Eyecon says----**\n\nNo results found 🤦🏻‍♂️" 113 | 114 | yk += pq 115 | pro.edit(text=yk, disable_web_page_preview=True,reply_markup=InlineKeyboardMarkup( 116 | [[InlineKeyboardButton("Source", callback_data="src")]])) 117 | searches() 118 | log() 119 | if frbseyename and frbsefb and frbsetrname and frbsetrmail: 120 | data = { 121 | "Eyecon Name": frbseyename, 122 | "Mob": num, 123 | "Truecaller name": frbsetrname, 124 | "Facebook": frbsefb, 125 | "Mail": frbsetrmail 126 | } 127 | firebase.put('/knowho-log', num, data) 128 | elif frbseyename and frbsefb and frbsetrname: 129 | data = { 130 | "Eyecon Name": frbseyename, 131 | "Mob": num, 132 | "Truecaller name": frbsetrname, 133 | "Facebook": frbsefb 134 | } 135 | firebase.put('/knowho-log', num, data) 136 | elif frbseyename and frbsefb: 137 | data = { 138 | "Eyecon Name": frbseyename, 139 | "Mob": num, 140 | "Facebook": frbsefb 141 | } 142 | firebase.put('/knowho-log', num, data) 143 | elif frbseyename and frbsetrname and frbsetrmail: 144 | data = { 145 | "Eyecon Name": frbseyename, 146 | "Mob": num, 147 | "Truecaller name": frbsetrname, 148 | "Mail": frbsetrmail 149 | } 150 | firebase.put('/knowho-log', num, data) 151 | elif frbseyename and frbsetrname: 152 | data = { 153 | "Eyecon Name": frbseyename, 154 | "Mob": num, 155 | "Truecaller name": frbsetrname 156 | } 157 | firebase.put('/knowho-log', num, data) 158 | elif frbsetrname and frbsetrmail: 159 | data = { 160 | "Truecaller name": frbsetrname, 161 | "Mob": num, 162 | "Mail": frbsetrmail 163 | } 164 | firebase.put('/knowho-log', num, data) 165 | elif frbsetrname: 166 | data = { 167 | "Truecaller name": frbsetrname 168 | } 169 | firebase.put('/knowho-log', num, data) 170 | 171 | else: 172 | pro.edit("`Only` **10** `digit numbers allowed` 🤦🏻‍♂️") 173 | 174 | 175 | app.run() 176 | -------------------------------------------------------------------------------- /process.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import datetime,pytz 3 | from firebase import firebase 4 | from creds import cred 5 | 6 | firebase = firebase.FirebaseApplication(cred.DB_URL) 7 | date=datetime.datetime.utcnow() 8 | date2=date.replace(tzinfo=pytz.UTC) 9 | date=date2.astimezone(pytz.timezone("Asia/Kolkata")) 10 | date=str(date) 11 | date=date[0:10] 12 | today_date = int(date.replace("-", "")) 13 | 14 | def check(chatids): 15 | chatid = chatids 16 | data = { 17 | "uname": chatid, 18 | "count": 0, 19 | "date": today_date 20 | } 21 | result = firebase.get('/users', chatid) 22 | if result: 23 | date = result["date"] 24 | count = result["count"] 25 | if not date == today_date: 26 | firebase.put('/users', chatid, data) 27 | out = "not yet" 28 | else: 29 | if count > 5: 30 | out = "limit reached" 31 | else: 32 | count += 1 33 | data2 = { 34 | "uname": chatid, 35 | "count": count, 36 | "date": today_date 37 | } 38 | firebase.put('/users', chatid, data2) 39 | out = "not yet" 40 | else: 41 | firebase.put('/users', chatid, data) 42 | out = "not yet" 43 | return out 44 | 45 | def truecaller_search(token, num): 46 | g = "https://account-asia-south1.truecaller.com/v2.1/credentials/check?encoding=json" 47 | h = { 48 | "Host": "account-asia-south1.truecaller.com", 49 | "authorization": token, 50 | "content-type": "application/json; charset=UTF-8", 51 | "content-length": "42", 52 | "accept-encoding": "gzip", 53 | "user-agent": "Truecaller/11.5.7 (Android;10)" 54 | } 55 | requests.post(g, headers=h, timeout=5, data={"reason": "restored_from_account_manager"}) 56 | 57 | turl = "https://search5-noneu.truecaller.com/v2/search?q=" + num + "&countryCode=IN&type=4&locAddr=&placement=SEARCHRESULTS%2CHISTORY%2CDETAILS&encoding=json" 58 | theaders = { 59 | "user-agent": "Truecaller/11.5.7 (Android;10)", 60 | "Accept-Encoding": "gzip", 61 | "authorization": token, 62 | "Host": "search5-noneu.truecaller.com" 63 | } 64 | tresponse = requests.get(turl, headers=theaders, timeout=5) 65 | 66 | return tresponse 67 | 68 | def eyecon_search(num): 69 | 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" 70 | headers = { 71 | "User-Agent": "Dalvik/2.1.0 (Linux; U; Android 10; GM1903 Build/QKQ1.190716.003)", 72 | "Accept": "application/json", 73 | "Accept-Encoding": "gzip", 74 | "Connection": "Keep-Alive", 75 | "e-auth-v": cred.E_AUTH_V, 76 | "e-auth-c": cred.E_AUTH_C, 77 | "e-auth": cred.E_AUTH, 78 | "content-type": "application/x-www-form-urlencoded", 79 | "Host": "api.eyecon-app.com" 80 | } 81 | response = requests.post(url, headers=headers, timeout=5) 82 | return response 83 | 84 | def fb_search(num): 85 | 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" 86 | fbheaders = { 87 | "User-Agent": "Dalvik/2.1.0 (Linux; U; Android 10; GM1903 Build/QKQ1.190716.003)", 88 | "Accept": "application/json", 89 | "Accept-Encoding": "gzip", 90 | "Connection": "Keep-Alive", 91 | "e-auth-v": cred.E_AUTH_V, 92 | "e-auth-c": cred.E_AUTH_C, 93 | "e-auth": cred.E_AUTH, 94 | "Host": "api.eyecon-app.com" 95 | } 96 | fbres = requests.get(fburl, headers=fbheaders) 97 | return fbres 98 | 99 | def searches(): 100 | a = firebase.get('/stats', 'total_searches') 101 | data = { 102 | "total_searches": a['total_searches'] + 1 103 | } 104 | firebase.put('/stats', 'total_searches', data) 105 | 106 | def log(): 107 | knowho_users = firebase.get('/users', '') 108 | searches = firebase.get('/stats', 'total_searches') 109 | lst1 = [] 110 | act = [] 111 | for k, v in knowho_users.items(): 112 | lst1.append("u") 113 | if (v['date'] == today_date): 114 | act.append("d") 115 | total_search = f"{searches['total_searches']}" 116 | total_users = f"{lst1.count('u')}" 117 | active_today = f"{act.count('d')}" 118 | 119 | data={ 120 | "active_users":active_today, 121 | "total_searches":total_search, 122 | "total_users":total_users 123 | } 124 | firebase.put('/stats',date,data) 125 | 126 | def logreturn(): 127 | knowho_users = firebase.get('/users', '') 128 | searches = firebase.get('/stats', 'total_searches') 129 | lst1 = [] 130 | act = [] 131 | for k, v in knowho_users.items(): 132 | lst1.append("u") 133 | if (v['date'] == today_date): 134 | act.append("d") 135 | total_search = f"`Total numbers searched` : **{searches['total_searches']}**" 136 | total_users = f"`Total bot users` : **{lst1.count('u')}**" 137 | active_today = f"`Active users today` : **{act.count('d')}**" 138 | stato=f"\n{total_search}\n{total_users}\n{active_today}" 139 | return stato 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyrogram 2 | requests 3 | tgcrypto 4 | crypto 5 | firebase 6 | gcloud 7 | pycryptodome 8 | python-jwt 9 | requests-toolbelt 10 | sseclient 11 | pytz 12 | python-dotenv 13 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.7.5 2 | --------------------------------------------------------------------------------