Skip to content

Instantly share code, notes, and snippets.

@rshipp
Created July 27, 2018 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rshipp/6ef2ed556e32fc9c666fbb1ece8b7b81 to your computer and use it in GitHub Desktop.
Save rshipp/6ef2ed556e32fc9c666fbb1ece8b7b81 to your computer and use it in GitHub Desktop.
import sys
import time
import pprint
from sandboxapi import vmray
# connect to the sandbox
sandbox = vmray.VMRayAPI('MY_KEY')
# verify connectivity
if not sandbox.is_available():
print("sandbox is down, exiting")
sys.exit(1)
# submit a file
with open('myfile.exe', "rb") as handle:
file_id = sandbox.analyze(handle, 'myfile.exe')
print("file {f} submitted for analysis, id {i}".format(f=filename, i=file_id))
# wait for the analysis to complete
while not sandbox.check(file_id):
print("not done yet, sleeping 10 seconds...")
time.sleep(10)
# print the report
print("analysis complete. fetching report...")
report = sandbox.report(file_id)
pprint.pprint(report)
print("Score: {score}".format(score=sandbox.score(report)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment