mirror of https://github.com/MISP/misp-modules
Fix: types array
parent
f97c5d62d6
commit
27ddbd9b92
|
@ -1,9 +1,6 @@
|
||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
try:
|
|
||||||
import Image
|
|
||||||
except ImportError:
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from pytesseract import image_to_string
|
from pytesseract import image_to_string
|
||||||
|
@ -27,10 +24,11 @@ def handler(q=False):
|
||||||
request = json.loads(q)
|
request = json.loads(q)
|
||||||
image = base64.b64decode(request["data"])
|
image = base64.b64decode(request["data"])
|
||||||
image_file = BytesIO(image)
|
image_file = BytesIO(image)
|
||||||
|
image_file.seek(0)
|
||||||
ocrized = image_to_string(Image.open(image_file))
|
ocrized = image_to_string(Image.open(image_file))
|
||||||
freetext = {}
|
freetext = {}
|
||||||
freetext['values'] = ocrized
|
freetext['values'] = ocrized
|
||||||
freetext['type'] = 'freetext'
|
freetext['types'] = ['freetext']
|
||||||
r['results'].append(freetext)
|
r['results'].append(freetext)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue