mirror of https://gitlab.com/gpvkt/twitchtts.git
Check until results are in completed state
This commit is contained in:
parent
54ecaea5b0
commit
60749f6828
27
build.py
27
build.py
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
import requests
|
import requests
|
||||||
|
@ -19,19 +20,28 @@ apikey = cfg['virustotal']
|
||||||
|
|
||||||
PyInstaller.__main__.run(['tts.py', '--onefile',])
|
PyInstaller.__main__.run(['tts.py', '--onefile',])
|
||||||
|
|
||||||
print("Uploading file", end="")
|
os.replace("./dist/tts.exe", "./tts.exe")
|
||||||
|
|
||||||
|
print("Uploading file")
|
||||||
api_endpoint = "https://www.virustotal.com/api/v3/files" # pylint: disable=invalid-name
|
api_endpoint = "https://www.virustotal.com/api/v3/files" # pylint: disable=invalid-name
|
||||||
headers = {
|
headers = {
|
||||||
"Accept": "application/json",
|
"Accept": "application/json",
|
||||||
"X-Apikey": apikey
|
"X-Apikey": apikey
|
||||||
}
|
}
|
||||||
files = {"file": open("./dist/tts.exe", "rb")}
|
files = {"file": open("./tts.exe", "rb")}
|
||||||
req = requests.post(api_endpoint, headers=headers, files=files)
|
req = requests.post(api_endpoint, headers=headers, files=files)
|
||||||
print(" [OK]")
|
print(" [OK]")
|
||||||
|
|
||||||
print("Waiting for results", end="")
|
data = {}
|
||||||
time.sleep(30)
|
data['data'] = {}
|
||||||
print(" [OK]")
|
data['data']['attributes'] = {}
|
||||||
|
data['data']['attributes']['status'] = "incomplete"
|
||||||
|
|
||||||
|
print("Waiting for results")
|
||||||
|
while data['data']['attributes']['status'] != "completed":
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
print( "[CHK]")
|
||||||
data = req.json()
|
data = req.json()
|
||||||
api_endpoint = f"https://www.virustotal.com/api/v3/analyses/{data['data']['id']}"
|
api_endpoint = f"https://www.virustotal.com/api/v3/analyses/{data['data']['id']}"
|
||||||
headers = {
|
headers = {
|
||||||
|
@ -40,13 +50,18 @@ headers = {
|
||||||
req = requests.get(api_endpoint, headers=headers)
|
req = requests.get(api_endpoint, headers=headers)
|
||||||
data = req.json()
|
data = req.json()
|
||||||
|
|
||||||
|
print(" [OK]")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pprint(data['data']['attributes']['results']['Microsoft'])
|
pprint(data['data']['attributes']['results']['Microsoft'])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
pprint(data['data']['attributes']['stats'])
|
pprint(data['data']['attributes']['stats'])
|
||||||
print(data['data']['attributes']['status'])
|
|
||||||
print("https://www.virustotal.com/gui/file/"+str(data['meta']['file_info']['sha256']))
|
print("https://www.virustotal.com/gui/file/"+str(data['meta']['file_info']['sha256']))
|
||||||
|
|
||||||
|
try:
|
||||||
if data['data']['attributes']['results']['Microsoft']['category'] != "undetected":
|
if data['data']['attributes']['results']['Microsoft']['category'] != "undetected":
|
||||||
print('FILE WILL BE DETECTED AS MALICIOUS. PLEASE RECOMPILE!')
|
print('FILE WILL BE DETECTED AS MALICIOUS. PLEASE RECOMPILE!')
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in New Issue