Skip to content

Commit

Permalink
fix: [exifs module] Mp4 UnidentifiedImageError
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrtia committed Dec 11, 2024
1 parent f4584f7 commit 6f964d7
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions bin/modules/Exif.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import os
import sys

from PIL import Image, ExifTags
from PIL import Image, ExifTags, UnidentifiedImageError

sys.path.append(os.environ['AIL_BIN'])
##################################
Expand All @@ -38,22 +38,25 @@ def __init__(self):
def compute(self, message):
image = self.get_obj()
print(image)
img = Image.open(image.get_filepath())
img_exif = img.getexif()
print(img_exif)
if img_exif:
self.logger.critical(f'Exif: {self.get_obj().id}')
gps = img_exif.get(34853)
print(gps)
self.logger.critical(f'gps: {gps}')
for key, val in img_exif.items():
if key in ExifTags.TAGS:
print(f'{ExifTags.TAGS[key]}:{val}')
self.logger.critical(f'{ExifTags.TAGS[key]}:{val}')
else:
print(f'{key}:{val}')
self.logger.critical(f'{key}:{val}')
sys.exit(0)
try:
img = Image.open(image.get_filepath())
img_exif = img.getexif()
print(img_exif)
if img_exif:
self.logger.critical(f'Exif: {self.get_obj().id}')
gps = img_exif.get(34853)
print(gps)
self.logger.critical(f'gps: {gps}')
for key, val in img_exif.items():
if key in ExifTags.TAGS:
print(f'{ExifTags.TAGS[key]}:{val}')
self.logger.critical(f'{ExifTags.TAGS[key]}:{val}')
else:
print(f'{key}:{val}')
self.logger.critical(f'{key}:{val}')
sys.exit(0)
except UnidentifiedImageError:
self.logger.info(f'Invalid image: {image.get_filepath()}')

# tag = 'infoleak:automatic-detection="cve"'
# Send to Tags Queue
Expand Down

0 comments on commit 6f964d7

Please sign in to comment.