pwn.college Program Misuse dojo.
env -i hello
import subprocess
subprocess.run(['/challenge/embryoio_level16'])
import sys
import subprocess
with open('/tmp/qymjzu', 'r') as infile:
subprocess.Popen(['/challenge/embryoio_level19'],
stdin=infile, stdout=sys.stdout, stderr=sys.stderr)
import sys
import subprocess
with open('/tmp/qymjzu', 'w+') as outfile:
subprocess.Popen(['/challenge/embryoio_level19'],
stdin=sys.stdin, stdout=outfile, stderr=sys.stderr)
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
void pwncollege(int argc, char *argv[])
{
pid_t pid = fork();
if (pid == -1)
{
perror("Failed to fork");
}
else if (pid > 0)
{
// We are the parent
int status;
waitpid(pid, &status, 0);
}
else
{
execve("/challenge/embryoio_level31", &argv[1], NULL);
_exit(EXIT_FAILURE); // exec never returns
}
}
void main(int argc, char *argv[])
{
pwncollege(argc, argv);
}
import subprocess
p2 = subprocess.Popen(['grep', 'pwn'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
p1 = subprocess.Popen(['/challenge/embryoio_level49'], stdin=subprocess.PIPE, stdout=p2.stdin)
p2.communicate()
sed -n '/pwn/p'