⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.48
Server IP:
78.40.11.138
Server:
Linux tango.o2switch.net 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
tmp
/
Edit File: patch-ar.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import io, os, shutil, sys base = os.path.expanduser('~/voyage-affaire.com') stamp = '2026-08-01' # ---------- 1) inc/schema.php : ajouter sb_schema_person ---------- sp = os.path.join(base, 'inc/schema.php') src = io.open(sp, encoding='utf-8').read() if 'function sb_schema_person' in src: print('schema: sb_schema_person deja present, rien a faire') else: shutil.copy2(sp, sp + '.bak-' + stamp) anchor = "/**\n * Rendu final" i = src.find(anchor) if i == -1: print('schema: ANCRE INTROUVABLE'); sys.exit(1) fn = u"""/** * Person — signature editoriale (page auteur). $meta : nom, url, fonction, * description, sujets (array de themes couverts). */ function sb_schema_person($meta) { $p = array( '@type' => 'Person', '@id' => sb_url($meta['url']) . '#person', 'name' => $meta['nom'], 'url' => sb_url($meta['url']), 'mainEntityOfPage' => sb_url($meta['url']), 'worksFor' => array('@id' => sb_url('/') . '#organization'), ); if (!empty($meta['fonction'])) { $p['jobTitle'] = $meta['fonction']; } if (!empty($meta['description'])) { $p['description'] = $meta['description']; } if (!empty($meta['sujets'])) { $p['knowsAbout'] = $meta['sujets']; } return $p; } """ src = src[:i] + fn + src[i:] io.open(sp, 'w', encoding='utf-8').write(src) print('schema: sb_schema_person ajoutee') # ---------- 2) inc/config.php : declarer la page ---------- cp = os.path.join(base, 'inc/config.php') cfg = io.open(cp, encoding='utf-8').read() if "'/auteur/antoine-rivel/'" in cfg: print('config: entree deja presente, rien a faire') else: shutil.copy2(cp, cp + '.bak-' + stamp) marker = "/* ----- Barre de navigation basse" m = cfg.find(marker) if m == -1: print('config: ANCRE navbas INTROUVABLE'); sys.exit(1) close = cfg.rfind(');', 0, m) if close == -1: print('config: FERMETURE $SB_PAGES INTROUVABLE'); sys.exit(1) entry = (u" '/auteur/antoine-rivel/' => array(\n" u" 'fichier' => 'auteur-antoine-rivel.php',\n" u" 'titre' => 'Antoine Rivel \\u2014 signature \\u00e9ditoriale',\n" u" 'description' => 'Antoine Rivel, signature \\u00e9ditoriale de voyage-affaire.com : domaines couverts, m\\u00e9thode de v\\u00e9rification des chiffres et liste des pages sign\\u00e9es.',\n" u" 'nav' => null,\n" u" ),\n") entry = entry.encode('utf-8').decode('unicode_escape') if False else entry.replace('\\u2014', u'\u2014').replace('\\u00e9', u'\u00e9').replace('\\u00e8', u'\u00e8').replace('\\u00e0', u'\u00e0') cfg = cfg[:close] + entry + cfg[close:] io.open(cp, 'w', encoding='utf-8').write(cfg) print('config: entree ajoutee')
Simpan