19 lines
584 B
Python
19 lines
584 B
Python
from flask import Blueprint, request, jsonify, abort
|
|
from os import path
|
|
import oletools.oleid
|
|
import config
|
|
|
|
oleid_bp = Blueprint('oleid', __name__)
|
|
|
|
@oleid_bp.route('/analyze', methods=['GET'])
|
|
def analyze_ole():
|
|
file = request.args.get('file', '')
|
|
if file == '':
|
|
abort(400)
|
|
filepath = path.join(config.Config.FILE_DIRECTORY, file)
|
|
# Analyze with oleid
|
|
oid = oletools.oleid.OleID(filepath)
|
|
indicators = oid.check()
|
|
results = {indicator.name: indicator.value for indicator in indicators}
|
|
|
|
return jsonify({'filename': file, 'result': results})
|