Created
July 27, 2018 22:30
-
-
Save rshipp/6ef2ed556e32fc9c666fbb1ece8b7b81 to your computer and use it in GitHub Desktop.
Example VMRay usage for https://github.com/InQuest/python-sandboxapi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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