Commit 43a7a5a9 by Chris Church Committed by Matt Martz

Collapse extra whitespace in encoded powershell scripts.

parent df8866b8
...@@ -46,6 +46,7 @@ def _escape(value, include_vars=False): ...@@ -46,6 +46,7 @@ def _escape(value, include_vars=False):
def _encode_script(script, as_list=False): def _encode_script(script, as_list=False):
'''Convert a PowerShell script to a single base64-encoded command.''' '''Convert a PowerShell script to a single base64-encoded command.'''
script = '\n'.join([x.strip() for x in script.splitlines() if x.strip()])
encoded_script = base64.b64encode(script.encode('utf-16-le')) encoded_script = base64.b64encode(script.encode('utf-16-le'))
cmd_parts = _common_args + ['-EncodedCommand', encoded_script] cmd_parts = _common_args + ['-EncodedCommand', encoded_script]
if as_list: if as_list:
......
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