示例#1
0
//  You should have received a copy of the GNU General Public License
//  along with CAAS.  If not, see <http://www.gnu.org/licenses/>.
define("__INCLUDED__", 1);
require_once "./inc/base.php";
///////////////////////////////////////////
// DOWNLOAD OPERATIONS
///////////////////////////////////////////
// download json report
if (isset($_GET["download_json"])) {
    $aid = $_GET["download_json"];
    $aid_s = secure_display($aid);
    $mode = "usermode";
    if (isset($_GET["k"])) {
        $mode = "kernelmode";
    }
    $req = get_analysis_info($aid);
    $line = $req->fetchArray();
    if ($line) {
        $md5_hash = $line["md5"];
        $path = $results_path . $md5_hash . "." . $line["analysis_id"] . ".json";
        if (file_exists($path)) {
            header("Content-disposition: attachment; filename=" . $md5_hash . "." . $line["analysis_id"] . ".json");
            header("Content-type: text/json");
            readfile($path);
            exit(0);
        }
        error("Cannot find json report file " . $path, "ERROR");
    } else {
        error("Cannot find analysis &lt;" . $aid_s . "&gt;", "ERROR");
    }
}
示例#2
0
function display_analysis($analysis_id, $display_json = False)
{
    global $states, $results_path;
    $analysis_id_s = secure_display($analysis_id);
    $get_analysis_info_result = get_analysis_info($analysis_id);
    if (!$get_analysis_info_result) {
        return;
    }
    $analysis_info = $get_analysis_info_result->fetchArray();
    display_task($analysis_info["task_id"]);
    echo '<h2>#' . $analysis_id_s . ' ANALYSIS INFO</h2>';
    $cuckoo_server_id = $analysis_info["cuckoo_server_id"];
    $get_cuckoo_server_info_result = get_cuckoo_server_info($cuckoo_server_id);
    $cuckoo_server = "NOT FOUND";
    if ($get_cuckoo_server_info_result) {
        $cuckoo_server_info = $get_cuckoo_server_info_result->fetchArray();
        $cuckoo_server = '#' . secure_display($cuckoo_server_info["cuckoo_server_id"]) . ' ' . $cuckoo_server_info["name"] . ' ' . $cuckoo_server_info["server_addr"];
    }
    $kernl = intval($analysis_info["kernel_analysis"]);
    $mode = "usermode";
    if ($kernl == 1) {
        $mode = "kernelmode";
    }
    $score = intval($analysis_info["total_score"]);
    $state = intval($analysis_info["state"]);
    echo '
	<div class="container100"><table class="std">
		<tr><th class="std">STATE</th><td class="std">' . $states[$state] . '</td></tr>
		<tr><th class="std">MODE</th><td class="std">' . $mode . '</td></tr>
		<tr><th class="std">CUCKOO SERVER</th><td class="std">' . $cuckoo_server . '</td></tr>
		<tr><th class="std">TOTAL SCORE</th><td class="std"><span class="' . get_score_class($score, $kernl) . '">' . $score . '</span></td></tr>
		<tr><th class="std">SIGNATURES (score)</th><td class="std">';
    $get_matched_signatures_result = get_matched_signatures($analysis_id);
    if ($get_matched_signatures_result) {
        while ($signature_info = $get_matched_signatures_result->fetchArray()) {
            echo secure_display($signature_info['title']) . ' (' . secure_display($signature_info['score']) . ')<br />';
        }
    }
    echo '</td></tr>
		<tr><td colspan="2"><a href="' . $_SERVER['PHP_SELF'] . '?download_json=' . $analysis_id_s . '">Download JSON report</a></td></tr>
		<tr><td colspan="2"><a href="' . $_SERVER['PHP_SELF'] . '?display_json=' . $analysis_id_s . '">Display JSON data</a></td></tr>
	</table></div>';
    if ($display_json) {
        echo '
	<div class="container100">';
        $json_path = $results_path . $analysis_info["md5"] . "." . $analysis_info["analysis_id"] . ".json";
        display_json_info($json_path);
        echo '
	</div>';
    }
}