17.NSCTF web200

Source: Internet
Author: User
Tags base64



This problem is not easy, direct programming can



650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/9D/61/wKioL1l_JJ7DEhckAAFY4a6JWTw767.png-wh_500x0-wm_ 3-wmp_4-s_1506074675.png "title=" 1.png "alt=" Wkiol1l_jj7dehckaafy4a6jwtw767.png-wh_50 "/>



I'm just pasting my Python code in.





#!/usr/bin/python
#coding=utf-8

Import base64

#ror13Encryption function (ciphertext incoming is decryption, plaintext incoming is encryption)
Def rot13(s, OffSet=13):
    Def encodeCh(ch):
        f=lambda x: chr((ord(ch)-x+OffSet) % 26 + x)
        Return f(97) if ch.islower() else (f(65) if ch.isupper() else ch)
    Return ‘‘.join(encodeCh(c) for c in s)

Def decode(strs):
    Flag = ""#Save flag
    Flag_x = ""#Get every character in the flag
    
    Strs = strs[::-1]#reverse string
    
    Strs = base64.b64decode(strs)#base64 decoding
    
    For i in strs:# traverse every character
        
        Flag_x = ord(i)-1#Each character ascii code-1
        Flag_x = chr(flag_x)#convert bit string
        Flag = flag+flag_x#string connection
        
    Flag = flag[::-1]#reverse the string
    Return flag# get flag

Def main():
    Strs = "a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws"# password to be cracked
    Flag = rot13(strs)#rot13decrypt
    Flag = decode(flag)#title decryption
    Print flag#output flag

If __name__ == "__main__":
    Main()  

Note: Where ROT13 is the code to find online



The results are as follows:



650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/9D/62/wKioL1l_JhyiCL4mAADHoJ4wUuU539.png-wh_500x0-wm_ 3-wmp_4-s_3269146024.png "title=" 2.png "alt=" Wkiol1l_jhyicl4maadhoj4wuuu539.png-wh_50 "/>



This article is from the "11846238" blog, please be sure to keep this source http://11856238.blog.51cto.com/11846238/1952480



17.NSCTF web200


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.