源码

<?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 
*/ 
?> 

分析

源码:反转字符-每位字符加一-base64-字符反转-rot13
解码:rot13-字符反转-base64-每位字符减一-字符反转

脚本

import base64

def Upper(ch):
    if ch>='A' and ch<='Z':
        return True
def Lower(ch):
    if ch>='a' and ch<='z':
        return True
def rot13(s):
    flag = ''
    for i in s:
        if Upper(i) == True:
             if i>='A' and i<='M':
                 flag += chr(ord(i)+13)
             else:
                 flag += chr(ord(i)-13)
        elif Lower(i) == True:
             if i>='a' and i<='m':
                 flag += chr(ord(i)+13)
             else:
                 flag += chr(ord(i)-13)
        else:
             flag += i
    return flag

flag = "a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws"
flag = list(rot13(flag))
flag.reverse()
flag = ''.join(i for i in flag)
flag = base64.b64decode(flag)
flag = list(flag)
strs = ""
for i in range(0,len(flag)):
    strs += chr(ord(flag[i]) -1)
strs = list(strs)
strs.reverse()
print ''.join(i for i in strs)


web      web

本博客所有文章除特别声明外,均采用 CC BY-SA 3.0协议 。转载请注明出处!