Suppose you have a lot of offices, each of which is ESET NOD32 and there is OpenVPN for communication. In addition, each office will have one computer on which a license will be installed and which will download updates, the rest of antiviruses will download updates from it. After installing the license, an update via HTTP becomes available (in our case, we specify port 8081 in the settings).<?php if (isset($_GET['host'])) $host = $_GET['host']; $url = "/update.ver"; $text = ""; if ($fp = fsockopen($host, 8081, $errno, $errstr, 20)) { // , $out = "GET $url HTTP/1.0\r\n"; $out .= "Host: $host\r\n"; $out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n"; $out .= "Accept: */*:\r\n"; $out .= "Pragma: no-cache\r\n"; $out .= "Cache-Control: no-cache\r\n"; $out .= "Connection: close\r\n\r\n"; fputs($fp, $out); // $content = ''; while(!feof($fp)) { stream_set_timeout($fp, 10); $content .= fgets($fp, 4096); $status = socket_get_status($fp); if ($status['timed_out']) break; } fclose($fp); // // \d $pattern = '/version=(\\d\\d\\d\\d)\ \((\\d\\d\\d\\d\\d\\d\\d\\d)\)/'; preg_match_all($pattern, $content, $matches, PREG_OFFSET_CAPTURE); $count = count($matches[0]); if (!$count) { // - $pattern = '/versionid=(\\d\\d)(\\d\\d)/'; preg_match_all($pattern, $content, $matches, PREG_OFFSET_CAPTURE); $count =count($matches[0]); } // $ar = array(); for ($i=0;$i<$count;$i++) $ar[$i] = strval($matches[1][$i][0])."-".strval($matches[2][$i][0]); // , rsort($ar); $text = $ar[0]; } else $text= "$errstr ($errno)"; // , $font = imageloadfont('fonts/terminal6.gdf'); $fontWidth = imagefontwidth($font); $fontHeight = imagefontheight($font); $im = imagecreate(strlen($text) * $fontWidth, $fontHeight); $bgColor = imagecolorallocate($im, 255, 255, 255); $fgColor = imagecolorallocate($im, 0, 0, 255); imagestring($im, $font, 0, 0, $text, $fgColor); header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?> AddHandler application/x-httpd-php .png
<? $host="192.168.2.250"; require_once "index.php"; ?> <? $host="192.168.93.250"; require_once "index.php"; ?> Source: https://habr.com/ru/post/108273/
All Articles