![]() BLUE "get info about the results of analysis." Colors. exit () def analyse ( self ): print ( Colors. RED "failed to upload PE file :(" Colors. GREEN "successfully upload PE file: OK" Colors. YELLOW "upload to " upload_url Colors. VT_API_URL = "" # upload malicious file to VirusTotal and analyseĬlass VTScan : def _init_ ( self ): self. VT_API_KEY = "My VirusTotal API key" # VirusTotal API v3 URL Import os import sys import time import json import requests import argparse import hashlib # for terminal colorsĬlass Colors : BLUE = ' \033 [94m' GREEN = ' \033 [92m' YELLOW = ' \033 [93m' RED = ' \033 [91m' PURPLE = ' \033 [95m' ENDC = ' \033 [0m' # VirusTotal API key RED "failed to get information :(" Colors. GREEN "successfully analyse: OK" Colors. get ( "engine_update" )) print ( "=" ) print () print ( Colors. get ( "method" )) print ( "update : " results. get ( "category" )) print ( "result : " Colors. get ( "engine_version" )) print ( "category : " results. get ( "category" ) = "malicious" : print ( "=" ) print ( Colors. ENDC ) print () for k in results : if results. get ( "last_analysis_results" ) print ( Colors. get ( "last_analysis_stats" ) results = result. get ( "last_analysis_results" ): stats = result. ENDC ) info_url = VT_API_URL "files/" file_hash res = requests. BLUE "get file info by ID: " file_hash Colors. Here, if the file that we uploaded is analyzed and ready, then we output the result to the console: how many engines consider our file to be malicious in total, if the file is in the queue, then we read the analysis results using the SHA-256 sum of our file as an identifier:ĭef info ( self, file_hash ): print ( Colors. RED "failed to get results of analysis :(" Colors. malware_path ), "rb" ) as malware_path : b = f. exit () elif status = "queued" : print ( Colors. get ( "status" ) if status = "completed" : stats = result. ENDC ) analysis_url = VT_API_URL "analyses/" self. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |