18 lines
550 B
Python
18 lines
550 B
Python
from flask import Blueprint, request, jsonify
|
|
from os import path
|
|
import oletools.oleid
|
|
import config
|
|
|
|
oleid_bp = Blueprint('oleid', __name__)
|
|
|
|
@oleid_bp.route('/analyze', methods=['POST'])
|
|
def analyze_ole():
|
|
data = request.form
|
|
file = data['file']
|
|
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, 'analysis': results})
|