mirror of https://gitlab.com/gpvkt/twitchtts.git
buildscript added
This commit is contained in:
parent
fa9f78d69f
commit
54ecaea5b0
|
@ -0,0 +1,52 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# pylint: disable=line-too-long,too-many-lines
|
||||||
|
|
||||||
|
""" buildscript """
|
||||||
|
|
||||||
|
from pprint import pprint
|
||||||
|
import time
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
import requests
|
||||||
|
|
||||||
|
import PyInstaller.__main__
|
||||||
|
|
||||||
|
with open("config.yml", "r", encoding="UTF-8") as ymlfile:
|
||||||
|
cfg = yaml.load(ymlfile, Loader=yaml.Loader)
|
||||||
|
|
||||||
|
apikey = cfg['virustotal']
|
||||||
|
|
||||||
|
PyInstaller.__main__.run(['tts.py', '--onefile',])
|
||||||
|
|
||||||
|
print("Uploading file", end="")
|
||||||
|
api_endpoint = "https://www.virustotal.com/api/v3/files" # pylint: disable=invalid-name
|
||||||
|
headers = {
|
||||||
|
"Accept": "application/json",
|
||||||
|
"X-Apikey": apikey
|
||||||
|
}
|
||||||
|
files = {"file": open("./dist/tts.exe", "rb")}
|
||||||
|
req = requests.post(api_endpoint, headers=headers, files=files)
|
||||||
|
print(" [OK]")
|
||||||
|
|
||||||
|
print("Waiting for results", end="")
|
||||||
|
time.sleep(30)
|
||||||
|
print(" [OK]")
|
||||||
|
data = req.json()
|
||||||
|
api_endpoint = f"https://www.virustotal.com/api/v3/analyses/{data['data']['id']}"
|
||||||
|
headers = {
|
||||||
|
'X-Apikey': apikey
|
||||||
|
}
|
||||||
|
req = requests.get(api_endpoint, headers=headers)
|
||||||
|
data = req.json()
|
||||||
|
|
||||||
|
try:
|
||||||
|
pprint(data['data']['attributes']['results']['Microsoft'])
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
pprint(data['data']['attributes']['stats'])
|
||||||
|
print(data['data']['attributes']['status'])
|
||||||
|
print("https://www.virustotal.com/gui/file/"+str(data['meta']['file_info']['sha256']))
|
||||||
|
|
||||||
|
if data['data']['attributes']['results']['Microsoft']['category'] != "undetected":
|
||||||
|
print('FILE WILL BE DETECTED AS MALICIOUS. PLEASE RECOMPILE!')
|
Loading…
Reference in New Issue