-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
30 lines (22 loc) · 813 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Python libraries
import hashlib
import webbrowser
import argparse
def VT_Scan(file_location):
"""This function will take a file location and scan it with VirusTotal.
Args:
file_location (str): The file location to scan.
"""
# Generate sha256 hash of file_location
file_hash = hashlib.sha256(open(file_location, "rb").read()).hexdigest()
# Construct VirusTotal URL
vt_url = "https://www.virustotal.com/gui/file/" + file_hash
# Open VirusTotal URL in default browser
webbrowser.open(vt_url)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="VirusTotal Scanner")
parser.add_argument(
"-f", "--file", help="Path to file to be scanned on VirusTotal", required=True
)
args = parser.parse_args()
VT_Scan(args.file)