-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
114 lines (97 loc) · 3.79 KB
/
Copy pathconfig.py
File metadata and controls
114 lines (97 loc) · 3.79 KB
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
"""Configuration settings for the API Bot"""
import os
from pathlib import Path
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Base directory
BASE_DIR = Path(__file__).resolve().parent
# Telegram Bot
TELEGRAM_BOT_TOKEN = os.getenv('TELEGRAM_BOT_TOKEN')
# Database
DATABASE_PATH = os.getenv('DATABASE_PATH', 'bot_data.db')
# Scanning Configuration
MAX_PARALLEL_SCANS = int(os.getenv('MAX_PARALLEL_SCANS', '10'))
REQUEST_TIMEOUT = int(os.getenv('REQUEST_TIMEOUT', '15'))
MAX_RETRIES = int(os.getenv('MAX_RETRIES', '2'))
# Performance Optimization for Render
ENABLE_CACHING = os.getenv('ENABLE_CACHING', 'true').lower() == 'true'
CACHE_TTL = int(os.getenv('CACHE_TTL', '300')) # 5 minutes
CONNECTION_POOL_SIZE = int(os.getenv('CONNECTION_POOL_SIZE', '100'))
KEEPALIVE_EXPIRY = int(os.getenv('KEEPALIVE_EXPIRY', '5'))
# Security
HAVEIBEENPWNED_API_KEY = os.getenv('HAVEIBEENPWNED_API_KEY', '')
# Logging
LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO')
LOG_FILE = os.getenv('LOG_FILE', 'bot.log')
# User Agent
USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
# DNS Servers
DNS_SERVERS = ['8.8.8.8', '1.1.1.1', '208.67.222.222']
# Timeouts (seconds)
DNS_TIMEOUT = 5
HTTP_TIMEOUT = 30
SSL_TIMEOUT = 10
# Rate Limiting
RATE_LIMIT_REQUESTS = 10
RATE_LIMIT_PERIOD = 60 # seconds
# Result Categories
AVAILABILITY_STATUSES = {
'AVAILABLE': '🟢 Available',
'UNAVAILABLE': '🔴 Unavailable',
'AUTH_REQUIRED': '🔐 Authentication Required',
'REGION_BLOCKED': '🌍 Region Blocked',
'IP_BLOCKED': '🚫 IP Blocked',
'TIMEOUT': '⏱️ Timeout',
'ERROR': '❌ Error'
}
SECURITY_STATUSES = {
'SECURE': '✅ Secure',
'LEAKED': '⚠️ Leaked',
'OUTDATED': '⚠️ Outdated Security',
'NO_INFO': 'ℹ️ No Information'
}
# Paywall Detection Keywords
PAYWALL_KEYWORDS = [
'subscribe', 'subscription', 'premium', 'paywall',
'payment required', 'sign up', 'register', 'login required',
'402', 'upgrade to access', 'paid content'
]
# Bot Messages
MESSAGES = {
'welcome': (
"🤖 *API Resource Availability Bot*\n\n"
"🔍 *19 Advanced Scanners - Comprehensive Website Analysis*\n\n"
"*Core Scanners:*\n"
"• 🌐 Availability & Latency Detection\n"
"• 🔍 DNS & IP Information Lookup\n"
"• 🔒 Protocol & Security Analysis\n"
"• 💰 Paywall & Authentication Detection\n"
"• ⚠️ Security Breach Status Check\n\n"
"*Performance & SEO:*\n"
"• ⚡ Performance Metrics (Load Time, TTFB)\n"
"• 📊 SEO Analysis (Meta Tags, Sitemap)\n"
"• 📱 Mobile Optimization Check\n\n"
"*Security & Privacy:*\n"
"• 🔐 Authentication Methods (OAuth, SSO)\n"
"• 🍪 Privacy & Cookie Compliance\n"
"• 🌍 CORS Configuration\n"
"• 🔓 Insecure Content Detection\n\n"
"*Technical Analysis:*\n"
"• 🛠️ Tech Stack Detection (CMS, Frameworks)\n"
"• 💾 Database Detection\n"
"• 💳 Payment Provider Detection\n"
"• 📡 CDN & External Resource Detection\n"
"• 🤖 Robots.txt & Sitemap Checker\n"
"• 📜 Certificate & SSL Analysis\n\n"
"⚡ *Parallel Processing* - All scanners run simultaneously!\n"
"📊 Get detailed reports in seconds!\n\n"
"Send me any URL to start comprehensive scanning!"
),
'scanning': '🔄 Scanning resource... Please wait...',
'error': '❌ An error occurred: {}',
'invalid_url': '❌ Invalid URL format. Please provide a valid URL.',
'bookmark_added': '✅ Added to bookmarks!',
'bookmark_removed': '🗑️ Removed from bookmarks!',
'no_bookmarks': 'ℹ️ No bookmarks yet. Scan a resource and add it to bookmarks!',
}