Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

UPX Compression Script
Welcome, Guest. Please login or register.
December 02, 2008, 05:17:11 AM
11304 Posts in 1248 Topics by 498 Members
Latest Member: katCheeme
Experts Round Table Network  |  Bits and Bytes  |  Tips, Tricks, Snippets, Tidbits And General Pearls Of Wisdom  |  UPX Compression Script « previous next »
Pages: [1]
Author Topic: UPX Compression Script  (Read 365 times)
CrYpTiC_MauleR
Site Builder

Offline Offline

Posts: 489



WWW
« on: December 30, 2006, 01:27:10 PM »

Code
Language: php (GeSHi-highlighted)
<?php
/*
* Copyright (C) 2007 CrYpTiC MauleR <http://www.expertsrt.net/images/cm_email.gif>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*/

 
/*
Download UPX : http://upx.sourceforge.net/
Copy upx.exe to the Windows system32 folder
 
NOTE : ONLY run on local/dedicated server and not on critical or shared server.
The recursion and compressing may cause server to respond slowly. Also prior to
running make the following PHP directives higher so script has adequate time and
memory to perform operations without prematurely ending. Values depend on amount
of files to be processed. Following are values I used on my system.
 
max_execution_time = 3600 ; Maximum execution time of each script, in seconds
memory_limit = 50M         ; Maximum amount of memory a script may consume (8MB)
*/

 
define('COMMANDS', ' --brute '); /* Try It All */
define('DIRECTORY', 'C:/MY_APPLICATIONS');
 
function recurse($path)
{
   $handle = @ dir($path);
   if ($handle)
   {
       while (false !== ($item = $handle->read()))
       {
           if ('.' !== $item[0])
           {
               $full = $path . '/' . $item;
               if ((is_file($full)) && (preg_match('/\.(dll|exe)$/i', $item)))
               {
                   exec('upx' . COMMANDS . $full);
                   echo $full . "\n";
                   ob_flush();
                   flush();
               }
               else if (is_dir($full))
               {
                   recurse($full);
               }
           }
       }
       $handle->close();
   }
}
 
header('Content-Type: text/plain');
echo "Packing...\n";
recurse(DIRECTORY);
echo 'complete!';
 
?>

« Last Edit: May 31, 2007, 12:08:38 PM by CrYpTiC_MauleR » Logged

[x] Fight | www.crypticmauler.com
"You must be
Pages: [1]
« previous next »
    Jump to: