20 lines
614 B
Python
20 lines
614 B
Python
from flask import Blueprint, request, jsonify, abort
|
|
from os import path
|
|
from werkzeug.utils import secure_filename
|
|
import oletools.oleid
|
|
import config
|
|
|
|
oleid_bp = Blueprint('oleid', __name__)
|
|
|
|
@oleid_bp.route('/analyze', methods=['GET'])
|
|
def analyze_ole():
|
|
file = secure_filename(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(results)
|