import boto3
from boto3.dynamodb.conditions import Key


class dynamo():
    settings: dict

    def __init__(self, config):
        self.dynamodb = boto3.resource('dynamodb',
                                       region_name=config['region_name'],
                                       aws_access_key_id=config["aws_access_key_id"],
                                       aws_secret_access_key=config["aws_secret_access_key"])

    def query_cve_meta(self, cve_id):
        table = self.dynamodb.Table('cve_meta')
        response = table.query(KeyConditionExpression=Key('cve_id').eq(cve_id))
        return response['Items']

    def query_cve_meta_keys(self, key="", value=""):
        """
        :param key: The key you are searching and the type
        :param value: The specific value looking for
        :return:
        """
        table = self.dynamodb.Table('cve_meta')
        response = table.scan()
        data = response['Items']
        items = []
        for item in data:
            if key in item:
                if item[key] == value:
                    items.append(item)
        return items

    def get_item(self, table_name: "", key: None, filters: dict):
        table = self.dynamodb.Table(table_name)
        items = table.get_item()
        return items

    def put_cve_meta(self, cve_meta):
        table = self.dynamodb.Table('cve_meta')
        table.put_item(Item=cve_meta)

    def put_item(self, table_name="", item={}):
        if table_name == "":
            return None
        if item == {}:
            return None
        table = self.dynamodb.Table(table_name)
        table.put_item(Item=item)
        return True

    def update_item(self, table, item):
        """
        This function will update an object on
        :param table:
        :param item:
        :return:
        """

    def query_cve_os_paring(self, os_hash):
        table = self.dynamodb.Table('cve_os_pairing')
        response = table.query(KeyConditionExpression=Key('os_hash').eq(os_hash))
        return response['Items']

    def put_cve_os_pairing(self, os_pairing):
        table = self.dynamodb.Table('cve_os_pairing')
        table.put_item(Item=os_pairing)

0b42de1027e65dd0e07bc0ebeacd7ea3d7cb1e95
<mask token>


class dynamo:
    settings: dict
    <mask token>

    def query_cve_meta(self, cve_id):
        table = self.dynamodb.Table('cve_meta')
        response = table.query(KeyConditionExpression=Key('cve_id').eq(cve_id))
        return response['Items']
    <mask token>
    <mask token>

    def put_cve_meta(self, cve_meta):
        table = self.dynamodb.Table('cve_meta')
        table.put_item(Item=cve_meta)

    def put_item(self, table_name='', item={}):
        if table_name == '':
            return None
        if item == {}:
            return None
        table = self.dynamodb.Table(table_name)
        table.put_item(Item=item)
        return True

    def update_item(self, table, item):
        """
        This function will update an object on
        :param table:
        :param item:
        :return:
        """

    def query_cve_os_paring(self, os_hash):
        table = self.dynamodb.Table('cve_os_pairing')
        response = table.query(KeyConditionExpression=Key('os_hash').eq(
            os_hash))
        return response['Items']
    <mask token>

<mask token>


class dynamo:
    settings: dict

    def __init__(self, config):
        self.dynamodb = boto3.resource('dynamodb', region_name=config[
            'region_name'], aws_access_key_id=config['aws_access_key_id'],
            aws_secret_access_key=config['aws_secret_access_key'])

    def query_cve_meta(self, cve_id):
        table = self.dynamodb.Table('cve_meta')
        response = table.query(KeyConditionExpression=Key('cve_id').eq(cve_id))
        return response['Items']
    <mask token>
    <mask token>

    def put_cve_meta(self, cve_meta):
        table = self.dynamodb.Table('cve_meta')
        table.put_item(Item=cve_meta)

    def put_item(self, table_name='', item={}):
        if table_name == '':
            return None
        if item == {}:
            return None
        table = self.dynamodb.Table(table_name)
        table.put_item(Item=item)
        return True

    def update_item(self, table, item):
        """
        This function will update an object on
        :param table:
        :param item:
        :return:
        """

    def query_cve_os_paring(self, os_hash):
        table = self.dynamodb.Table('cve_os_pairing')
        response = table.query(KeyConditionExpression=Key('os_hash').eq(
            os_hash))
        return response['Items']
    <mask token>

<mask token>


