Fix permissions during repack

This commit is contained in:
Oleksii Shevchuk 2016-10-09 00:13:54 +03:00
parent 085887488c
commit 5c2c73a622
1 changed files with 7 additions and 0 deletions

View File

@ -17,6 +17,7 @@ from modules.lib.windows.powershell_upload import obfuscatePowershellScript
import scriptlets
import cPickle
import base64
import os
ROOT=os.path.abspath(os.path.join(os.path.dirname(__file__)))
@ -160,6 +161,12 @@ def updateTar(arcpath, arcname, file_path):
with tarfile.open(arcpath, 'r') as tfr:
names=tfr.getnames()
tfr.extractall(tempdir)
for root, dirs, files in os.walk(tempdir):
for dir in dirs:
os.chmod(os.path.join(root, dir), 0700)
for file in files:
os.chmod(os.path.join(root, file), 0600)
with tarfile.open(arcpath+"2", 'w:gz') as tfw:
for n in names:
#print "adding %s"%n