import commands crafted_path = '\x81" ; python -c \'import this\' | grep . | shuf | head -n1 | cowsay -y ; \x81"' for path in '/dev/null', crafted_path: print(commands.getstatus(path))