How to use the zat.utils.cache function in zat

To help you get started, we’ve selected a few zat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SuperCowPowers / zat / zat / utils / geo_lookup.py View on Github external
def __init__(self, apikey=None, summary=True, max_cache_size=10000, max_cache_time=30, throttle=True):
        """GeoLookup Init"""

        # Public API Key
        # Note: The key below is a low-volume public key. Please call this method with your own API key :)
        if apikey is None:
            print('Using public API Key: Please set apikey= when creating this class')
        pub_apikey = '7278776fac2f2c66b1c760c650c20e8e'
        self.known_ipstack_ips = ['158.85.167.221', '158.85.167.217', '158.85.167.201']
        self.apikey = apikey or pub_apikey
        self.summary = summary
        self.throttle = throttle

        # Create query cache
        seconds = max_cache_time*24*60*60  # Convert from days
        self.query_cache = cache.Cache(max_size=max_cache_size, timeout=seconds, load='zat_geo_cache')  # Convert to Seconds
github SuperCowPowers / zat / zat / utils / reverse_dns.py View on Github external
def __init__(self, lookup_internal=False):
        """Initialize ReverseDNS Class"""
        self.ip_lookup_cache = cache.Cache(timeout=600)
        self.lookup_internal = lookup_internal
github SuperCowPowers / zat / zat / utils / vt_query.py View on Github external
def __init__(self, apikey=None, summary=True, max_cache_size=1000, max_cache_time=60, throttle=True):
        """VTQuery Init"""

        # Public VT API Key
        # Note: The Virus Total key below is a low-volume public key.
        #       Please call this method with your own VT API key :)
        if apikey is None:
            print('Using public VT API Key: Please set apikey= when creating this class')
        pub_vt_apikey = 'ab0933e5b4d8032031bbce54b4170453e62c229dcf93fb99b0b80f09e415f809'
        self.apikey = apikey or pub_vt_apikey
        self.exclude = ['scan_id', 'md5', 'sha1', 'sha256', 'resource', 'response_code', 'permalink',
                        'verbose_msg', 'scans'] if summary else []
        self.throttle = throttle

        # Create query cache
        self.query_cache = cache.Cache(max_size=max_cache_size, timeout=max_cache_time*60)  # Convert to Seconds