import asyncio import os import re import requests import sys import discord import pytesseract from PIL import Image from discord.ext import commands from tesserocr import PyTessBaseAPI class Program: def __init__(self): self.cookies = requests.cookies.RequestsCookieJar() self.channelIDS = [] self._client = discord.Client() self.useTesseract = True async def main_async(self): if not os.path.exists("C:/Program Files/Tesseract-OCR"): print("Tesseract bulunamadı, resimden okuma yapılamayacak. Devam etmek istiyor musunuz?") option = input("Evet için 'Y', Hayır için 'N' girin: ") if option.upper() == "Y": self.useTesseract = False else: return usertoken = input("Discord hesabınızın tokenini girin: ") if usertoken.startswith("mfa"): print("2 Faktöryeli açık olan hesaplarda selfbot çalışmaz.") print("Desteklenen token formatları: \"O\", \"N\" harfleriyle başlayan tokenlerdir.") input() return try: await self._client.login(usertoken) except discord.errors.HTTPException as e: if "Unauthorized" in str(e): print("Hatalı bir token girildi.") input() return else: raise content = self.get_token() token = re.search(r"('[a-z0-9_\-]+')", content).group().strip("'") username = input("Craftrise kullanıcı isminizi girin: ") password = input("Craftrise şifrenizi girin: ") if self.login(username, password, token): print("Craftriseye giriş başarılı, işleme hazırsınız!") else: print("Craftriseye giriş yapılırken bir hata oluştu. Kullanıcı adınızı ve şifrenizi kontrol edin.") input() return count = -1 try: count = int(input("Kaç tane kanalı izleyeceksiniz: ")) if count <= 0: print("Girilen sayı 0'dan büyük olmalı.") input() return except ValueError: print("Formatta bir hata var.") input() return print("Kanal ID'lerini yazın:") for i in range(count): try: channel_id = int(input()) self.channelIDS.append(channel_id) except ValueError: print("Formatta bir hata var.") input() return print("Her şey hazır, işleme hazırsınız!") await self._client.start() await asyncio.sleep(float("inf")) async def on_ready(self): pass async def on_message(self, message): if message.author == self._client.user: return if message.channel.id not in self.channelIDS: return content = "empty" if message.attachments and self.useTesseract: url = message.attachments[0].url response = requests.get(url) with open("image.png", "wb") as f: f.write(response.content) with Image.open("image.png") as img: with PyTessBaseAPI() as api: api.SetImage(img) content = api.GetUTF8Text().strip() else: content = message.content if content == "empty": return for line in content.split("\n"): regex_list = [ r"RISE-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}-\b[0-9A-Z]{4}", r"RISEKINGDOMS-[0-9A-Z]{3}-[0-9A-Z]{4}-[0-9A-Z]{3}" ] for regex in regex_list: matches = re.findall(regex, line) for match in matches: result = self.use_code(match) if "True" in str(result[0]): print("Kod başarıyla kullanıldı. Yeni krediniz:", result[1]) else: print("Bu kod hatalı veya kullanılmış:", result[2]) def get_token(self): url = "https://www.craftrise.com.tr/" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0", "Host": "www.craftrise.com.tr" } response = requests.get(url, headers=headers, cookies=self.cookies) return response.text def login(self, username, password, token): url = "https://www.craftrise.com.tr/posts/post-login.php" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0", "Host": "www.craftrise.com.tr", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" } data = { "value": username, "password": password, "token": token } response = requests.post(url, headers=headers, cookies=self.cookies, data=data) json_response = response.json() return json_response["resultType"] == "success" def use_code(self, code): url = "https://www.craftrise.com.tr/posts/post-code.php" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0", "Host": "www.craftrise.com.tr", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" } data = { "code": code } response = requests.post(url, headers=headers, cookies=self.cookies, data=data) json_response = response.json() return [json_response["resultMessage"].startswith("Tebrikler"), json_response["credits"], code] def run(self): asyncio.run(self.main_async()) if __name__ == "__main__": Program().run()