コード例 #1
0
ファイル: base.py プロジェクト: theshiv303/aleph
    def check_exists(self):

        result = es.search({"hashes.sha256": self.hashes['sha256']})
        exists = ('hits' in result and result['hits']['total'] != 0)
        if exists:
            data = result['hits']['hits'][0]['_source']
            self.uuid = data['uuid']
            self.sources = data['sources']
            self.dispose()

        return exists
コード例 #2
0
ファイル: base.py プロジェクト: phretor/aleph
    def check_exists(self):

        result = es.search({"hashes.sha256": self.hashes["sha256"]})
        exists = "hits" in result and result["hits"]["total"] != 0
        if exists:
            data = result["hits"]["hits"][0]["_source"]
            self.uuid = data["uuid"]
            self.sources = data["sources"]
            self.dispose()

        return exists
コード例 #3
0
ファイル: base.py プロジェクト: CyberIntelMafia/aleph
    def check_exists(self):

        result = es.search({"hashes.sha256": self.hashes['sha256']})
        exists = ('hits' in result and result['hits']['total'] != 0)
        if exists:
            data = result['hits']['hits'][0]['_source']
            self.uuid = data['uuid']
            self.sources = data['sources']
            self.dispose()

        return exists
コード例 #4
0
ファイル: samples.py プロジェクト: CyberIntelMafia/aleph
def update_submissions(user_id):

    try:
        user = User.query.get(user_id)
        pending = user.submissions.filter(Submission.sample_uuid == None).all()
        for row in pending:
            result = es.search({"hashes.sha256": row.file_hash})
            exists = ('hits' in result and result['hits']['total'] != 0)
            if exists:
                data = result['hits']['hits'][0]['_source']
                row.sample_uuid = data['uuid']
                db.session.add(row)

        db.session.commit()
    except TransportError:
        flash(gettext('Error querying ElasticSearch database. Please check configuration.'))
コード例 #5
0
ファイル: samples.py プロジェクト: theshiv303/aleph
def update_submissions(user_id):

    try:
        user = User.query.get(user_id)
        pending = user.submissions.filter(Submission.sample_uuid == None).all()
        for row in pending:
            result = es.search({"hashes.sha256": row.file_hash})
            exists = ('hits' in result and result['hits']['total'] != 0)
            if exists:
                data = result['hits']['hits'][0]['_source']
                row.sample_uuid = data['uuid']
                db.session.add(row)

        db.session.commit()
    except TransportError:
        flash(
            gettext(
                'Error querying ElasticSearch database. Please check configuration.'
            ))