日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

CTFshow-萌新赛逆向_签退

發布時間:2023/12/13 综合教程 41 生活家
生活随笔 收集整理的這篇文章主要介紹了 CTFshow-萌新赛逆向_签退 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

查看題目信息

下載re3.pyc文件

使用uncompyle把re3.pyc反編譯為re3.py

uncompyle6 re3.pyc > re3.py

查看re3.py文件

# uncompyle6 version 3.6.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: re3.py
# Compiled at: 2020-03-06 17:43:28
import string
c_charset = string.ascii_uppercase + string.ascii_lowercase + string.digits + '()'
flag = 'BozjB3vlZ3ThBn9bZ2jhOH93ZaH9'    #這個是最后輸出的密文

def encode(origin_bytes):    #這個函數是base64加密
    c_bytes = [ ('{:0>8}').format(str(bin(b)).replace('0b', '')) for b in origin_bytes ]
    resp = ''
    nums = len(c_bytes) // 3
    remain = len(c_bytes) % 3
    integral_part = c_bytes[0:3 * nums]
    while integral_part:
        tmp_unit = ('').join(integral_part[0:3])
        tmp_unit = [ int(tmp_unit[x:x + 6], 2) for x in [0, 6, 12, 18] ]
        resp += ('').join([ c_charset[i] for i in tmp_unit ])
        integral_part = integral_part[3:]

    if remain:
        remain_part = ('').join(c_bytes[3 * nums:]) + (3 - remain) * '0' * 8
        tmp_unit = [ int(remain_part[x:x + 6], 2) for x in [0, 6, 12, 18] ][:remain + 1]
        resp += ('').join([ c_charset[i] for i in tmp_unit ]) + (3 - remain) * '.'
    return rend(resp)    #這個代碼說明先進行base64加密,然后進行凱撒加密


def rend(s):

    def encodeCh(ch):    #這個函數是凱撒加密
        f = lambda x: chr((ord(ch) - x + 2) % 26 + x)
        if ch.islower():
            return f(97)
        if ch.isupper():
            return f(65)
        return ch

    return ('').join(encodeCh(c) for c in s)
# okay decompiling re3.pyc

文件分析在如上

首先使用凱撒密碼進行解密

把解密后的密文寫入base.txt文件中

使用腳本進行解密

成功拿到flag

附上解密腳本

#! /usr/bin/env python
# _*_  coding:utf-8 _*_
import base64


filename = "base64.txt"
f = open(filename,'r')
while True:
    text_base =f.readline()
    if not text_base:
        break
    else:
        text_str = str(base64.b64decode(text_base))
        if "flag" in text_str:
            text_str =text_str.replace("'","").replace("b","")
            print(text_str)

總結

以上是生活随笔為你收集整理的CTFshow-萌新赛逆向_签退的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。