diff --git a/scripts/plugins/unbound.php b/scripts/plugins/unbound.php new file mode 100644 index 0000000..55e9440 --- /dev/null +++ b/scripts/plugins/unbound.php @@ -0,0 +1,77 @@ + $service) + { + $services[$key] = scrape_between($service, "../../", ".txt"); + } + + $output = ""; + + foreach($files as $file) + { + if (in_array(scrape_between($file, "../../", ".txt"), $services)) + { + $output .= "# File: " . scrape_between($file, "../../", ".txt"); + foreach (file($file) as $key => $line) + { + $line = trim($line, " \t\n\r\0\x0B"); + if (substr($line, 0,1) == "#") + { + // Comment handling + $output .= $line; + } + elseif (substr($line, 0,1) == "*") + { + // Wildcard handling + $line = ltrim($line, '*'); + $line = ltrim($line, '.'); + + // Output for wildcard + $output .= "# ------ Wildcard replaced with local-zone data ------ #" . PHP_EOL; + $output .= 'local-zone: "' . $line . '" redirect' . PHP_EOL; + $output .= 'local-data: "' . $line . ' A ' . $server . '"' . PHP_EOL; + $output .= "# ---------------------------------------------------- #"; + } + else + { + $output .= 'local-data: "' . $line . ' A ' . $server . '"'; + } + $output .= PHP_EOL; + } + $output .= PHP_EOL; + $output .= PHP_EOL; + } + } + if ($mode == "cli") + { + return $output; + } + else + { + echo $output; + } + } +} + +?> \ No newline at end of file diff --git a/scripts/unbound_conf.php b/scripts/unbound_conf.php deleted file mode 100644 index e8a57d8..0000000 --- a/scripts/unbound_conf.php +++ /dev/null @@ -1,55 +0,0 @@ - $value) - { - $value = trim($value, " \t\n\r\0\x0B"); - if (substr($value, 0,1) == "#") - { - $content = $value; - } - elseif (substr($value, 0,1) == "*") - { - $value = ltrim($value, '*'); - $value = ltrim($value, '.'); - - $content = "# ------ Wildcard replaced with local-zone data ------ #" . PHP_EOL; - $content = $content . 'local-zone: "' . $value . '" redirect' . PHP_EOL; - $content = $content . 'local-data: "' . $value . ' A ' . $server . '"' . PHP_EOL; - $content = $content . "# ---------------------------------------------------- #"; - } - else - { - $content = 'local-data: "' . $value . ' A ' . $server . '"'; - } - echo $content; - echo PHP_EOL; - } - echo PHP_EOL; - echo PHP_EOL; - } - } -} - -?> \ No newline at end of file