Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. Index: /home/xazax/Programming/DiffGen/xDiffGen/Core/RObin.class.php
  2. ===================================================================
  3. --- /home/xazax/Programming/DiffGen/xDiffGen/Core/RObin.class.php   (revision 379)
  4. +++ /home/xazax/Programming/DiffGen/xDiffGen/Core/RObin.class.php   (working copy)
  5. @@ -67,12 +67,15 @@
  6.         $this->patch_callback = $callback;
  7.  
  8.     }
  9.  
  10.    
  11.  
  12. -   protected function Patch($offset, $value) {
  13.  
  14. +   protected function Patch($offset, $value, $doit=false) {
  15.  
  16.         if( !is_null($this->patch_callback) )
  17.  
  18.             call_user_func($this->patch_callback, $offset, $value);
  19.  
  20. -       $length = strlen($value);
  21.  
  22. -       for($i = 0; $i < $length; $i++)
  23.  
  24. -           $this->exe[$offset + $i] = $value[$i];
  25.  
  26. +       if ( $doit )
  27.  
  28. +       {
  29.  
  30. +           $length = strlen($value);
  31.  
  32. +           for($i = 0; $i < $length; $i++)
  33.  
  34. +               $this->exe[$offset + $i] = $value[$i];
  35.  
  36. +       }
  37.  
  38.     }
  39.  
  40.    
  41.  
  42.     // Locates the PE header
  43.  
  44. @@ -236,10 +239,10 @@
  45.     // replace(400, array(4 => "\x00", 2 => "\xAB"))
  46.  
  47.     // Replaces the byte at 404 (400 + 4) with a null (x00) byte;
  48.  
  49.     // Replaces the byte at 402 (400 + 2) with a xAB byte.
  50.  
  51. -   public function replace($offset, $replace)
  52.  
  53. +   public function replace($offset, $replace, $doit=false)
  54.  
  55.     {
  56.  
  57.         foreach ($replace as $pos => $value) {
  58.  
  59. -           $this->Patch($offset + $pos, $value);
  60.  
  61. +           $this->Patch($offset + $pos, $value, $doit);
  62.  
  63.         }
  64.  
  65.         return true;
  66.  
  67.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement