fase 1 - elaborazione qwen
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
include('../../../inc/includes.php');
|
||||
|
||||
header("Content-Type: application/octet-stream");
|
||||
header("Pragma: no-cache");
|
||||
Html::header_nocache();
|
||||
|
||||
$id = (int)($_GET['id'] ?? 0);
|
||||
if (!$id || !\PluginNetconfig\Config::canView()) {
|
||||
http_response_code(403);
|
||||
exit('Access denied');
|
||||
}
|
||||
|
||||
$config = new \PluginNetconfig\Config();
|
||||
if (!$config->getFromDB($id)) {
|
||||
http_response_code(404);
|
||||
exit('Configuration not found');
|
||||
}
|
||||
|
||||
$content = $config->getDecryptedContent();
|
||||
|
||||
// Opzionale: mascheramento credenziali
|
||||
$content = preg_replace('/(?<=password\s|secret\s|enable\s)[^\s\r\n]+/i', '***REDACTED***', $content);
|
||||
|
||||
header('Content-Disposition: attachment; filename="netconfig_' . $id . '_' . date('Ymd_His') . '.txt"');
|
||||
echo $content;
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user