mirror of
				https://gitlab.com/gpvkt/twitchtts.git
				synced 2025-10-31 17:17:35 +01:00 
			
		
		
		
	buildscript added
This commit is contained in:
		
							parent
							
								
									8e8c83af43
								
							
						
					
					
						commit
						f11b03507b
					
				
					 1 changed files with 52 additions and 0 deletions
				
			
		
							
								
								
									
										52
									
								
								build.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								build.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -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…
	
	Add table
		
		Reference in a new issue