File: listen_uroboros.py

package info (click to toggle)
pwntools 4.14.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 18,436 kB
  • sloc: python: 59,156; ansic: 48,063; asm: 45,030; sh: 396; makefile: 256
file content (14 lines) | stat: -rw-r--r-- 343 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"""
An example showing interconnection of sockets.  This script will wait for three
connections on port 1337, then connect them like a three-way Uroboros.
"""

from pwn import *

cs = [listen(1337).wait_for_connection() for _ in range(3)]

cs[0] << cs[1] << cs[2] << cs[0]

cs[0].wait_for_close()
cs[1].wait_for_close()
cs[2].wait_for_close()