zoukankan      html  css  js  c++  java
  • [攻防世界

    python在线反编译把.pyc反编译为伪代码

    #!/usr/bin/env python
    # visit https://tool.lu/pyc/ for more information
    import base64
    
    def encode(message):
        s = ''
        for i in message:
            x = ord(i) ^ 32
            x = x + 16
            s += chr(x)
        
        return base64.b64encode(s)
    
    correct = 'XlNkVmtUI1MgXWBZXCFeKY+AaXNt'
    flag = ''
    print 'Input flag:'
    flag = raw_input()
    if encode(flag) == correct:
        print 'correct'
    else:
        print 'wrong'
    

    观察得知,调用encode函数对输入的flag进行加密后,得到的密文应为correct, 即"XlNkVmtUI1MgXWBZXCFeKY+AaXNt"
    则可根据encode函数编写程序进行解密

    import base64
    
    s = 'XlNkVmtUI1MgXWBZXCFeKY+AaXNt'
    get_flag = ''
    dec = base64.b64decode(s)
    for i in dec:
        i = i - 16
        i = i ^ 32
        get_flag = get_flag + chr(i)
    print(get_flag)
    

    得到flag:

    nctf{d3c0mpil1n9_PyC}
    
  • 相关阅读:
    Document
    Document
    Document
    Document
    Document
    Document
    Document
    Document
    C#中的委托是什么
    C# Lambda表达式Contains方法 like
  • 原文地址:https://www.cnblogs.com/Here-is-SG/p/15196767.html
Copyright © 2011-2022 走看看