Last active
May 4, 2021 12:42
-
-
Save neriberto/d12eae89042d93e1883363aa571d4838 to your computer and use it in GitHub Desktop.
simple VT Upload
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 os | |
import sys | |
import time | |
import requests | |
VT_API_KEY = "API_KEY_GOES_HERE" | |
VT_URL = "https://www.virustotal.com/api/v3/files" | |
def upload_vt(filePath): | |
r = requests.post( | |
VT_URL, | |
headers={'x-apikey': VT_API_KEY}, | |
files={'file': open(filePath,'rb')} | |
) | |
print(f"Virustotal response: {r.text} ") | |
def search_dir(rootdir): | |
for root, subFolders, files in os.walk(rootdir): | |
for arq in files: | |
filePath = os.path.join(root, arq) | |
print(f"Upload file: {filePath}") | |
upload_vt(filePath) | |
time.sleep(30) | |
if __name__ == "__main__": | |
rootdir = sys.argv[1] | |
search_dir(rootdir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment