INNER CODE UNIT · Python
execute_command_arr
fyoorer/ShadowClone · shadowclone.py:149
def execute_command_arr(input_data, command, nosplit, bucket_name, scan_id, storage):
from invoke import run
import uuid
import os
if not command: #hopefully we never go into this
return "LITHOPS ERROR! Command was not received by the cloud function! Re-run the same command."
with open('/tmp/infile','w') as infile:
infile.write('\n'.join(map(str, input_data)))
output_file_rnd = str(uuid.uuid4())
outfile = "/tmp/"+output_file_rnd
command = command.replace('{INPUT}', '/tmp/infile')
command = command.replace('{OUTPUT}', outfile)
#go into this only when a nosplit file is provided
if nosplit:
# bucket_name = nosplit.split('/')[0]