Jordimario

Houseplant CTF:"Satan's Jigsaw" Soultion

Apr 26th, 2020
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. <?php
  2. #Oh no! I dropped my pixels on the floor and they're all muddled up! It's going to take me years to sort all 90,000 of these again :(
  3. #https://houseplant.riceteacatpanda.wtf/download?file_key=84f748f5ebe7c8d00c7bc50f4c71f7be0cce3be169f1cbc985d7c30d39f5b1cf&team_key=79605a1b652a12dacc5c2a56766eefe3d442b962865b4265744bc66ad2c37d22
  4. $arrayEntry=array();                #Image Array
  5. if ($handle = opendir('<DIRECTORY>')) { #open the puzzle Dir
  6.  
  7.     while (false !== ($entry = readdir($handle))) {
  8.  
  9.         if ($entry != "." && $entry != ".." && $entry != ".DS_Store") {
  10.  
  11.             array_push($arrayEntry,$entry); #put alle the images in the array
  12.        }
  13.     }
  14.  
  15.     closedir($handle);
  16. }
  17.  
  18. ?>
  19.  
  20.  
  21.   <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.js"> </script><!--Import p5* Library-->
  22.   <script>
  23.     function setup(){
  24.         //convert PHP array into JS Array
  25.         imageArr="<?php echo implode(",",$arrayEntry)?>" //turn the PHParray into string
  26.         imageArr=imageArr.split(",")//turn the string into a JSarray
  27.         var canvas = createCanvas(1000, 1000); //Create p5* canvas
  28.         noSmooth()                              //remove anti-aliasing
  29.        
  30.  
  31.         let i=0;//image Count
  32.         for(let r=0;r<450;r++){//row
  33.         for(let c=0;c<200;c++){//column
  34.             loadImage("<DIRECTORY>/"+imageArr[i],img=>{image(img, c, r)});i++;  //load the image and when ready print the image with a callback
  35.         }
  36.     }
  37. }
  38.   </script>
Add Comment
Please, Sign In to add comment