攻防世界 Get_shell

📅9/1/2021, 12:00:00 AM

题目

题目来源: 暂无

题目描述:运行就能拿到shell呢,真的

场景:IP:port

审题

作为第一道 PWN 题,应该不会很难。这道题给了场景,应该是通过 nc 连接,然后运行。

题解

nc

nc IP port
cat ./flag

nclib

import nclib


def main():
    nc = nclib.Netcat(connect=('IP', port))
    nc.send_line('cat ./flag')
    print(nc.recv().decode())


if __name__ == '__main__':
    main()

pwntool

from pwn import *


def main():
    io = remote('IP', port)
    io.sendline(b'cat ./flag')
    print(io.recv().decode())


if __name__ == '__main__':
    main()

总结

通过本题练习 netcat 的用法,学习使用具有 netcat 功能的 Python 库。

  • nc
  • nclib
  • pwntools

This 

post

 by Yingjie Shang is licensed under 

CC BY 4.0