CTF-rootme 题解之 Python - PyJail 1

本文介绍了如何解决RootMe平台上的CTF挑战Python PyJail 1。通过ssh连接到服务器,利用Python的inspect模块获取exit函数的code对象,进一步揭示常量信息,最终获取到flag。
摘要由CSDN通过智能技术生成

Link:https://www.root-me.org/en/Challenges/App-Script/Python-PyJail-1

Reference:https://docs.python.org/2/library/inspect.html?highlight=func_code

Solution: 

[ BlackArch ~ ]# ssh -p 2222 app-script-ch8@challenge02.root-me.org
      _           _ _                        ___ ____  
  ___| |__   __ _| | | ___ _ __   __ _  ___ / _ \___ \
 / __| '_ \ / _` | | |/ _ \ '_ \ / _` |/ _ \ | | |__) |
| (__| | | | (_| | | |  __/ | | | (_| |  __/ |_| / __/
 \___|_| |_|\__,_|_|_|\___|_| |_|\__, |\___|\___/_____|
                                 |___/ root-me.org     

app-script-ch8@challenge02.root-me.org's password:
Permission denied, please try again.
app-script-ch8@challenge02.root-me.org's password:
Welcome to my Python sandbox! Everything is in exit() function (arg == get the flag!)
>>> print exit.func_code
<code object exit at 0xb7d87b60, file "/challenge/app-script/ch8/ch8.py", line 27>
>>> print exit.func_code.co_consts
(None, 'flag-WQ0dSFrab3LGADS1ypA1', -1, 'cat .passwd', 'You cannot escape !')
>>> exit(exit.func_code.co_consts[1])
Well done flag : YjHRUZEa9irCPS2llubR
Connection to challenge02.root-me.org closed.

28.13.1. Types and members

The

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值