From 5c2c73a622cbbdb568c8458b9dcf8c91506b385c Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Sun, 9 Oct 2016 00:13:54 +0300 Subject: [PATCH] Fix permissions during repack --- pupy/pupygen.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pupy/pupygen.py b/pupy/pupygen.py index ba813bb7..8038a1da 100755 --- a/pupy/pupygen.py +++ b/pupy/pupygen.py @@ -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