# Path: helpers/helpers.py
# def hashPassword(password):
# def checksum(data):
# def verifyPassword(p):
#     MIN = False
#     MAJ = False
#     NUM = False
#     SPEC = False
#             MIN = True
#             MAJ = True
#             NUM = True
#             SPEC = True


import logging
import os
import sys
import tarfile
import result as evltResult
from helpers.helpers import threadname
    def query_from_ioc(self, ioc):
        select = ioc.select.replace('%s/' % ioc.document, '')

        # Hey, I don't know how to search for that
        if (ioc.search.lower() not in self.__evalList) \
                or (ioc.condition not in conditionList.keys()):
            print '%s/%s is not in evaluation list' % (ioc.search, ioc.condition)
            return ''

        if select and select.lower() not in self.__evalList:
            print 'Could not select %s (not in evaluation list)' % (ioc.select)
            select = ''

        category = ioc.search.replace('%s/' % ioc.document, '')
        conditionTerm = conditionList[ioc.condition]

        # Escape '\' not using REGEX
        condition = conditionTerm % self.escapeValue(
            ioc.value) if ioc.condition != 'regex' else conditionTerm % ioc.value

        # Craft query
        # > selecting count by default, otherwise selecting the user defined element
        # SELECT COUNT *  FROM <table> WHERE <index> LIKE <value> (default example)
        # SELECT FilePath FROM <table> WHERE <index> LIKE <value> (user defined select)
        querySelect = 'COUNT(*)' if not select else ('`%s`' % select)
        queryStart = 'SELECT %s FROM %s WHERE ' % (querySelect, self.__tableName)
        queryVariable = '`%(index)s` %(clause)s' % {'index': category, 'clause': (condition)}
        queryEnd = ';' if not select else ' UNION SELECT CHAR(1);'
        query = queryStart + queryVariable + queryEnd


# Path: helpers/helpers.py
# def hashPassword(password):
# def checksum(data):
# def verifyPassword(p):
#     MIN = False
#     MAJ = False
#     NUM = False
#     SPEC = False
#             MIN = True
#             MAJ = True
#             NUM = True
#             SPEC = True


# Path: components/scanner/flatevaluators/template.py
import logging
import os
import sys
import tarfile
import result as evltResult
from helpers.helpers import threadname

    def query_from_ioc(self, ioc):
        select = ioc.select.replace('%s/' % ioc.document, '')

        # Hey, I don't know how to search for that
        if (ioc.search.lower() not in self.__evalList) \
                or (ioc.condition not in conditionList.keys()):
            print '%s/%s is not in evaluation list' % (ioc.search, ioc.condition)
            return ''

        if select and select.lower() not in self.__evalList:
            print 'Could not select %s (not in evaluation list)' % (ioc.select)
            select = ''

        category = ioc.search.replace('%s/' % ioc.document, '')
        conditionTerm = conditionList[ioc.condition]

        # Escape '\' not using REGEX
        condition = conditionTerm % self.escapeValue(
            ioc.value) if ioc.condition != 'regex' else conditionTerm % ioc.value

        # Craft query
        # > selecting count by default, otherwise selecting the user defined element
        # SELECT COUNT *  FROM <table> WHERE <index> LIKE <value> (default example)
        # SELECT FilePath FROM <table> WHERE <index> LIKE <value> (user defined select)
        querySelect = 'COUNT(*)' if not select else ('`%s`' % select)
        queryStart = 'SELECT %s FROM %s WHERE ' % (querySelect, self.__tableName)
        queryVariable = '`%(index)s` %(clause)s' % {'index': category, 'clause': (condition)}
        queryEnd = ';' if not select else ' UNION SELECT CHAR(1);'
        query = queryStart + queryVariable + queryEnd


        filename = '%s.%s.%s.%s.res' % (threadname, ioc.document.lower(), ioc.id, ioc.db_ioc_id)