查看题目信息

下载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)

最新文章

  1. 我的MYSQL学习心得(五) 运算符
  2. MySQL SQL 注入
  3. my_strcmp()
  4. ZooKeeper分布式集群安装
  5. mysql 索引- 笔记
  6. 使用bcrypt进行用户密码加密的简单实现
  7. NOI2002 银河英雄传说
  8. hdu 2819 Swap
  9. 【HDOJ】5288 OO’s Sequence
  10. ORACLE 解析xml字符串-转载的
  11. Javascript跨域请求的几种解决方法
  12. ubuntu 安装输入法(fcitx)
  13. sublime C++ build system配置体验
  14. Jungle Roads(kruskar)
  15. 使用Rotativa在ASP.NET Core MVC中创建PDF
  16. Joone
  17. error: not found: value sqlContext/import sqlContext.implicits._/error: not found: value sqlContext /import sqlContext.sql/Caused by: java.net.ConnectException: Connection refused
  18. oracle删除dbf导致的oracle工具不能正常使用
  19. [转]Building a REST-Backend for Angular with Node.js & Express
  20. Spring MVC异常统一处理的三种方式

热门文章

  1. 2020-2021-1 20209307 《Linux内核原理与分析》第二周作业
  2. selenium IDE使用-1
  3. html 08-HTML5详解(二)
  4. [日常摸鱼]POJ2187 BeautyContest-旋转卡壳
  5. 2020年“感恩杯”台州学院第十三届大学生程序设计竞赛D、H、I题解(后续补充)
  6. MySQL高可用(二)主备延时如何解决?
  7. Kubernetes应用管理器OpenKruise之CloneSet
  8. js 点击input焦点不弹出键盘 PDA扫描枪
  9. spring mvc 集成quartz
  10. JavaDailyReports10_12