#1
  1. No Profile Picture
    Super Moderator
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,414
    Rep Power
    24

    base64_decode() failing?


    To start, ViMP is a multimedia portal offered to the community. The vimp.bin file is their newer "setup" file to be ran from the *nix command line. The first half is written in PHP, while the remainder is base64_encode() holding the rest, and the line aiming to decode such is where my error is..

    I am helping an individual, and most all my tests have worked fine to work around this, but if I attempt the setup normally, ./vimp.bin will pause for a second as it starts, then return to the bash line. I added a few lines into vimp.bin to see where the true fail is, and it is on the line that reads:
    PHP Code:
    file_put_contents($tempDir.'/sfx_archive.tar.gz'base64_decode(stream_get_contents($fp)));
    // 
    This is the first individual I've helped w/ such an issue, so it's probably his system, but I was wondering if you had any ideas. Even if I run the following script, the myText1.txt is successfully created in the temp directory, which excludes any reason for security/permissions, but I still ran chmod 777 anyway to be safe. The command var_dump(stream_get_contents($fp)); will successfully start printing out all the encoded lines, so we are now sure that we can write to the destination AND successfully open/read the vimp.bin file. Yet, it seems something failing when adding base64_decode(). I am wondering if it has something to do w/ linebreaks, but am doubting it, so far. Any thought?

    PHP Code:
     $content "some text here";
     
    $fp1 fopen($tempDir "/myText1.txt","wb");
     
    fwrite($fp1,$content);
     
    fclose($fp1);
     echo 
    "Successfully wrote a file to temp dir.\n";
     
    $fp fopen(__FILE__'rb');
     
    fseek($fp__COMPILER_HALT_OFFSET__ 1);
     
    //var_dump(base64_decode(stream_get_contents($fp)));
     
    file_put_contents($tempDir.'/sfx_archive.tar.gz'base64_decode(stream_get_contents($fp)));
     
    fclose($fp);
     echo 
    "file_put_contents: Succeeds!\n"// I never make it this far. 
    Last edited by Triple_Nothing; April 23rd, 2014 at 03:32 PM.
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  2. #2
  3. No Profile Picture
    Super Moderator
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,414
    Rep Power
    24
    Couldn't get any errors for a bit, but once I finally got one, it was merely a memory_limit being set too low.
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  4. #3
  5. Forgotten Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,042
    Rep Power
    9616
    If the data is too large then you'll hit a memory limit for sure.

    I believe you can have some fun with filters to do this in a way to avoid holding the whole thing in memory.
    PHP Code:
    $fp fopen(__FILE__'rb'); 
    fseek($fp__COMPILER_HALT_OFFSET__ 1);
    stream_filter_append($fp'convert.base64-decode');
    //var_dump(base64_decode(stream_get_contents($fp))); 
    $fp2 fopen($tempDir.'/sfx_archive.tar.gz''wb');
    stream_copy_to_stream($fp$fp2);
    fclose($fp2);
    fclose($fp); 

    Comments on this post

    • Triple_Nothing agrees : Perfect!
  6. #4
  7. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,885
    Rep Power
    6354
    Are you trying to install this script, or are you trying to break their encryption and get to the source code?
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  8. #5
  9. No Profile Picture
    Super Moderator
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,414
    Rep Power
    24
    I would LOVE to break the encryption, since Sourceguardian seems to make the site run a lot slower, but no clue how to do such. Just helping peeps install it on Windows which they do not support. So the 2 options I mentioned on their forums were to make sure memory_limit was high enough, or perhaps edit their install as requinix mentioned.
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  10. #6
  11. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,885
    Rep Power
    6354
    well breaking their encryption is likely very illegal, so you won't get help with that here.

    Requinix's solution seems like it will work. Maybe there's a command line tool specifically for decoding base64.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  12. #7
  13. No Profile Picture
    Super Moderator
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,414
    Rep Power
    24
    Well, the issue has been solved. It had nothing to do w/ decrypting the code. It was merely the error/cancel that happened when the installer got to that point since not enough memory was offered.
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.

IMN logo majestic logo threadwatch logo seochat tools logo