<?php
class BobContents {
var $files; // (fichier, serveur, repertoire, user, pass, port, taille, cible)
var $title;
var $author;
var $website;
var $urlbanner;
var $team;
var $nbdl;
}
class BobContentsPrinter {
function printHTML($bobcontents, $userfilename) {
echo "<html>\n<body>\n<center>\n";
echo "<h2>Contenu de ".$userfilename."...</h2>\n";
echo "<table border=1>\n";
echo "<thead>\n";
echo " <tr>\n";
echo " <th>Fichier</th>\n";
echo " <th>Serveur</th>\n";
echo " <th>Repertoire</th>\n";
echo " <th>User</th>\n";
echo " <th>Pass</th>\n";
echo " <th>Port</th>\n";
echo " <th>Taille</th>\n";
echo " <th>Cible</th>\n";
echo " </tr>\n";
echo "</thead>\n";
echo "<tbody>\n";
$files = $bobcontents->files;
reset($files);
$l = count($files);
for($i = 0; $i < $l; ++$i) {
list($file, $server, $rep, $user, $pass, $port, $len, $target) = $files[$i];
echo " <tr>\n";
echo " <td>".$file."</td>\n";
echo " <td>".$server."</td>\n";
echo " <td>".$rep."</td>\n";
echo " <td>".$user."</td>\n";
echo " <td>".$pass."</td>\n";
echo " <td>".$port."</td>\n";
echo " <td>".$len."</td>\n";
echo " <td>".$target."</td>\n";
echo " </tr>\n";
}
echo "</tbody>\n";
echo "</table>\n";
echo "<br>\n";
echo "<table border=1>\n";
echo "<tbody>\n";
echo " <tr>\n";
echo " <td>Titre</td>\n";
echo " <td>".$bobcontents->title."</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>Createur</td>\n";
echo " <td>".$bobcontents->author."</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>Site</td>\n";
echo " <td>".$bobcontents->website."</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>URL Banniere</td>\n";
echo " <td>".$bobcontents->urlbanner."</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>Team</td>\n";
echo " <td>".$bobcontents->team."</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>Nb dl simultanes</td>\n";
echo " <td>".$bobcontents->nbdl."</td>\n";
echo " </tr>\n";
echo "</tbody>\n";
echo "</table>\n";
echo "<br>\n";
echo "<i>Generated by Unbob the ".date("Y.m.d@H:i")."</i>\n";
echo "</center>\n</body>\n</html>";
}
}
class BobParser {
function parse($s) {
$bc = new BobContents;
$lines = explode("\n", $s);
$bc->title = trim($lines[1]);
$urls = (int)trim($lines[2]);
for($i = 0; $i < $urls; ++$i) {
$bc->files[] = explode(chr(0xB5), trim($lines[$i + 3]));
}
$bc->author = trim($lines[$urls + 3]);
$bc->website = trim($lines[$urls + 4]);
$bc->urlbanner = trim($lines[$urls + 5]);
$bc->team = trim($lines[$urls + 6]);
$bc->nbdl = trim($lines[$urls + 7]);
return $bc;
}
}
class Unbob {
var $word_12AFB4, $byte_4334EC;
function Unbob() {
$this->word_12AFB4 = array (
0xC43F, 0xD4FF, 0xC5FB, 0x6470, 0x0037, 0xE247, 0x8E6E, 0xFD53,
0x7F63, 0x3C2A, 0x4000, 0x0001, 0x2995, 0xA910, 0xB17F, 0x4396,
0x0000, 0x00B5, 0x2BE9, 0xE40F, 0xBF55, 0xE89F, 0x0000, 0x5A85,
0x3ABC, 0x076F, 0xBFF3, 0x4EC4, 0x002D, 0x42B0, 0x0E57, 0xB718,
0xF904, 0x0000, 0x13A0, 0x55BC, 0x535A, 0x8C00, 0x81DC, 0x0000,
0xD02A, 0xDE03, 0x0772, 0xE95F, 0xEDC6, 0x6DFB, 0x156F, 0x01A8,
0x0000, 0xFFF5, 0xAF54, 0xA61E
);
$this->byte_4334EC = array (
0x42, 0x45, 0x44, 0x41, 0x53, 0x53
);
}
function checkV1($fp) {
$xored = array(0x00, 0x2A, 0x06, 0x25, 0x1C, 0x24);
$s = fread($fp, count($xored));
rewind($fp);
$l = strlen($s);
for($i = 0; $i < $l; ++$i) {
if(ord($s[$i]) != $xored[$i]) {
break;
}
}
return $i == $l;
}
function decryptV1($fp) {
$l = count($this->byte_4334EC);
$s = "";
$i = 0;
while(!feof($fp)) {
$s .= chr(ord(fgetc($fp)) ^ $this->byte_4334EC[$i]);
$i = ($i + 1) % $l;
}
return $s;
}
function sub_409930($a0, $a4) {
$ax = ($a0 + 0xFFFF) & 0xFFFF;
$cx = (($a4 - 1) & 0xFFFF) * ($ax + 1);
$dx = $cx + $ax + 1;
$cx = $dx >> 0x10;
$ax = $dx - $cx;
if(($cx & 0xFFFF) >= ($dx & 0xFFFF))
++$ax;
return $ax;
}
function sub_409820(&$arg_0, $arg_8) {
$s1 = $arg_0[0] | ($arg_0[1] << 8);
$s2 = $arg_0[2] | ($arg_0[3] << 8);
$s3 = $arg_0[4] | ($arg_0[5] << 8);
$s4 = $arg_0[6] | ($arg_0[7] << 8);
$arg_8prim = $s4;
$j = 0;
for($i = 0; $i < 8; $i++) {
$s4 = $this->sub_409930($s1, $arg_8[$j++]);
$s2 += $arg_8[$j++];
$s3 += $arg_8[$j++];
$s1 = $s4;
$arg_0prim = $s3;
$arg_8prim = $this->sub_409930($arg_8prim, $arg_8[$j++]);
$s3 ^= $s4;
$s3 = $this->sub_409930($s3, $arg_8[$j++]);
$s4 = $this->sub_409930(($arg_8prim ^ $s2) + $s3, $arg_8[$j++]);
$s3 += $s4;
$s1 ^= $s4;
$arg_8prim ^= $s3;
$s3 ^= $s2;
$s2 = $s4 ^ $arg_0prim;
}
$o = $this->sub_409930($s1, $arg_8[$j++]);
$arg_0[0] = $o & 0xFF;
$arg_0[1] = ($o >> 8) & 0xFF;
$o = $arg_8[$j++] + $s3;
$arg_0[2] = $o & 0xFF;
$arg_0[3] = ($o >> 8) & 0xFF;
$o = $arg_8[$j++] + $s2;
$arg_0[4] = $o & 0xFF;
$arg_0[5] = ($o >> 8) & 0xFF;
$o = $this->sub_409930($arg_8prim, $arg_8[$j++]);
$arg_0[6] = $o & 0xFF;
$arg_0[7] = ($o >> 8) & 0xFF;
}
function decryptV2($fp) {
$c = 0;
$t = array();
$chunks = array();
while(!feof($fp)) {
$t[] = ord(fgetc($fp));
++$c;
if($c == 8) {
for($l = 0; $l < 3; ++$l) {
$this->sub_409820($t, $this->word_12AFB4);
}
$key = $t[0] | ($t[1] << 8);
$data = "";
for($m = 0; $m < 6; ++$m) {
$data .= chr($t[$m + 2] ^ $this->byte_4334EC[$m]);
}
$chunks[$key] = $data;
$t = array();
$c = 0;
}
}
ksort($chunks);
return join("", array_values($chunks));
}
function decrypt($filename) {
$ret = "";
$fp = fopen($filename, "rb");
if($fp) {
if($this->checkV1($fp)) {
$ret = $this->decryptV1($fp);
}
else {
$ret = $this->decryptV2($fp);
}
fclose($fp);
}
return $ret;
}
}
$ub = new Unbob;
$bp = new BobParser;
$bcp = new BobContentsPrinter;
$bcp->printHTML($bp->parse($ub->decrypt($userfile)), $userfile_name);
?>