IWBH_01

haandy haak assist (hide javascript in image file)

Jun 8th, 2021 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.44 KB | None | 0 0
  1. <?php
  2. //note: only works if you can change the image file mimetype to text/html;
  3. //send me a message if you like this code
  4.  
  5. function gp_c($img, $id1){
  6.     $pos=strpos($img, $id1);
  7.     $o1="";
  8.     if($pos)
  9.         $o1=substr($img, $pos+4, ord($img[$pos-1])+(ord($img[$pos-2])*256)+(ord($img[$pos-3])*65536)+(ord($img[$pos-4])*16777216));
  10.     return $o1;
  11. }
  12.  
  13. function int2_4chr($N){
  14.     if($N > 4294967295)
  15.     return "\xff\xff\xff\xff";
  16.     $chr0=floor($N/16777216);
  17.     $mun=$N-($chr0*16777216);
  18.     $chr1=floor($mun/65536);
  19.     $mun-=($chr1*65536);
  20.     $chr2=floor($mun/256);
  21.     return chr($chr0).chr($chr1).chr($chr2).chr($mun-($chr2*256));
  22. }
  23.  
  24. $IEND_r="\x82\x60B\xAEDNEI\x00\x00\x00\x00";
  25.  
  26. if(isset($_POST["txt"])){
  27.     $img1=base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAIAAABLMMCEAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABESURBVBhXY/gPAT8b/n9iAJFgwPD/z34QHxn92Q9lAQGcBDEgFBqCUptXMby6ByJhomB7Pj1nOLgDRIJEfzZgs+3PfgDFYGK3vJzbHAAAAABJRU5ErkJggg==");
  28.     $d03i=$_POST["txt"];
  29.     $d03l=strlen($d03i);
  30.     if($d03l < 120001){
  31.     $d03=int2_4chr($d03l)."ItXt".$d03i.int2_4chr(crc32("ItXt".$d03i));
  32.     $IDp=strpos($img1, "IDAT")-4;
  33.     $d04=substr($img1, 0, $IDp).$d03.substr($img1, $IDp);
  34.  
  35.         echo ('image file data in base64: "'.base64_encode($d04).'"<br>');
  36. }
  37.  
  38. }
  39.  
  40. echo '<br><form method="post"><textarea name="txt" ></textarea><br><input type="submit" value="create file"></form>';
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. ?>
Add Comment
Please, Sign In to add comment