mirror of https://github.com/MISP/misp-modules
- Quick comment ToDo: Avoid using Magic in future releases
parent
60a3fbe282
commit
fbb3617f25
|
@ -45,7 +45,7 @@ def handler(q=False):
|
||||||
r = {'results': []}
|
r = {'results': []}
|
||||||
request = json.loads(q)
|
request = json.loads(q)
|
||||||
document = base64.b64decode(request["data"])
|
document = base64.b64decode(request["data"])
|
||||||
if magic.from_buffer(document, mime=True).split("/")[1] == 'pdf':
|
if magic.from_buffer(document, mime=True).split("/")[1] == 'pdf': # Eventually this could be replaced with wand.obj.format
|
||||||
print("PDF Detected")
|
print("PDF Detected")
|
||||||
with WImage(blob=document) as pdf:
|
with WImage(blob=document) as pdf:
|
||||||
pages=len(pdf.sequence)
|
pages=len(pdf.sequence)
|
||||||
|
|
Loading…
Reference in New Issue