SHARE
TWEET

Untitled

a guest Jun 25th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. require_once "config.php";
  4. global $_CONFIG;
  5.  
  6. $files=scandir($_CONFIG['dir']);
  7. $files = array_filter($files, function ($file) {
  8.     if(in_array($file,['.','..'],true)){
  9.         return false;
  10.     }
  11.     if (!in_array(pathinfo($file,PATHINFO_EXTENSION),['exe','exx'],true)){
  12.         return false;
  13.     }
  14.     global $_CONFIG;
  15.     $desc = "{$_CONFIG['txt.dir']}/{$file}.txt";
  16.  
  17.     return file_exists($desc);
  18. });
  19. $random=fopen('/dev/urandom','r');
  20. foreach ($files as $exe) {
  21.     $file = "{$_CONFIG['dir']}/{$exe}";
  22.     $desc = "{$_CONFIG['txt.dir']}/{$exe}.txt";
  23.     $bytesHex = isset($_CONFIG['bytes.dir'])?"{$_CONFIG['bytes.dir']}/{$exe}.bytes.txt":false;
  24.     if (!file_exists($desc)) {
  25.         continue;
  26.     }
  27.     $offsetS = trim(file_get_contents($desc));
  28.     if($offsetS !== ((string)($offset=intval($offsetS, 10)))){
  29.         continue;
  30.     }
  31.  
  32.     $f=fopen($file,'r+');
  33.     fseek($f, $offset);
  34.     $bytes=fread($random,4);
  35.     fwrite($f,$bytes,4);
  36.     if($bytesHex){
  37.         file_put_contents($bytesHex, trim(preg_replace('@(\w\w)@', '0x$1, ', strtoupper(bin2hex($bytes))), ', '));
  38.     }
  39.     fclose($f);
  40. }
  41. fclose($random);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top