Spaces:
Paused
Paused
File size: 15,183 Bytes
0bdc3a3 a143122 6c711ec b7800e1 006836b 8580299 a143122 fdf4d05 0bdc3a3 a33290e 0bdc3a3 006836b a143122 006836b a143122 a33290e a143122 b7800e1 8580299 006836b c817cde c63e1d8 006836b c63e1d8 fb3cb1d 006836b fb3cb1d 6c711ec 006836b 6c711ec 8580299 0bdc3a3 006836b a33290e 006836b b7800e1 006836b 8580299 006836b 8580299 006836b b7800e1 006836b b7800e1 8580299 fb3cb1d 8580299 006836b 8580299 0bdc3a3 b7800e1 006836b b7800e1 a33290e 8580299 6c711ec b7800e1 006836b b7800e1 8580299 b7800e1 006836b b7800e1 006836b 8580299 b7800e1 006836b 6c711ec 006836b a33290e 006836b 8580299 006836b 8580299 006836b 8580299 006836b 8580299 006836b fb3cb1d 006836b 8580299 006836b 8580299 006836b 8580299 fdf4d05 0bdc3a3 c63e1d8 006836b c63e1d8 006836b c63e1d8 fdf4d05 c63e1d8 fdf4d05 | 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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | import os
import threading
import re
import requests
import urllib.parse
from google import genai
from http.server import BaseHTTPRequestHandler, HTTPServer
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, InlineQueryResultArticle, InputTextMessageContent
from telegram.ext import Application, CommandHandler, MessageHandler, CallbackQueryHandler, InlineQueryHandler, filters, ContextTypes
import phonenumbers
from phonenumbers import geocoder, carrier
# --- 1. DUMMY SERVER FOR HOSTING ---
class DummyHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write(b"Truecaller Fast V6 Mega Ultimate is Online!")
threading.Thread(target=lambda: HTTPServer(('0.0.0.0', 7860), DummyHandler).serve_forever(), daemon=True).start()
# --- 2. CONFIGURATION & API KEYS ---
TOKEN = os.environ.get("BOT_TOKEN")
GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
PROXY_URL = "https://damp-limit-5d1dtruecallerfastbot.afluakd11.workers.dev/bot"
RAPID_API_KEY = "6b21b8a35fmsh5dcc355356c498dp1344cejsn42d82296b2c5" # Master RapidAPI Key
try:
gemini_client = genai.Client(api_key=GEMINI_API_KEY)
except:
gemini_client = None
BOT_KNOWLEDGE = "You are 'Truecaller fast' AI, a professional OSINT assistant. Keep answers professional."
DISCLAIMER = {
"en": "\n\n⚠️ *Disclaimer: For educational/legal purposes only.*",
"ml": "\n\n⚠️ *മുന്നറിയിപ്പ്: ഇത് വിദ്യാഭ്യാസ ആവശ്യങ്ങൾക്ക് മാത്രമുള്ളതാണ്.*"
}
user_lang = {}
# --- 3. MASSIVE OSINT FUNCTIONS (API ROTATION) ---
def fetch_truecaller_name(phone, code="IN"):
"""Rotates through 20+ Caller ID APIs"""
num = phone.replace("+", "")
local_num = num[-10:] if len(num) >= 10 else num
apis = [
{"m": "GET", "url": "https://truecallr1.p.rapidapi.com/search", "host": "truecallr1.p.rapidapi.com", "p": {"phone": num, "countryCode": code}},
{"m": "GET", "url": "https://truecaller4.p.rapidapi.com/api/v1/getDetails", "host": "truecaller4.p.rapidapi.com", "p": {"countryCode": code}},
{"m": "GET", "url": "https://viewcaller.p.rapidapi.com/api/v1/search", "host": "viewcaller.p.rapidapi.com", "p": {"code": "91", "number": local_num}},
{"m": "GET", "url": "https://viewcaller2.p.rapidapi.com/api/v1/search", "host": "viewcaller2.p.rapidapi.com", "p": {"code": "91", "number": local_num}},
{"m": "GET", "url": "https://truecaller18.p.rapidapi.com/lookup/", "host": "truecaller18.p.rapidapi.com", "p": {"phone": num}},
{"m": "GET", "url": "https://callapp.p.rapidapi.com/api/v1/getCountryCode", "host": "callapp.p.rapidapi.com", "p": {}},
{"m": "GET", "url": f"https://truecaller-data2.p.rapidapi.com/search/{num}", "host": "truecaller-data2.p.rapidapi.com", "p": {}},
{"m": "POST", "url": "https://truecaller-pro.p.rapidapi.com/result.php", "host": "truecaller-pro.p.rapidapi.com", "d": {"mobile": local_num}},
{"m": "POST", "url": "https://caller-id13.p.rapidapi.com/result.php", "host": "caller-id13.p.rapidapi.com", "d": {"mobile": local_num}},
{"m": "POST", "url": "https://truecaller-api4.p.rapidapi.com/v2.php", "host": "truecaller-api4.p.rapidapi.com", "d": {"phone": local_num, "countryCode": "in"}},
{"m": "POST", "url": "https://truecaller-api13.p.rapidapi.com/result.php", "host": "truecaller-api13.p.rapidapi.com", "d": {"mobile": local_num}}
]
for api in apis:
headers = {"x-rapidapi-key": RAPID_API_KEY, "x-rapidapi-host": api["host"]}
try:
if api["m"] == "POST":
headers["Content-Type"] = "application/x-www-form-urlencoded"
res = requests.post(api["url"], headers=headers, data=api.get("d", {}), timeout=4).json()
else:
res = requests.get(api["url"], headers=headers, params=api.get("p", {}), timeout=4).json()
name = res.get('name') or res.get('data', {}).get('name') or res.get('fullName') or res.get('data', [{}])[0].get('name')
if name and str(name).lower() not in ["null", "none", "", "not found"]:
return f"{name} (via {api['host'].split('.')[0]})"
except: continue
return "Not Found in DB"
def fetch_upi_name(phone):
"""Rotates through UPI APIs"""
num = phone[-10:]
apis = [
{"url": "https://upi-verification-vpa-upi-qr-code-generation.p.rapidapi.com/api/verify-upi-id", "host": "upi-verification-vpa-upi-qr-code-generation.p.rapidapi.com", "k": "upi_id"},
{"url": "https://upi-verification5.p.rapidapi.com/api/rapidapi/upi-verification2", "host": "upi-verification5.p.rapidapi.com", "k": "upi"}
]
for s in ['@ybl', '@paytm', '@ibl']:
for api in apis:
try:
res = requests.get(api["url"], headers={"x-rapidapi-key": RAPID_API_KEY, "x-rapidapi-host": api["host"]}, params={api["k"]: f"{num}{s}"}, timeout=4).json()
name = res.get('name') or res.get('data', {}).get('name') or res.get('userName')
if name: return f"{name} ({s})"
except: continue
return "No UPI Found"
def check_whatsapp(phone):
apis = [
{"url": "https://whatsapp-data-scraper.p.rapidapi.com/status", "host": "whatsapp-data-scraper.p.rapidapi.com"},
{"url": "https://whatsapp-scraper1.p.rapidapi.com/status", "host": "whatsapp-scraper1.p.rapidapi.com"}
]
for api in apis:
try:
res = requests.get(api["url"], headers={"x-rapidapi-key": RAPID_API_KEY, "x-rapidapi-host": api["host"]}, params={"phone": phone}, timeout=4).json()
if res.get("exists") or res.get("status"): return "✅ Yes (Registered)"
except: continue
return "❓ Unknown"
def fetch_instagram_data(username):
apis = [
{"url": "https://instagram-scraper-20251.p.rapidapi.com/userinfo/", "host": "instagram-scraper-20251.p.rapidapi.com", "p": {"username_or_id": username}},
{"url": "https://instagram-public-bulk-scraper.p.rapidapi.com/v1/username_to_id", "host": "instagram-public-bulk-scraper.p.rapidapi.com", "p": {"username": username}}
]
for api in apis:
try:
res = requests.get(api["url"], headers={"x-rapidapi-key": RAPID_API_KEY, "x-rapidapi-host": api["host"]}, params=api["p"], timeout=5).json()
data = res.get("data", {}) or res
name = data.get('full_name') or data.get('username')
if name:
return f"👤 **Name:** `{name}`\n👥 **Followers:** {data.get('follower_count', 'N/A')}\n📝 **Bio:** {data.get('biography', 'N/A')}"
except: continue
return "❌ IG Data Not Found."
def scrape_website_data(domain):
apis = [
{"url": "https://website-contacts-scraper.p.rapidapi.com/scrape-contacts", "host": "website-contacts-scraper.p.rapidapi.com", "p": {"query": domain}},
{"url": "https://website-contact-social-phone-extractor-email-finder-scale1.p.rapidapi.com/v1/find", "host": "website-contact-social-phone-extractor-email-finder-scale1.p.rapidapi.com", "p": {"domain": domain}}
]
for api in apis:
try:
res = requests.get(api["url"], headers={"x-rapidapi-key": RAPID_API_KEY, "x-rapidapi-host": api["host"]}, params=api["p"], timeout=8).json()
emails = ", ".join(res.get("emails", [])[:3]) if res.get("emails") else "None"
phones = ", ".join(res.get("phones", [])[:3]) if res.get("phones") else "None"
if emails != "None" or phones != "None":
return f"📧 **Emails:** {emails}\n📞 **Phones:** {phones}"
except: continue
return "❌ No contact info found on this website."
def track_ip(ip):
try:
res = requests.get(f"http://ip-api.com/json/{ip}").json()
return f"📍 Location: {res.get('city')}, {res.get('country')}\n🏢 ISP: {res.get('isp')}"
except: return "Error tracking IP."
# --- 4. TELEGRAM HANDLERS ---
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
uid = update.message.chat_id
lang = user_lang.get(uid, "en")
msg = "🕵️♂️ **Truecaller fast V6 Mega**\nSend Phone (+91), Username (@), IP, Domain (google.com) or Email."
if lang == "ml": msg = "🕵️♂️ **Truecaller fast V6 Mega**\nഫോൺ നമ്പർ (+91), ഇൻസ്റ്റാഗ്രാം (@), IP, വെബ്സൈറ്റ്, ഇമെയിൽ എന്നിവ അയക്കുക."
await update.message.reply_text(msg + DISCLAIMER[lang], parse_mode='Markdown')
async def set_lang(update: Update, context: ContextTypes.DEFAULT_TYPE):
keyboard = [[InlineKeyboardButton("English", callback_data='sl_en'), InlineKeyboardButton("Malayalam", callback_data='sl_ml')]]
await update.message.reply_text("Select Language:", reply_markup=InlineKeyboardMarkup(keyboard))
async def lang_callback(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()
lang = query.data.split("_")[1]
user_lang[query.message.chat_id] = lang
await query.edit_message_text(f"Language set to {lang.upper()}")
async def handle_msg(update: Update, context: ContextTypes.DEFAULT_TYPE):
text = update.message.text.strip()
uid = update.message.chat_id
lang = user_lang.get(uid, "en")
dis = DISCLAIMER[lang]
# 1. IP
if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", text):
status = await update.message.reply_text("🌐 Tracking IP Address...")
await status.edit_text(f"✅ **Results:**\n{track_ip(text)}" + dis, parse_mode='Markdown')
# 2. EMAIL
elif re.match(r"[^@]+@[^@]+\.[^@]+", text):
status = await update.message.reply_text("📧 Investigating Email...")
kb = [[InlineKeyboardButton("🔍 Epieos", url=f"https://epieos.com/?q={text}"), InlineKeyboardButton("☠️ Breach", url=f"https://haveibeenpwned.com/account/{text}")]]
await status.edit_text(f"📧 **Email:** `{text}`" + dis, reply_markup=InlineKeyboardMarkup(kb), parse_mode='Markdown')
# 3. PHONE NUMBER (Mega OSINT)
elif text.startswith("+"):
status = await update.message.reply_text("🔎 Multi-Engine Scanning...")
try:
parsed = phonenumbers.parse(text)
reg = geocoder.description_for_number(parsed, "en") or "Unknown"
car = carrier.name_for_number(parsed, "en") or "Unknown"
r_code = phonenumbers.region_code_for_number(parsed)
num_only = text.replace("+", "")
t_name = fetch_truecaller_name(text, r_code)
u_name = fetch_upi_name(text)
wa_stat = check_whatsapp(text)
kb = [[InlineKeyboardButton("💬 WhatsApp", url=f"https://wa.me/{num_only}"), InlineKeyboardButton("👁 Eyecon", url=f"https://www.eyecon-app.com/peoplesearch?phone={num_only}")]]
res = f"✅ **MEGA Results!**\n\n🔵 **Truecaller:** `{t_name}`\n🏦 **UPI/Bank:** `{u_name}`\n💬 **WhatsApp:** {wa_stat}\n📍 **Region:** {reg}\n📱 **Carrier:** {car}" + dis
await status.edit_text(res, reply_markup=InlineKeyboardMarkup(kb), parse_mode='Markdown')
except Exception:
await status.edit_text("❌ Error. Use format +919876543210")
# 4. INSTAGRAM
elif text.startswith("@"):
user = text.replace("@", "")
status = await update.message.reply_text(f"🚀 Scraping Instagram for @{user}...")
info = fetch_instagram_data(user)
kb = [
[InlineKeyboardButton("📸 Instagram", url=f"https://www.instagram.com/{user}/"), InlineKeyboardButton("🐦 X", url=f"https://twitter.com/{user}")],
[InlineKeyboardButton("🌐 Deep Search", url=f"https://www.google.com/search?q=%22{user}%22")]
]
await status.edit_text(f"👤 **Target:** `@{user}`\n\n{info}" + dis, reply_markup=InlineKeyboardMarkup(kb), parse_mode='Markdown')
# 5. WEBSITES & SOCIAL LINKS (Scraper Array)
elif "http" in text or ".com" in text or ".in" in text or ".org" in text:
status = await update.message.reply_text("🔗 Processing Link/Domain...")
if "facebook.com" in text:
await status.edit_text("🔗 **Facebook Scraper:** Ready for data extraction via Mega APIs." + dis)
elif "youtube.com" in text or "youtu.be" in text:
await status.edit_text("🔗 **YouTube Scraper:** Processing video data via Mega APIs." + dis)
elif "amazon" in text:
await status.edit_text("🛒 **Amazon Scraper:** Analyzing product stock data." + dis)
else:
domain = text.replace("https://", "").replace("http://", "").split("/")[0]
data = scrape_website_data(domain)
await status.edit_text(f"🌐 **Website OSINT Target:** `{domain}`\n\n{data}" + dis, parse_mode='Markdown')
# 6. AI CHAT
else:
loading = await update.message.reply_text("🤖 AI Processing...")
if gemini_client:
try:
res = gemini_client.models.generate_content(model='gemini-2.5-flash', contents=f"{BOT_KNOWLEDGE}\nUser: {text}")
await loading.edit_text(res.text + "\n\n⚙️ *Powered by Gemini*", parse_mode='Markdown')
except:
await loading.edit_text("🤖 Server busy.")
else:
await loading.edit_text("🤖 AI Not Configured.")
# --- 5. INLINE QUERY HANDLER ---
async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.inline_query.query
if not query:
return
# Create an inline result article
results = [
InlineQueryResultArticle(
id=query if len(query) < 60 else query[:60], # Ensures ID length is within Telegram limits
title=f"Investigate: {query}",
description="Click to start deep OSINT investigation via bot",
input_message_content=InputTextMessageContent(
message_text=f"🕵️♂️ **Investigating:** `{query}`\n\nClick the button below to open the bot and view the full Mega OSINT report.",
parse_mode='Markdown'
),
reply_markup=InlineKeyboardMarkup([
[InlineKeyboardButton("🚀 Open Bot for Mega Results", url=f"https://t.me/Truecallerfastbot?start=inline")]
])
)
]
await update.inline_query.answer(results)
# --- 6. START BOT ---
if __name__ == "__main__":
if not TOKEN:
print("ERROR: BOT_TOKEN missing!")
else:
print("🚀 Master Mega OSINT Bot is Running...")
app = Application.builder().token(TOKEN).base_url(PROXY_URL).build()
app.add_handler(CommandHandler("start", start))
app.add_handler(CommandHandler("language", set_lang))
app.add_handler(CallbackQueryHandler(lang_callback, pattern="^sl_"))
app.add_handler(InlineQueryHandler(inline_query)) # INLINE HANDLER ADDED HERE
app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, handle_msg))
app.run_polling()
|