コード例 #1
0
def check_api(key):
    try:
        urllib.request.urlopen('https://www.duckduckgo.com')        # opens url to check internet connection
        scanner = Virustotal(key)
        scanner.url_scan(['www.vulnweb.com'])
        report = scanner.url_report(['www.vulnweb.com'])
        if report['status_code'] == 403:                            # checks if status code is 403
            return True
        else:
            return False
    except urllib.error.URLError:
        input('Connect to internet...')
        exit()
コード例 #2
0
def check_url(key):
    url = input('\nEnter URL: ')                                    # Get url from the user
    try:
        urllib.request.urlopen('http://' + url)                     # Checks the given url is valid
        msg()                                                       # prints scanning message
        scanner = Virustotal(key)                                   # passing api key to Virustotal class
        scanner.url_scan([url])                                     # passing url to url_scan function
        report = scanner.url_report([url])                          # returns report of the url
        try:
            print('\n\nREPORT:\nStatus_code:', report['status_code'])  # Prints all the reports
            print('Scan date:', report['json_resp']['scan_date'])
            print('URL:', report['json_resp']['url'])
            print('Verbose msg:', report['json_resp']['verbose_msg'])
            print('Total Scanned:', report['json_resp']['total'])
            print('Positives:', report['json_resp']['positives'])
        except KeyError:
            print('\n""Maximum four scans per minute""')            # prints if you reach maximum attempts
    except:
        print('Invalid URL')
コード例 #3
0
from virustotal_python import Virustotal
from pprint import pprint
import json
import streamlit as st

url = st.text_input('Enter the url')
vtotal = Virustotal(
    "939b160778c93a24ed0985dbc90a98d2def25cf82ed92046a95cfe553f63ade1")
url_scan = vtotal.url_report([url])
a = url_scan['json_resp']['positives']
if (a > 0):
    print('malicious website')
else:
    print('Clean Website')