Пример #1
0
<?php

$md5 = Common::getMD5("report");
$id = Common::getInteger("id");
$binary = "uploads/{$md5}.bin";
$sections = Binary::sections($binary);
if ($id > count($sections)) {
    print Website::Error("That section was not found...");
    return;
}
$b = new Binary($binary);
$bytes = $b->readBytesAtOffset($sections[$id - 1]["prd"]["value"], $sections[$id - 1]["srd"]["value"]);
print "<pre>";
$html = htmlentities($bytes, ENT_DISALLOWED, "iso-8859-1");
$html = preg_replace("/&#xFFFD;/", " ", $html);
print $html;
print "</pre>";
Пример #2
0
$start = 0;
$size = 0;
foreach ($resources as $r) {
    if ($r["type"]["value"] != "RT_STRING") {
        continue;
    }
    $c++;
    if ($c == $id) {
        $start = $r["fo"]["value"];
        $size = $r["size"]["value"];
    }
}
if (!$start && !$size) {
    print Common::Error("Error", "That rt_string resource was not found...");
    return;
}
if ($start[0] == "-") {
    print Common::Error("Error", "The rt_stirng information is invalid: Negative offset position.");
    return;
}
if ($size[0] == "-") {
    print Common::Error("Error", "The rt_string information is invalid: Negative size.");
    return;
}
$b = new Binary($binary);
$bytes = $b->readBytesAtOffset($start, $size);
print "<pre>";
$html = htmlentities($bytes, ENT_DISALLOWED, "iso-8859-1");
$html = preg_replace("/&#xFFFD;/", " ", $html);
print $html;
print "</pre>";
Пример #3
0
        $offset = 0;
        $size = 0;
        $b = new Binary($binary);
        $html = Pefile::call("res_offsets", $binary);
        preg_match_all("/RT_BITMAP (.+)/", $html, $i);
        if ($bitmap > count($i[1])) {
            die;
        }
        foreach ($i[1] as $bmp) {
            $count++;
            if ($count == $bitmap) {
                list($va, $offset_d, $size, $offset) = preg_split("/\\s/", $bmp);
                break;
            }
        }
        $header = $b->headerOf("RT_BITMAP");
        $data = $b->readBytesAtOffset($offset, $size);
        $out = "";
        if ($data[0] != "B" && $data[1] != "M") {
            $out = $header . $data;
        } else {
            $out = $data;
        }
    } else {
        $out = file_get_contents($cache_bitmap);
    }
    header("Content-Type: image/bmp");
    print $out;
    file_put_contents($cache_bitmap, $out);
}
exit;