From f11b03507b94606a2e88943fe3c5c8c8dec17a6d Mon Sep 17 00:00:00 2001 From: gpkvt Date: Fri, 19 Aug 2022 02:59:27 +0200 Subject: [PATCH] buildscript added --- build.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 build.py diff --git a/build.py b/build.py new file mode 100644 index 0000000..c5c337d --- /dev/null +++ b/build.py @@ -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!')