yingjie@memoir
Skip to content

Problem

Source: None

Description: Running it will give you a shell, seriously

Scenario: IP:port

Analysis

As the first PWN challenge, it shouldn't be too difficult. The challenge provides a scenario, so we should connect via nc and run it.

Solution

nc

bash
nc IP port
cat ./flag

nclib

python
import nclib


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


if __name__ == '__main__':
    main()

pwntools

python
from pwn import *


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


if __name__ == '__main__':
    main()

Summary

This challenge practices the usage of netcat and introduces Python libraries that provide netcat functionality.

  • nc
  • nclib
  • pwntools