From 70cedfafd704ca76f42293927c491828b94f4025 Mon Sep 17 00:00:00 2001 From: AlessandroZ Date: Wed, 13 Sep 2017 14:39:17 +0200 Subject: [PATCH] remove banner if one exists Former-commit-id: bba39c3bf8704918acfc591ad15ffff953ed470b [formerly bba39c3bf8704918acfc591ad15ffff953ed470b [formerly bba39c3bf8704918acfc591ad15ffff953ed470b [formerly 838e77fe2243f28232e4be903a60b53ecfff20e1]]] Former-commit-id: a3b325046d7d404351a02459c6ae8a7ac11e25c6 Former-commit-id: 30be7dfa97febaa7895bd122ccf0053005775bec Former-commit-id: 6201ac2b6e4709e1425e342f4da1426ce9ed37bf --- Windows/lazagne/config/powershell_execute.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Windows/lazagne/config/powershell_execute.py b/Windows/lazagne/config/powershell_execute.py index e831d273..254112c0 100755 --- a/Windows/lazagne/config/powershell_execute.py +++ b/Windows/lazagne/config/powershell_execute.py @@ -11,7 +11,7 @@ def powershell_execute(script, function): script = re.sub("Write-Error ","Write-Output ", script, flags=re.I) script = re.sub("Write-Warning ","Write-Output ", script, flags=re.I) - fullargs = ["powershell.exe", "-C", "-"] + fullargs = ["powershell.exe", "-NoProfile", "-NoLogo", "-C", "-"] info = subprocess.STARTUPINFO() info.dwFlags = sub.STARTF_USESHOWWINDOW @@ -35,15 +35,12 @@ def powershell_execute(script, function): p.stdin.write("Write-Host \"[BEGIN]\"\n") p.stdin.write("Write-Host $b\n") - while True: - # begin flag used to remove possible bullshit output print before the function is launched - if '[BEGIN]' in p.stdout.readline(): - # Get the result in base64 - for i in p.stdout.readline(): - output += i - break - - output = base64.b64decode(output) + # begin flag used to remove possible bullshit output print before the function is launched + if '[BEGIN]' in p.stdout.readline(): + # Get the result in base64 + for i in p.stdout.readline(): + output += i + output = base64.b64decode(output) except Exception, e: pass