import socket import requests from flask import Flask, render_template_string, request, session, redirect, url_for from mcstatus import JavaServer app = Flask(__name__) app.secret_key = "une_cle_tres_secrete" # --- CONFIGURATION --- MAC_ADRESSE = "d4:3d:7e:31:e8:84" MON_HOST_NOIP = "cobblev2.redirectme.net" MOT_DE_PASSE = "pouletcrousty" MC_PORT = 25565 IMAGE_FOND = "https://images.alphacoders.com/132/1327533.png" IMAGES_GALERIE = [ "https://i.redd.it/ag4307hy62qe1.jpeg", "https://pbs.twimg.com/profile_images/1627794683362480129/3xUrVnUY_400x400.jpg", "https://sativa.fr/wp-content/uploads/SnoopDogg.jpg", "https://media.zenfs.com/fr_FR/News/Gameblog/kate-upton-gta-v.jpg", "https://i1.sndcdn.com/artworks-000148945005-hx6vn7-t1080x1080.jpg", "https://www.shutterstock.com/image-illustration/internet-meme-stupid-troll-face-260nw-201587906.jpg", "https://www.lycee3vallees.fr/wp-content/uploads/2024/08/Logo-Pole-emploi.png", "https://img.freepik.com/photos-gratuite/belle-photo-chaton-british-shorthair-blanc_181624-57681.jpg", "https://img.freepik.com/photos-premium/mignon-petit-chaton-britannique-bleu-gris-dormant-enveloppe-dans-couverture-carreaux-blanche-concept-adorables-animaux-compagnie_106368-4291.jpg", "https://images.eatself.com/811/38179_10273994.png", "https://miro.medium.com/0*Ug2qG0Ph4JkU5pEZ.png", "https://storage.googleapis.com/pod_public/1300/245798.jpg", "https://www.nextplz.fr/wp-content/uploads/nextplz/2018/05/18068280901060695.jpg", "https://passed.fr/wp-content/uploads/2019/12/Zidane-1.jpg", "https://i.kym-cdn.com/entries/icons/original/000/038/806/tco_-_2021-11-10T112501.292.jpg", "https://thumbs.dreamstime.com/z/homme-chinois-asiatique-d-affaires-7045702.jpg", "https://c8.alamy.com/compfr/b332ew/un-chinois-d-une-vingtaine-d-annees-avec-un-grand-sourire-b332ew.jpg", "https://www.toutpourvosfetes.fr/30551-large_default/moustache-et-barbe-chinois.jpg", "https://thumbs.dreamstime.com/b/nain-petit-homme-4339718.jpg", "https://pbs.twimg.com/media/GaecrTvaEAAreDl.jpg", "https://i.pinimg.com/736x/7f/a7/84/7fa78427092842091603dfcff6f849ca.jpg", "https://retrogems.fr/wp-content/uploads/2025/12/asterion-copine-virale.jpg", "https://tribunedelyon.fr/wp-content/uploads/sites/5/2025/10/khalamite-pierre-ferrandis-10.jpg", "https://media.tenor.com/JzOOJNV1gZUAAAAe/antoine-daniel-wtc.png", "https://www.pokepedia.fr/images/thumb/0/03/Lockpin-DP.png/800px-Lockpin-DP.png", "https://i.pinimg.com/736x/8a/42/d2/8a42d20954675f8f5bcb931f2560d380.jpg", "https://www.clipartmax.com/png/middle/166-1665846_pikachu-meets-minecraft-by-drpoochew-pikachu-face-meme-png.png", "https://www.picclickimg.com/ekoAAOSwrBBjrwRk/Flag-Palestine-Drapeau-Palestine-ecusson-brodu00e9-patche-thermocollant.webp", "https://www.radiofrance.fr/s3/cruiser-production/2019/10/2ccb44bb-6211-4340-b063-4d7a015575d4/1200x680_kaaris-or-noir.jpg_or_noir.jpg", "https://i.ebayimg.com/images/g/jagAAOxyu1BTj-fx/s-l1200.jpg", "https://www.radiofrance.fr/s3/cruiser-production-eu3/2019/06/d12bbc34-45f9-4b03-b762-25ae9988b888/640x340_gettyimages-624736982.jpg", "https://upload.wikimedia.org/wikipedia/fr/b/b2/Minecraft%2C_le_film.png", ] def get_server_status(): try: server = JavaServer.lookup(f"{MON_HOST_NOIP}:{MC_PORT}") status = server.status() ping = round(status.latency, 1) info = f"EN LIGNE 🟢 ({status.players.online}/{status.players.max})" sub_info = f"
Ping: {ping}ms" return info + sub_info, "#00ff00" except: try: ip = socket.gethostbyname(MON_HOST_NOIP) with socket.create_connection((ip, MC_PORT), timeout=1): return "DÉMARRAGE... 🟡", "#fbbf24" except: return "HORS LIGNE 🔴", "#ff4444" HTML_TEMPLATE = ''' Cobblemon Dashboard
{% for img_url in galerie %} {% endfor %}

Cobblemon V2

Statut : {{ status_text|safe }}
{% if not logged_in %}


{% else %} {% if message %}
⚡ {{ message }}
{% endif %} {% if show_snake %}
↑
↓
←
→
{% else %}
{% endif %}

🔄 ACTUALISER

{% endif %}
''' @app.route('/') def index(): status_text, status_color = get_server_status() return render_template_string(HTML_TEMPLATE, logged_in=session.get('auth'), status_text=status_text, status_color=status_color, bg_image=IMAGE_FOND, galerie=IMAGES_GALERIE, show_snake=False) @app.route('/login', methods=['POST']) def login(): if request.form.get('password') == MOT_DE_PASSE: session['auth'] = True return redirect('/') @app.route('/wake', methods=['POST']) def wake(): if not session.get('auth'): return redirect('/') mac_clean = MAC_ADRESSE.replace(':', '').upper() try: # Résolution DNS de ton IP publique target_ip = socket.gethostbyname(MON_HOST_NOIP) # On utilise le service DNSExit qui est très direct url = f"https://www.dnsexit.com/api/wol?mac={mac_clean}&host={target_ip}" headers = {'User-Agent': 'Mozilla/5.0'} r = requests.get(url, headers=headers, timeout=10) if r.status_code == 200: msg = f"🚀 Signal envoyé à {target_ip} !" else: msg = f"Signal envoyé (Code {r.status_code})" except Exception as e: msg = f"Erreur : {str(e)}" status_text, status_color = get_server_status() return render_template_string(HTML_TEMPLATE, logged_in=True, status_text=status_text, status_color=status_color, bg_image=IMAGE_FOND, galerie=IMAGES_GALERIE, show_snake=True, message=msg) if __name__ == "__main__": app.run(host='0.0.0.0', port=7860)