Offensive and defensive world XCTF: web2

Figure IFigure II
Topic ideas have made it very clear

Source:

<?php
$miwen="a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws";

function encode($str){
    $_o=strrev($str);
    // echo $_o;
        
    for($_0=0;$_0<strlen($_o);$_0++){
       
        $_c=substr($_o,$_0,1);
        $__=ord($_c)+1;
        $_c=chr($__);
        $_=$_.$_c;   
    } 
    return str_rot13(strrev(base64_encode($_)));
}

highlight_file(__FILE__);
/*
   逆向加密算法,解密$miwen就是flag
*/
?> 

Those variables in the source code name looked very uncomfortable, we change it a little

Reverse decrypted code

<?php 
function decode($str){
   $string='';
   $str=base64_decode(strrev(str_rot13($str)));
   $strrev=strrev($str);
   for ($i=0; $i < strlen($strrev); $i++) { 
   	    $char=substr($strrev,$i,1);  
        $ordchar=ord($char)-1;  
        $char=chr($ordchar);  
        $string=$string.$char;
   }
   return $string;
}
$string='a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws';
echo decode($string);
 ?>

Figure III

Published 38 original articles · won praise 3 · Views 1947

Guess you like

Origin blog.csdn.net/mochu7777777/article/details/104738529