Can't create process in pwntools

Rincewind picture Rincewind · Jan 11, 2018 · Viewed 7.5k times · Source

I am trying to use python's pwntools. I want to start a process using

from pwn import *
s = process('./step1')

When I do this I receive the following error message:

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/pwnlib/tubes/process.py", line 267, in init stdin, stdout, stderr, master, slave = self._handles(*handles) File "/usr/local/lib/python2.7/dist-packages/pwnlib/tubes/process.py", line 603, in _handles tty.setraw(master) File "/usr/lib/python2.7/tty.py", line 28, in setraw tcsetattr(fd, when, mode) termios.error: (22, 'Invalid argument')

I am already in the directory that contains the file step1 and step1 is executable. Does anyone have an idea why I get this error. If it helps, I am using the Linux subsystem on Windows 10.

Answer

SamudNeb picture SamudNeb · Apr 25, 2018

Check out this link. process() needs its first argument as a list of program arguments. So

$ ./step1 arg1 arg2

is equivalent to

p = process(['step1', 'arg1', 'arg2'])