Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion google-cloud-functions/google_cloud_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import shlex
import subprocess
import base64
import hashlib

# Set environment flag of MAX_EXECUTABLE, MAX_DATA_SIZE

Expand Down Expand Up @@ -66,7 +67,8 @@ def execute(request):
except ValueError:
return bad_request("Timeout format invalid")

path = "/tmp/execute.sh"
hash = hashlib.sha256(executable).hexdigest().upper()
path = f"/tmp/{hash}.sh"
with open(path, "w") as f:
f.write(executable.decode())

Expand Down
4 changes: 3 additions & 1 deletion lambda/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import shlex
import base64
import subprocess
import hashlib

HEADERS = {
"content-type": "application/json",
Expand Down Expand Up @@ -75,7 +76,8 @@ def lambda_handler(event, context):
except ValueError:
return bad_request("Timeout format invalid")

path = "/tmp/execute.sh"
hash = hashlib.sha256(executable).hexdigest().upper()
path = f"/tmp/{hash}.sh"
with open(path, "w") as f:
f.write(executable.decode())

Expand Down