class dynamo:
    settings: dict

    def __init__(self, config):
        self.dynamodb = boto3.resource('dynamodb', region_name=config[
            'region_name'], aws_access_key_id=config['aws_access_key_id'],
            aws_secret_access_key=config['aws_secret_access_key'])

    def query_cve_meta(self, cve_id):
        table = self.dynamodb.Table('cve_meta')
        response = table.query(KeyConditionExpression=Key('cve_id').eq(cve_id))
        return response['Items']
    <mask token>
    <mask token>

    def put_cve_meta(self, cve_meta):
        table = self.dynamodb.Table('cve_meta')
        table.put_item(Item=cve_meta)

    def put_item(self, table_name='', item={}):
        if table_name == '':
            return None
        if item == {}:
            return None
        table = self.dynamodb.Table(table_name)
        table.put_item(Item=item)
        return True

    def update_item(self, table, item):
        """
        This function will update an object on
        :param table:
        :param item:
        :return:
        """

    def query_cve_os_paring(self, os_hash):
        table = self.dynamodb.Table('cve_os_pairing')
        response = table.query(KeyConditionExpression=Key('os_hash').eq(
            os_hash))
        return response['Items']

    def put_cve_os_pairing(self, os_pairing):
        table = self.dynamodb.Table('cve_os_pairing')
        table.put_item(Item=os_pairing)

<mask token>


class dynamo:
    settings: dict

    def __init__(self, config):
        self.dynamodb = boto3.resource('dynamodb', region_name=config[
            'region_name'], aws_access_key_id=config['aws_access_key_id'],
            aws_secret_access_key=config['aws_secret_access_key'])

    def query_cve_meta(self, cve_id):
        table = self.dynamodb.Table('cve_meta')
        response = table.query(KeyConditionExpression=Key('cve_id').eq(cve_id))
        return response['Items']

    def query_cve_meta_keys(self, key='', value=''):
        """
        :param key: The key you are searching and the type
        :param value: The specific value looking for
        :return:
        """
        table = self.dynamodb.Table('cve_meta')
        response = table.scan()
        data = response['Items']
        items = []
        for item in data:
            if key in item:
                if item[key] == value:
                    items.append(item)
        return items

    def get_item(self, table_name: '', key: None, filters: dict):
        table = self.dynamodb.Table(table_name)
        items = table.get_item()
        return items

    def put_cve_meta(self, cve_meta):
        table = self.dynamodb.Table('cve_meta')
        table.put_item(Item=cve_meta)

    def put_item(self, table_name='', item={}):
        if table_name == '':
            return None
        if item == {}:
            return None
        table = self.dynamodb.Table(table_name)
        table.put_item(Item=item)
        return True

    def update_item(self, table, item):
        """
        This function will update an object on
        :param table:
        :param item:
        :return:
        """

    def query_cve_os_paring(self, os_hash):
        table = self.dynamodb.Table('cve_os_pairing')
        response = table.query(KeyConditionExpression=Key('os_hash').eq(
            os_hash))
        return response['Items']

    def put_cve_os_pairing(self, os_pairing):
        table = self.dynamodb.Table('cve_os_pairing')
        table.put_item(Item=os_pairing)

import boto3
from boto3.dynamodb.conditions import Key


class dynamo():
    settings: dict

    def __init__(self, config):
        self.dynamodb = boto3.resource('dynamodb',
                                       region_name=config['region_name'],
                                       aws_access_key_id=config["aws_access_key_id"],
                                       aws_secret_access_key=config["aws_secret_access_key"])

    def query_cve_meta(self, cve_id):
        table = self.dynamodb.Table('cve_meta')
        response = table.query(KeyConditionExpression=Key('cve_id').eq(cve_id))
        return response['Items']

    def query_cve_meta_keys(self, key="", value=""):
        """
        :param key: The key you are searching and the type
        :param value: The specific value looking for
        :return:
        """
        table = self.dynamodb.Table('cve_meta')
        response = table.scan()
        data = response['Items']
        items = []
        for item in data:
            if key in item:
                if item[key] == value:
                    items.append(item)
        return items

    def get_item(self, table_name: "", key: None, filters: dict):
        table = self.dynamodb.Table(table_name)
        items = table.get_item()
        return items

    def put_cve_meta(self, cve_meta):
        table = self.dynamodb.Table('cve_meta')
        table.put_item(Item=cve_meta)

    def put_item(self, table_name="", item={}):
        if table_name == "":
            return None
        if item == {}:
            return None
        table = self.dynamodb.Table(table_name)
        table.put_item(Item=item)
        return True

    def update_item(self, table, item):
        """
        This function will update an object on
        :param table:
        :param item:
        :return:
        """

    def query_cve_os_paring(self, os_hash):
        table = self.dynamodb.Table('cve_os_pairing')
        response = table.query(KeyConditionExpression=Key('os_hash').eq(os_hash))
        return response['Items']

    def put_cve_os_pairing(self, os_pairing):
        table = self.dynamodb.Table('cve_os_pairing')
        table.put_item(Item=os_pairing)
