Commit 8c0f69b0 authored by Anze Vavpetic's avatar Anze Vavpetic

removed file

parent 8b64c610
import pwd
import os
import shutil
import tempfile
import stat
import subprocess
jail_dir = tempfile.mkdtemp()
os.chmod(jail_dir, stat.S_IRUSR | stat.S_IWUSR)#etc
#we use several other permission bits here.
#c.f. best practices article
jail_etc = os.path.abspath(os.path.join(jail_dir, "etc"))
shutil.copy('/etc/resolv.conf', jail_etc)
for required_dir in ['/usr/bin/']:
#use mount -r --bind as a convenient way of giving read-only access
#to other folders (libraries, etc) required by the jailed process
mount_point = "%s%s" % (jail_dir, required_dir)
os.makedirs(mount_point)["sudo", "mount", "-r", "--bind", required_dir, mount_point])
nobody_user = pwd.getpwnam("nobody").pw_uid
p = subprocess.Popen(['python', ''])
stdout_str, stderr_str = p.communicate()
print stdout_str
print stderr_str
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment