Files
html/api/wevia-oss-scan.php
2026-04-16 02:28:32 +02:00

13 lines
1.0 KiB
PHP

<?php
header("Content-Type: application/json");
$secrets=[];
foreach(file("/etc/weval/secrets.env",2|4) as $l){if(strpos($l,"=")!==false){list($k,$v)=explode("=",$l,2);$secrets[trim($k)]=trim($v," \t\"'");}}
// Scan installed tools
$tools = [];
$checks = ["playwright"=>"playwright --version","scrapy"=>"scrapy version","nuclei"=>"nuclei -version","docker"=>"docker --version","python3"=>"python3 --version","php"=>"php -v | head -1","node"=>"node -v","git"=>"git --version","curl"=>"curl --version | head -1","psql"=>"psql --version","nginx"=>"nginx -v 2>&1","ollama"=>"curl -sf http://127.0.0.1:11434/api/tags | python3 -c \"import json,sys;print(len(json.load(sys.stdin)['models']),'models')\""];
foreach ($checks as $name => $cmd) {
$out = trim(shell_exec("$cmd 2>/dev/null") ?? "");
$tools[$name] = $out ? ["status"=>"installed","version"=>substr($out,0,50)] : ["status"=>"missing"];
}
echo json_encode(["tools"=>$tools,"installed"=>count(array_filter($tools,function($t){return $t["status"]==="installed";})),"total"=>count($tools)], JSON_UNESCAPED_UNICODE);