scieee AI-readable full text Open interactive document viewer

Study and development of an Autopsy module for automated analysis of image metadata

Doménech Fons, Jordi

Abstract

The importance of cybersecurity is raising every day with the development of new technologies. Consequently, cybercrimes are notably increasing and, more than ever before, qualified people are needed to protect the rest of users from these type of infractions. Digital forensics is a very important part of the cybersecurity world. Furthermore, the ultimate goal of a digital forensics investigation is to preserve, identify, acquire and document digital evidence to be used in the court of law. As a result, this thesis dives deeply into the digital forensics field, especially in the analysis of image metadata exploring one of the most important software tools used by digital forensics investigators: Autopsy. One of the gaps detected in the Autopsy framework is the lack of a very demanded feature consisting in the analysis, extraction and filtering of image metadata. For that reason, the main contribution done in this thesis consisted in designing and developing a software-based Autopsy plug-in module capable of analyzing image metadata and enable the user to perform the filtering of image data bases based on a set of configurable rules. Thanks to the work done in this project, investigators will not be forced to run another external software to execute such specific processing function since, from now on, this feature is integrated into the Autopsy framework through this new available open source plug-in.

Full text

STUDY AND DEVELOPMENT OF AN AUTOPSY MODULE FOR AUTOMATED ANALYSIS OF IMAGE METADATA A Degree Thesis Submitted to the Faculty of the Escola Tècnica d'Enginyeria de Telecomunicació de Barcelona Universitat Politècnica de Catalunya by Jordi Doménech Fons In partial fulfilment of the requirements for the degree in TELECOMMUNICATIONS TECHNOLOGIES AND SERVICES ENGINEERING Advisor: Josep Pegueroles Vallés Barcelona, June 2021 1 Abstract The importance of cybersecurity is raising every day with the development of new technologies. Consequently, cybercrimes are notably increasing and, more than ever before, qualified people are needed to protect the rest of users from these type of infractions. Digital forensics is a very important part of the cybersecurity world. Furthermore, the ultimate goal of a digital forensics investigation is to preserve, identify, acquire and document digital evidence to be used in the court of law. As a result, this thesis dives deeply into the digital forensics field, especially in the analysis of image metadata exploring one of the most important software tools used by digital forensics investigators: Autopsy. One of the gaps detected in the Autopsy framework is the lack of a very demanded feature consisting in the analysis, extraction and filtering of image metadata. For that reason, the main contribution done in this thesis consisted in designing and developing a software-based Autopsy plug-in module capable of analyzing image metadata and enable the user to perform the filtering of image data bases based on a set of configurable rules. Thanks to the work done in this project, investigators will not be forced to run another external software to execute such specific processing function since, from now on, this feature is integrated into the Autopsy framework through this new available open source plug-in. 2 Resum La importància de la ciberseguretat augmenta cada dia amb el desenvolupament de noves tecnologies. En conseqüència, els delictes cibernètics augmenten notablement i, més que mai, calen persones qualificades per protegir la resta d’usuaris d’aquest tipus d’infraccions. La forense digital és una part molt important del món de la ciberseguretat. A més, l’objectiu principal d’aquest camp consisteix en preservar, identificar, adquirir i documentar proves digitals per poder-les utilitzar després als tribunals de justícia. Com a resultat, aquesta tesi aprofundeix en el camp de la forense digital, especialment en l’anàlisi de metadades d’imatges fent us d’un dels programes més importants utilitzats pels investigadors: Autopsy. Una de les carències detectades a Autopsy és la manca d’una característica molt demandada que consisteix en l’anàlisi, extracció i filtratge de metadades d’imatges. Per aquest motiu, la principal contribució feta en aquesta tesi consisteix en dissenyar i desenvolupar un mòdul capaç d’analitzar metadades d’imatges i permetre a l’usuari realitzar un filtratge de bases de dades d’imatges basant-se en un conjunt de regles configurables. Gràcies a la feina feta en aquest projecte, els investigadors no es veuran obligats a utilitzar un altre programa extern per executar aquesta funció de processament tan específica ja que, a partir d’ara, aquesta característica s’integra a Autopsy mitjançant aquest nou mòdul disponible de codi obert. 3 Resumen La importancia de la ciberseguridad aumenta día a día con el desarrollo de nuevas tecnologías. En consecuencia, los ciberdelitos están aumentando notablemente y, más que nunca, se necesitan personas calificadas para proteger al resto de usuarios de este tipo de infracciones. La ciencia forense digital es una parte muy importante del mundo de la ciberseguridad. Además, el objetivo final de una investigación forense digital es preservar, identificar, adquirir y documentar pruebas digitales para su posterior uso en los tribunales. Como resultado, esta tesis profundiza en el campo de la ciencia forense digital, especialmente en el análisis de metadatos de imágenes explorando una de las herramientas de software más importantes utilizadas por los investigadores: Autopsy. Una de las carencias detectadas en Autopsy es la falta de una función muy demandada capaz de analizar, extraer y filtrar metadatos de imágenes. Por ello, el principal aporte realizado en esta tesis consiste en diseñar y desarrollar un módulo en Autopsy capaz de analizar metadatos de imágenes y permitir al usuario realizar un filtrado de bases de datos de imágenes en base a un conjunto de reglas configurables. Gracias al trabajo realizado en este proyecto, los investigadores no se verán obligados a usar otro software externo para ejecutar una función de procesamiento tan específica ya que, a partir de ahora, esta característica se integra en Autopsy a través de este nuevo módulo disponible de código abierto. 4 “It ain’t about how hard you hit, it’s about how hard you can get hit and keep moving forward.” Rocky Balboa (S. Stallone) 5 Acknowledgements First of all, I would like to thank my family; specially my mum, my dad, my brother and my uncles. They have always helped and listened me during the good and bad moments, giving me great ideas and support to end my bachelor degree with this fantastic thesis. I would also like to give special thanks to my project supervisor, Josep Pegueroles Vallés. He has given me the opportunity to start learning about the cybersecurity field, specially digital forensics; a specialization I always found interesting as well as necessary to nowadays society. Apart from that, he always supported and advised me during the last years of the bachelor degree and, of course, during the final degree thesis. Without him, this project would not have been possible. Last but not least, I am thankful to the Software Engineer Phil Harvey, author of ExifTool, that let me use his excellent software in my thesis with no inconvenience. 6 Revision history and approval record Revision Date Purpose 0 28/02/2021 Document creation 1 06/03/2021 Document revision 2 30/03/2021 Document revision 3 19/06/2021 Document revision 4 21/06/2021 Document delivery DOCUMENT DISTRIBUTION LIST Name e-mail Jordi Doménech Fons [email protected] Josep Pegueroles Vallés josep.peguero[email protected]u Written by: Reviewed and approved by: Date 20/06/2021 Date 20/06/2021 Name Jordi Doménech Fons Name Josep Pegueroles Vallés Position Project Author Position Project Supervisor 7 Table of contents Abstract ............................................................................................................................ 1 Resum .............................................................................................................................. 2 Resumen .......................................................................................................................... 3 Acknowledgements .......................................................................................................... 5 Revision history and approval record ................................................................................ 6 Table of contents .............................................................................................................. 7 List of Figures ................................................................................................................... 9 List of Tables .................................................................................................................. 11 1. Introduction .............................................................................................................. 12 1.1. Objectives ........................................................................................................ 14 1.1.1. Technical Objectives ................................................................................. 14 1.1.2. Work Planning Objectives.......................................................................... 14 1.1.3. Personal Objectives ................................................................................... 14 1.2. Work Plan ......................................................................................................... 15 1.3. Eventualities and deviations from the initial plan ............................................... 16 2. State of the art of the technology used in this thesis ................................................ 18 2.1. Autopsy ............................................................................................................ 18 2.1.1. Creating a new case .................................................................................. 18 2.1.2. Adding the data source .............................................................................. 19 2.1.3. Ingest Modules .......................................................................................... 20 2.1.4. User Interface Layout ................................................................................ 20 2.1.5. Adding your own modules ......................................................................... 22 2.1.6. Generating a Report .................................................................................. 23 2.2. Image Metadata ............................................................................................... 23 2.2.1. Exchangeable Image File Format (EXIF) ................................................... 24 2.2.1.1. EXIF in Autopsy ...................................................................................... 24 2.2.1.2. Other programs to extract EXIF metadata ............................................... 25 2.2.2. IPTC-IIM .................................................................................................... 26 2.2.2.1. IPTC in Autopsy ...................................................................................... 27 2.2.2.2. Other programs to extract IPTC metadata ............................................... 27 3. Methodology and project development .................................................................... 29 3.1. Tools used ........................................................................................................ 29 3.1.1. ExifTool ..................................................................................................... 29 8 3.1.2. Scientific Python Development Environment (SPYDER) ........................... 29 3.1.3. Example of usage ...................................................................................... 29 3.2. Development of Autopsy File Ingest Modules ................................................... 30 4. Results .................................................................................................................... 33 4.1. High Level module explanation ......................................................................... 33 4.1.1. Flux Diagram ............................................................................................. 35 4.2. Figure of merit .................................................................................................. 37 4.2.1. Image Metadata Analyzer .......................................................................... 37 4.2.2. Image Metadata Filter ................................................................................ 38 5. Budget ..................................................................................................................... 39 5.1. Direct Costs ...................................................................................................... 39 5.2. Indirect Costs ................................................................................................... 39 6. Conclusions and future development ....................................................................... 40 6.1. Conclusions ...................................................................................................... 40 6.2. Future Development ......................................................................................... 40 Bibliography .................................................................................................................... 42 Appendix I: Autopsy Ingest Modules ............................................................................... 43 Appendix II: ExifTool analysis of f0674291.jpg ................................................................ 44 Appendix III: ExifTool analysis of iptc-image.jpg ............................................................. 49 Appendix IV: Output of PyExifTool library testing script .................................................. 53 Appendix V: PyExifTool testing script ............................................................................. 55 Appendix VI: PyExifTool Library ..................................................................................... 56 Appendix VII: HelloWorld.py ........................................................................................... 61 Appendix VIII: Installation procedure of the Image Metadata Analyzer Module ............... 63 Appendix IX: Usage of the Image Metadata Analyzer Module ........................................ 69 Appendix X: ImageAnalyzerGUI.py ................................................................................. 73 Appendix XI: ImageAnalyzerLib.py ................................................................................. 93 15 1.2. Work Plan Background Research WP ref: WP1 Major constituent: Research Sheet 1 of 4 Short description: Being familiar with Digital Forensics’ world, image metadata and Autopsy software. Planned start date: 15.02.2021 Planned end date: 15.03.2021 Internal task T1: Research information about Digital Forensics. Internal task T2: Research information about the different types of image metadata we can found in an image. Internal task T3: Install Autopsy and understand how it works. Internal task T4: Write the Thesis introduction. Internal task T5: Write a review about the different metadata formats we can find in the literature and their nature. Internal task T6: Write a basic review about Autopsy software. Table 1. Work Package 1 Autopsy Modules WP ref: WP2 Major constituent: Software Sheet 2 of 4 Short description: How to develop modules in Autopsy, being familiar with the Sleuth Kit library and implementation of a basic “Hello World” module. Planned start date: 16.03.2021 Planned end date: 04.04.2021 Internal task T1: Research information about the implementation of Python modules in Autopsy. Internal task T2: Implementation and testing of a basic Autopsy module. Internal task T3: Write a report about the work done. Table 2. Work Package 2 Development of the Module WP ref: WP3 Major constituent: Software Sheet 3 of 4 Short description: Development of a module for automated analysis of image metadata. Planned start date: 05.04.2021 Planned end date: 08.05.2021 Internal task T1: Development of the Python module to analyze image metadata. Internal task T2: Module testing and validation. 16 Internal task T3: Write a report about the work done. Table 3. Work Package 3 Final Documentation WP ref: WP4 Major constituent: Documentation Sheet 4 of 4 Short description: Write and review the Final Degree Thesis documentation. Planned start date: 09.05.2021 Planned end date: 20.06.2021 Internal task T1: Write and review the final documentation to present it to UPC and tribunals. Internal task T2: Write a paper of all the work done to present it to a congress. Table 4. Work Package 4 Figure 2. Initial Gantt Diagram 1.3. Eventualities and deviations from the initial plan Despite that thankfully we did not have any considerable incident and eventuality, we have added one more work package to work in between the WP2 and WP3 called ExifTool: ExifTool WP ref: WP2.5 Major constituent: Software Sheet 5 Short description: Study of the great software ExifTool to analyze image metadata. How can we integrate it to be capable of working with Autopsy? Planned start date: 23.03.2021 Planned end date: 04.04.2021 Internal task T1: Research information about ExifTool. Internal task T2: Write a basic script about ExifTool with Python for the proper 17 integration of it in an Autopsy module. Internal task T3: Write a report about the work done. Table 5. Work Package 2.5 This new modification will affect the dates and consequently the Gantt diagram. It will be as follows: Figure 3. Updated Gantt Diagram 18 2. State of the art of the technology used in this thesis 2.1. Autopsy The Sleuth Kit is a digital forensics open source tool which works with the command line and allows you to analyze disk images and recover files from them. Therefore, it is not user friendly and needs expert handling. For that reason, it is used behind the scenes of Autopsy: an easy to use, GUI-based program that allows you to efficiently analyze hard drives, smartphones, logical files,... Figure 4. Autopsy’s logo The principal benefits that Autopsy provides are the user friendly interface, the clear detail reports provided at the end of the investigation and, last but not least, the plug-in architecture that allows you to find add-on modules or develop custom modules in Java or Python to personalize and add new features in your professional investigation case. Besides that, some of the available forensics modules that allow the systematization of the analysis are: - Time analysis: used to see when a computer was used or which events occurred before or after a given event. - Hash filtering: used to identify files that are ‘known’ and can be ignored or are ‘known bad’ and raise awareness. - Keyword search: extracts text from all kind of files to be easily searched. - Data carving: carves files from unallocated space in the data source, helping in that way to discover files that were deleted. In the next sections I will explain you a little example of how Autopsy works analyzing a Disk Image of a used Pen Drive but supposedly empty now. 2.1.1. Creating a new case When running Autopsy, you can create a new case or open an existing case. In this example we are going to create a new one. 19 Figure 5. New Case Information in Autopsy When creating a new case, it has to be provided a name for the case and a directory to store the case, as well as the name of the examiners and other optional information. 2.1.2. Adding the data source After creating the new case and filling the Case Information, we are going to add the Data Source. We can see that we have different options of Data Source: - Disk Image or VM File: A file that is byte-for-byte copy of a hard drive, media card or Virtual Machine. - Local Disk: Local storage device. It can be a local drive, a USB-attached drive, etc. - Logical Files: Files or folders that are on the computer without having to put them into a disk image. - Unallocated Space Image File: Any type of file that does not contain a file system. - Autopsy Logical Imager Results: The results from running the logical imager. The logical imager allows you to collect files from a live Windows computer. - XRY Text Export: The results from exporting text files from XRY. We are going to select the Disk Image we have created from the pen drive called FlashDisk01.001. 20 Figure 6. Selection of Data Source Type in Autopsy Figure 7. Selection of the Disk Image to analyze in Autopsy 2.1.3. Ingest Modules Ingest Modules analyze the data in a data source (in our case the FlashDisk01.001), they are configured to find user content quickly and run in the background. They are used to post the results on the Blackboard, so you can find them in the “Results” area of the Tree Viewer explained in the next section. There are different Ingest Modules available that Autopsy gives to us, the most important are: Recent Activity, Hash Lookup, File Type Identification, Extension Mismatch Detector, Embedded File Extraction, Picture Analyzer, Keyword Search, Email Parser, Encryption Detection, Interesting Files Identifier, Central Repository, PhotoRec Carver, Virtual Machine Extractor, Data Source Integrity, Drone Analyzer, iOS Analyzer, Android Analyzer and GPX Parser. For further information see Appendix I: Ingest Modules in Autopsy. Figure 8. Configuration of Ingest Modules in Autopsy 2.1.4. User Interface Layout As shown, the user interface is divided in five main areas: Tree Viewer, Result Viewer, Content Viewer, Keyword Search and Status Area. 21 Figure 9. Autopsy User Interface Layout (I) Figure 10. Autopsy User Interface Layout (II) The Keyword Search allows the examiner to search for keywords in the data source. It uses the Keyword Search Module. Status Area Keyword Search Result Viewer Content Viewer Tree Viewer 22 The Status Area is the region where can be seen the status of the data source analysis with a charger bar and a panel (when clicking on the yellow dot) with notifications. The Tree Viewer is on the left side of the Autopsy user interface and it contains four main areas: - Data Sources: shows the sources added to the case. - Views: shows specific type of files from the data sources. - Results: shows the results of the ingest modules. - Reports: shows the reports generated. The Result Viewer is on the top-right and shows the lists of files and their corresponding attributes. There are two ways of displaying the results: - Table Results Viewer: displays the data catalog as a table with some details of each file (see image above). - Thumbnail Results Viewer: shows the data as a table of thumbnail images. Mostly used when we want to see the image itself. The Content Viewer is on the bottom-right side and displays the specific selected file in a variety of formats and options to describe the file such as Hexadecimal, Text, Application, File Metadata, Context, Results, Annotations and Other Occurrences. We can also see that there are a bunch of files detected in the pen drive that remember, it was supposedly empty. The reason of that is the usage of the Carver modules, these modules have carved the deleted files from the unallocated space found in the data source. 2.1.5. Adding your own modules As we said, one of the most important properties of Autopsy is the possibility to add your own personalized Ingest Modules either in Java or Python (Jython). Autopsy is built on top of NetBeans Rich Client Platform, which makes easy to work with a plug-in environment. For that reason, if you want to develop a module in Java, you will have to download NetBeans and work from there. On the other hand, Autopsy also uses Jython to enable Python scripting. Jython is like Python but converts the script into Java byte code to be perfectly understandable by Autopsy. Using it is very easy and allows you to access all of the Java services and classes that you need. To add Java or Python Modules you have the following options in Autopsy: Figure 11. How to add Java/Python Modules in Autopsy Add Java Modules Add Python Modules 23 2.1.6. Generating a Report In order to create a report, the user have to choose the “Tools” option and select “Generate a Report” (see Figure 11). Different types of Report Modules can be chosen as shown in the Figure 12. After selecting the type of report we have to choose which information we want to include in the report. The examiner is able to select “All Results”, in that case you are going to include in the report all the results found by the Ingest Modules, however, you can then optionally choose which type of data from the Ingest Modules you want to include in the report (“Choose Result Types…” button). If you choose “Tagged Results”, you can restrict the files and results that appear in the report to only those that are tagged with the tags you select. Figure 12. Select the type of Report in Autopsy Figure 13. Configuration of the Report in Autopsy 2.2. Image Metadata Image metadata is a set of data describing and providing information about an image. It allows information to be transported with an image file, in a way that can be understood by other software and human users. There are three main categories of image metadata: - Technical metadata: automatically generated by the camera. It includes camera details and settings such as camera brand and model, date and time when the image was created, GPS location where it was created, aperture, focal range, shutter speed, ISO number, flash settings, etc. - Descriptive metadata: manually added by the photographer or someone managing the image. It includes the name of the image creator, keywords related to the image, captions, title and comments, among many other possibilities. - Administrative metadata: manually added. It includes usage and licensing rights, copyright restrictions, contact information for the owner of the image, etc. 24 Taking into account these three main categories, several standardized formats of metadata were created, including: Exchangeable Image File Format (EXIF), Information Interchange Model (IPTC), Extensible Metadata Platform (XMP), Dublin Core Metadata Initiative (DCMI) and Picture Licensing Universal System (PLUS). EXIF and IPTC are the most used metadata formats nowadays. This is because knowing the information in both standards, you are able to figure out almost all the knowledge available in the image: Technical, Descriptive and Administrative metadata. During the next sections I will explain you in more detail the EXIF and IPTC metadata formats and how Autopsy or other programs extract this type of information. 2.2.1. Exchangeable Image File Format (EXIF) The EXIF standard was managed by the Japan Electronics and Information Technology industries Association (JEITA) and Camera and Imaging Products Association (CIPA). In particular, it is a standard that defines a set of TIFF tags to describe images used by digital cameras (including smartphones), scanners and other systems handling image and sound files. The EXIF metadata can be found in TIFF, JPEG and PSD files. But, it is not used in JPEG 2000 or PNG. Furthermore, the major part of EXIF metadata is stored automatically by the device that took the photo; for that reason, this type of metadata is mostly technical. The information we can find extracting Exchangeable Image File Format metadata is the following and it covers four big categories: - Date and time information. Most digital cameras record the current date and time and save this in the metadata. - Camera settings. This includes static information such as the camera brand and model, information that varies with each image such as orientation (rotation), aperture, shutter speed, focal length, flash settings, and ISO information, etc. - Information about localization. Only available for digital cameras that have a connected GPS. - Description and copyright information. 2.2.1.1. EXIF in Autopsy The Picture Analyzer module of Autopsy extracts EXIF (Exchangeable Image File Format) information from ingested pictures. This information can contain geolocation data of the picture, time, date, camera model and settings (exposure values, resolution,…) and other information. The module also converts HEIC/HEIF images to JPG while maintaining their EXIF information, which will be processed and saved as it would for normal JPG images. The discovered attributes are added to the blackboard and can be seen by the user accessing to Results > Extracted Content > EXIF Metadata, in the Directory Tree of Autopsy. 31 - startUp(): where the module is initialized. Here is where normally you write the code that can fail, in that way, throwing an exception in the startUp() method causes the entire module to stop. - process(): where we do our analysis. Each file is passed into this method so you can analyze it. - shutDown(): where sources are freed and summary messages are sent, if necessary. We are going to write a module that analyzes every file title and sees if contains the string “HelloWorld”. If this is accomplished, we will put the file in an artifact on the blackboard. So, we create the method process() and do the analysis. First of all, we are going to skip non-files, we don’t want to analyze them. Secondly, we start filtering the files by its name: if the file contains the string “HelloWorld” in his title, we create an artifact and an attribute and we add that attribute to the artifact. We have to take into account that when a module wants to store its results on the blackboard, it makes an artifact of the correct type (in that case our chosen artifact is TSK_INTERESTING_FILE_HIT) and then adds attributes to it (in our case we only add one attribute called TSK_SET_NAME). Afterwards, we fire an event to notify that there is a new artifact. Accordingly, the UI is updated and refreshed with the new artifact when the module is executed. Finally, in the shutdown() method, we send a message to the ingest inbox with the number of files that the module has found. In the Appendix VII: HelloWorld.py you can see the full HelloWorld.py script. Figure 24. HelloWorld.py basic Autopsy module (I) Figure 25. HelloWorld.py basic Autopsy module (II) Once we have the code of the module, we are going to test it on Autopsy analyzing a folder (data source: Logical File) that contains different files, among them a text file called HelloWorld.txt. Therefore, we add the module as shown previously (see Figure 11) to the folder python_modules and we create another folder called DemoScript, in that folder we can add our HelloWorld.py module. Once we have it, we are able to execute our script in Autopsy. 32 Figure 26. Addition of the HelloWorld.py module in the DemoScript folder Figure 27. Selection of the Hello World module in Autopsy The results are the following and we can see that the behavior is what we expected. Figure 28. Hello World module results 33 4. Results 4.1. High Level module explanation As we said during the thesis, our result will be a module, developed in Python language, able to analyze any type of metadata found in an image. Specially, the metadata that the Picture Analyzer Autopsy own module cannot analyze. In this way, Autopsy will show in the Tree Viewer a new artifact called Image Metadata Analyzer with all the analyzed images inside and the metadata found. Figure 29. Image Metadata Analyzer preview Apart from analyzing image metadata, that is a big advantage for digital forensics investigators, the module will also be able to filter the metadata in order to facilitate users to find specific images that contain specific metadata they want to search for their cases. The current available filters are the following: Filter Type Text Pattern RegEx Pattern Simple Name1 “[a-zA-Z0-9]” NOT NOT Name1 “(NOT)\s[a-zA-Z0-9]” AND Name1 AND Name2 AND … “[a-zA-Z0-9]\s(AND)\s[a-zA-Z0-9]” OR Name1 OR Name2 OR … “[a-zA-Z0-9]\s(OR)\s[a-zA-Z0-9]” == MetadataTag == MetadataValue “[a-zA-Z0-9]\s(==)\s[a-zA-Z0-9]” != MetadataTag != MetadataValue “[a-zA-Z0-9]\s(!=)\s[a-zA-Z0-9]” CONTAINS MetadataTag CONTAINS Name “[a-zA-Z0-9]\s(CONTAINS)\s[a-zA-Z0-9]” 34 DOES NOT CONTAIN MetadataTag DOES NOT CONTAIN Name “[a-zA-Z0-9]\s(DOES\sNOT\sCONTAIN)\s[azA-Z0-9]” Table 6. Filters’ description (I) Filter Type Description Simple Simple filter. The module searches if the word is in the metadata of any image analyzed in the case. NOT NOT filter. The module searches if the word is NOT in the metadata of any image analyzed in the case. AND AND filter. The module searches if all the words are inside the metadata of any image. OR OR filter. The module searches if at least one of the words is inside the metadata of any image. == Filter by specific metadata tag and value. The module searches if a specific metadata value is inside any image. Remember that the MetadataTag must match perfectly accordingly to the ExifTool tag names [16]. != Filter by specific metadata tag and value. The module searches if a specific metadata value is NOT inside any image. Remember that the MetadataTag must match perfectly accordingly to the ExifTool tag names [16]. CONTAINS Filter by specific metadata tag. The module searches if any image contains the word in the metadata value of a specific MetadataTag. Remember that the MetadataTag must match perfectly accordingly to ExifTool tag names [16]. DOES NOT CONTAIN Filter by specific metadata tag. The module searches if any image does NOT contain the word in the metadata value of a specific MetadataTag. Remember that the MetadataTag must match perfectly accordingly to the ExifTool tag names [16]. Table 7. Filters’ description (II) Once the filters are entered, the results will be shown as Interesting Items, in the Tree Viewer of Autopsy. Moreover, you will be able to see, in the comments of the Results, in which Metadata Tags the filters have been found. For example, if the user want to know which are the images that were made with an iPhone, the module will search this specific word inside the metadata to filter and show only the images made with that specific device. After that, you will be able to see in which Metadata Tags the word has been found. This is also a big advantage that can facilitate and save a lot of time to investigators. Furthermore, you can insert more than one filter simultaneously to make your image search more precise (see Figure 30). 35 Figure 30. Image Metadata Filter preview See Appendix VIII: How to install the Image Metadata Analyzer Module to learn how to install the module in your computer. 4.1.1. Flux Diagram In the following figure you can see the flux diagram about the functioning of our module. Figure 31. Module’s flux diagram 36 Firstly, a file is requested and we check that is an image file such as JPG, PNG, TIFF, GIF or HEIC. If not, we discard it and request the following file. Once we have filtered the file by its type, we call the specific method of the ExifTool library to analyze the metadata of the image. Secondly, the metadata found is stored in a variable and since then, the program continue running following the specific path the user want to take: - Analyze only Image Metadata. The user selects on the Module GUI the type of metadata and image files he/she wants to analyze and the module analyze them (see Figure 32). - Use only the Image Metadata Filter. When we only want to filter images by its metadata, we have to select the type of image files we want to analyze, write the appropriate filters on the text field and select the “Use only the Image Metadata Filter” box. In this way, we will only make use of the filter mode. It is not necessary to select the type of metadata we want to analyze because in this mode, we analyze all the metadata available (see Figure 33). - Analyze Image Metadata and also make use of the Image Metadata Filter. When we want to analyze the image metadata and also use the filter, we have to deselect the “Use only the Image Metadata Filter” box and fill the other options according to the user goals. Figure 32. Image Metadata Analyzer Module GUI (I) Figure 33. Image Metadata Analyzer Module GUI (II) Finally, when the path is selected, the module creates the specific Artifact and Attributes accordingly to the path followed. The results will be shown in the Tree Viewer of the Autopsy User Interface as we have seen in Figure 29 and Figure 30. CAUTION: The “Use only Image Metadata Filter” box is created to avoid images to be analyzed every time the module is loaded. If the box is NOT selected, the images would be repeatedly added in the Image Metadata Analyzer section of the Directory Tree every time the module is executed and it would be an absolutely mess. When we select the box, we are saying that we do not want to analyze image metadata anymore (maybe, because we already did it before) and we only want to make use of the filter. RECOMMENDATIONS: When we want to analyze and also filter images, the best option is to first analyze only one time the metadata of the images and once we have it, load 37 again the module but this time only using the filter mode (“Use only the Image Metadata Filter” box selected). See Appendix IX: Example of Module usage. The code of the module is shown in Appendix X: ImageAnalyzerGUI.py and Appendix XI: ImageAnalyzerLib.py 4.2. Figure of merit The creation of our module enables efficient and automated analysis of image metadata, including an optimized filter to find the exact images the user is searching for. In this section, I will show you the efficiency that the module has analyzing and filtering image metadata. In that way, we will see the advantages that digital forensics investigators are going to have when using the module in their professional cases. We have to take into account that the tests have been done with a Macbook Pro 2015 15’’, accordingly, the results and speeds are directly related with the characteristics of the computer. 4.2.1. Image Metadata Analyzer Firstly, we are going to test the basic functionality of the module, that is, only using the Image Metadata Analyzer Mode. For that reason, we do different analysis and test up to 500 images (approximately 900 MB), in that way we see how the module reacts to that amount of data. In the next figures we can see the results. On the one hand, the Figure 34 shows us the amount of time that the module takes to analyze a specific number of images. We notice that the behavior is linear: if the number of images grow, the time will proportionally grow. On the other hand, in the Figure 35, there is the time that takes the module to analyze different amount of images’ Megabytes. The behavior is also linear as in the first graph: when the number of MB analyzed grow, the time will also grow. Figure 34. Image Metadata Analyzer behavior (I) Figure 35. Image Metadata Filter behavior (II) 38 4.2.2. Image Metadata Filter Secondly, we test the other functionality of our module: Image Filtering. In that case, we have the image metadata analysed and now we only want to make use of the filter. We are going to analyse the same amount of images analysed before and see if our module is efficient enough. On the one hand, in the Figure 36, we can see how the time taken to analyse a specific number of images using filters do not vary so much, it is almost constant. That is a very good information because the time that takes to filter a specific number of images will not change too much when increasing the number of filters used. On the other hand, watching the Figure 37 we confirm the behavior explained before. The time taken to analyze a number of images is practically the same when we raise the number of filters used and logically, it is directly proportional with the number of images analyzed: if the number of images analyzed grow, the time will also increase. Figure 36. Image Metadata Filter behaviour (I) Figure 37. Image Metadata Filter behaviour (II) All in all, with the figures explained above we conclude that the module is efficient enough. The module only takes near 4 minutes to analyze the image metadata of approximately 1 GB of data. But, the biggest advantage is when we have all the metadata analyzed and we only want to make use of the filter, the time taken to analyze and filter the images is incredibly fast and constant when adding new filters; in 1 minute we have filtered 500 images (1 GB of data approximately). Accordingly, when using the module you do not have to be scared of adding new filters, the module will respond to it perfectly and the difference of time lost using 1 filter or 10 filters will be insignificant. 39 5. Budget We choose the Full Costing method to calculate the expenses of the project during a period of 4 months. For that reason, we are going to take into account the Direct Costs and Indirect Costs generated. 5.1. Direct Costs During the project we have used several free open-source tools such as: Autopsy, SPYDER, ExifTool and VirtualBox. For that reason, there will not be direct costs related to software licenses. The only direct costs of the project are going to be the computer used and the junior engineer salary: - Computer: A Macbook Pro 2015 15’’ will be used for the proper development of the project. It has a cost of 1.500 €. - Junior Engineer: The developer of the project. We consider a gross salary of approximately 25.000€ per year. Cost (initial value) Years of life Final value Depreciable Value Computer 1.500 € 10 150 € 1.485 € Table 8. Direct Costs (I) Table 9. Direct Costs (II) We take into account that the Depreciable Value (amortization) is calculated as follows: 5.2. Indirect Costs The Indirect Costs of the project is only the Project Manager salary. Gross Salary x hour Hours working in a month (only week days) Gross Salary in 4 months Project Manager 20 € 8 hours 640 € Table 10. Indirect Costs All in all, the Total Budget of our project during a period of 4 months and taking into account the Full Costing method (Direct Costs + Indirect Costs) is: Direct Costs 5.005 € Indirect Costs 640 € TOTAL Budget 5.645 € Table 11. Full Costing Total Budget Gross Salary x hour Hours working in a day Hours working in a month (only week days) Gross Salary in 4 months Junior Engineer 11 € 4 hours 80 hours 3.520 € 40 6. Conclusions and future development 6.1. Conclusions Digital forensics is a very important field for society, any little contribution you can do is a major improvement and a big advantage that investigators can take in a professional case. This thesis has tried to help investigators to have an efficient and automated tool to analyse image metadata and reveal clear evidences in a court of law while using the same software they are used to employ in other investigations: Autopsy. Based on the contributions done in this thesis, we have detected an important gap in the Autopsy framework and we have solved it creating a very demanded feature consisting in an Autopsy plug-in module capable of analyzing image metadata and enable the user to perform the filtering of image data bases based on a set of configurable rules. For that reason, investigators are not forced to run another external software to execute this functionality, this feature is integrated into the Autopsy framework through this new available open source plug-in. According to the results, we have shown that the Image Metadata Analyzer Module works perfectly in real cases. Furthermore, the usability of the filters is very powerful and makes the software more user friendly and comfortable to work with. For that reason, the time you can spend using this module instead of other programs that are not specifically automated for the analysis of all the image metadata found in a picture is huge, and since now, we had not known about any other Autopsy plug-in that fits with these needs. Taking into account that my knowledge about cybersecurity and digital forensics before starting this thesis was non-existent, I can say that after 4 months of individual hard work the learnings have been enormous and I am very happy with all the results achieved, not only the academic results, also the personal learnings. For that reason, this project have encouraged me to not stop and continue learning about the topic and the cybersecurity field. Covid-19 pandemic has altered the way the final degree thesis was used to be done, for that reason, the project was done fully from home, with no face-to-face meetings and learnings. Despite these difficulties and keeping in mind that I had no prior knowledge about the topic, the project objectives have been perfectly and successfully achieved. Moreover, I want to make a special mention and thank my project supervisor Josep Pegueroles, who always has listened, advised and helped me. It was not easy, as any big challenge you face in your life, there are always big steps, but also huge falls. Even so, the secret is always to fall forward and continue working hard, pursuing your goals and doing what you are passionate about. 6.2. Future Development The metadata field in digital forensics is very big as well as important, in this thesis we only have focused on a little section, that is metadata in pictures. But, any digital file contains metadata inside that can help investigators to find clear evidences in their professional cases too. For that reason, the module can continue growing in that way, creating a general metadata analyser module able to examine any digital file (for example: audio files, text files, video files,...) and obtain all the metadata found. 47 Black Mask Bottom Border : 0 Color Data Version : 9 (60D/1100D) WB RGGB Levels As Shot : 2709 1024 1024 1618 Color Temp As Shot : 5450 WB RGGB Levels Auto : 2709 1024 1024 1618 Color Temp Auto : 5450 WB RGGB Levels Measured : 2707 1024 1023 1617 Color Temp Measured : 5450 WB RGGB Levels Daylight : 2341 1024 1024 1533 Color Temp Daylight : 5200 WB RGGB Levels Shade : 2745 1024 1024 1314 Color Temp Shade : 7000 WB RGGB Levels Cloudy : 2539 1024 1024 1411 Color Temp Cloudy : 6000 WB RGGB Levels Tungsten : 1631 1024 1024 2320 Color Temp Tungsten : 3200 WB RGGB Levels Fluorescent : 2020 1024 1024 2131 Color Temp Fluorescent : 3732 WB RGGB Levels Kelvin : 2341 1024 1024 1533 Color Temp Kelvin : 5189 WB RGGB Levels Flash : 2621 1024 1024 1402 Color Temp Flash : 6211 Average Black Level : 2047 2047 2047 2047 Raw Measured RGGB : 114490 292254 295581 169095 Per Channel Black Level : 2047 2047 2047 2047 Specular White Level : 15094 Linearity Upper Margin : 10000 Picture Style User Def : Standard; Standard; Standard Picture Style PC : None; None; None Custom Picture Style File Name : Vignetting Corr Version : 0 Peripheral Lighting : Off Distortion Correction : Off Chromatic Aberration Corr : Off Peripheral Lighting Value : 0 Distortion Correction Value : 0 Original Image Width : 4272 Original Image Height : 2848 Peripheral Lighting Setting : Off Peripheral Illumination Corr : Off Auto Lighting Optimizer : Standard Ambience Selection : Standard User Comment : Sub Sec Time : 00 Sub Sec Time Original : 00 Sub Sec Time Digitized : 00 Flashpix Version : 0100 Color Space : sRGB Exif Image Width : 4272 Exif Image Height : 2848 Interoperability Index : R98 - DCF basic file (sRGB) Interoperability Version : 0100 Focal Plane X Resolution : 4720.441989 Focal Plane Y Resolution : 4786.554622 Focal Plane Resolution Unit : inches Custom Rendered : Normal Exposure Mode : Auto Scene Capture Type : Standard Owner Name : Serial Number : 063061003567 Lens Info : 28-80mm f/? Lens Model : EF28-80mm f/3.5-5.6 Lens Serial Number : 0000000000 Compression : JPEG (old-style) Thumbnail Offset : 9052 Thumbnail Length : 8720 Rating : 0 Image Width : 4272 Image Height : 2848 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1) 48 Drive Mode : Single-frame Shooting File Number : 100-8627 Lens : 28.0 - 80.0 mm Shooting Mode : Flash Off WB RGGB Levels : 2709 1024 1024 1618 Aperture : 3.5 Blue Balance : 1.580078 Image Size : 4272x2848 Lens ID : Canon EF 28-80mm f/3.5-5.6 Megapixels : 12.2 Red Balance : 2.645508 Scale Factor To 35 mm Equivalent: 1.6 Shutter Speed : 1/50 Create Date : 2016:12:30 22:20:21.00 Date/Time Original : 2016:12:30 22:20:21.00 Modify Date : 2016:12:30 22:20:21.00 Thumbnail Image : (Binary data 8720 bytes, use -b option to extract) Lens : 28.0 - 80.0 mm (35 mm equivalent: 44.0 - 125.8 mm) Circle Of Confusion : 0.019 mm Depth Of Field : inf (0.00 m - inf) Field Of View : 44.5 deg Focal Length : 28.0 mm (35 mm equivalent: 44.0 mm) Hyperfocal Distance : 11.73 m Light Value : 7.3 49 Appendix III: ExifTool analysis of iptc-image.jpg MacBook-Pro-de-Jordi:3.Metadata JORDI$ exiftool iptc-image.jpg ExifTool Version Number : 12.21 File Name : iptc-image.jpg Directory : . File Size : 126 KiB File Modification Date/Time : 2021:03:02 10:01:14+01:00 File Access Date/Time : 2021:03:02 11:06:46+01:00 File Inode Change Date/Time : 2021:03:02 11:06:45+01:00 File Permissions : -rw-r--r-- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg Exif Byte Order : Big-endian (Motorola, MM) Image Description : The description aka caption (ref2019.1) X Resolution : 72 Y Resolution : 72 Resolution Unit : inches Artist : Creator1 (ref2019.1) Y Cb Cr Positioning : Centered Copyright : Copyright (Notice) 2019.1 IPTC - www.iptc.org (ref2019.1) Current IPTC Digest : 1a752785c1ca57e321cf228e3c3e8498 Object Attribute Reference : A Genre (ref2019.1) Object Name : The Title (ref2019.1) Subject Reference : IPTC:1ref2019.1, IPTC:2ref2019.1, IPTC:3ref2019.1 Keywords : Keyword1ref2019.1, Keyword2ref2019.1, Keyword3ref2019.1 Special Instructions : An Instruction (ref2019.1) Time Created : 19:01:00+00:00 By-line : Creator1 (ref2019.1) By-line Title : Creator's Job Title (ref2019.1) Sub-location : Sublocation (Core) (ref2019.1) Province-State : Province/State (Core) (ref2019.1 Country-Primary Location Code : R19 Country-Primary Location Name : Country (Core) (ref2019.1) Original Transmission Reference : Job Id (ref2019.1) Copyright Notice : Copyright (Notice) 2019.1 IPTC - www.iptc.org (ref2019.1) Caption-Abstract : The description aka caption (ref2019.1) Writer-Editor : Description Writer (ref2019.1) Application Record Version : 4 XMP Toolkit : Image::ExifTool 11.74 Country Code : R19 Creator City : Creator's CI: City (ref2019.1) Creator Country : Creator's CI: Country (ref2019.1) Creator Address : Creator's CI: Address, line 1 (ref2019.1) Creator Postal Code : Creator's CI: Postcode (ref2019.1) Creator Region : Creator's CI: State/Province (ref2019.1) Creator Work Email : Creator's CI: Email@1, Email@2 (ref2019.1) Creator Work Telephone : Creator's CI: Phone # 1, Phone # 2 (ref2019.1) Creator Work URL : http://www.Creators.CI/WebAddress/ref2019.1 Intellectual Genre : A Genre (ref2019.1) Location : Sublocation (Core) (ref2019.1) Scene : IPTC-Scene-Code1 (ref2019.1), IPTC-Scene-Code2 (ref2019.1) Subject Code : 1ref2019.1, 2ref2019.1, 3ref2019.1 About Cv Term Cv Id : http://example.com/cv/about/ref2019.1 About Cv Term Id : http://example.com/cv/about/ref2019.1/code987 About Cv Term Name : CV-Term Name 1 (ref2019.1) About Cv Term Refined About : http://example.com/cv/refinements2/ref2019.1/codeX145 Additional Model Information : Additional Model Info (ref2019.1) Artwork Circa Date Created : AO Circa Date: between 1550 and 1600 (ref2019.1) Artwork Content Description : AO Content Description 1 (ref2019.1) Artwork Contribution Description: AO Contribution Description 1 (ref2019.1) Artwork Copyright Notice : AO Copyright Notice 1 (ref2019.1) Artwork Creator : AO Creator Name 1a (ref2019.1), AO Creator Name 1b (ref2019.1) Artwork Creator ID : AO Creator Id 1a (ref2019.1), AO Creator Id 1b (ref2019.1) Artwork Copyright Owner ID : AO Current Copyright Owner ID 1 (ref2019.1) Artwork Copyright Owner Name : AO Current Copyright Owner Name 1 (ref2019.1) Artwork Licensor ID : AO Current Licensor ID 1 (ref2019.1) Artwork Licensor Name : AO Current Licensor Name 1 (ref2019.1) Artwork Date Created : 1916:10:26 12:13:14+00:00 Artwork Physical Description : AO Physical Description 1 (ref2019.1) 50 Artwork Source : AO Source 1 (ref2019.1) Artwork Source Inventory No : AO Source Inventory No 1 (ref2019.1) Artwork Source Inv URL : AO Source Inventory URL (ref2019.1) Artwork Style Period : AO Style Baroque (ref2019.1), AO Style Italian Baroque (ref2019.1) Artwork Title : AO Title 1 (ref2019.1) Digital Image GUID : http://example.com/imageGUIDs/TestGUID12345/ref2019.1 Digital Source Type : http://cv.iptc.org/newscodes/digitalsourcetype/softwareImage Embedded Encoded Rights Expr : The Encoded Rights Expression (ref2019.1) Embedded Encoded Rights Expr Type: IANA Media Type of ERE (ref2019.1) Embedded Encoded Rights Expr Lang ID: http://example.org/RELids/id4711/ref2019.1 Event : An Event (ref2019.1) Genre Cv Id : http://example.com/cv/genre/ref2019.1 Genre Cv Term Id : http://example.com/cv/genre/ref2019.1/code1369 Genre Cv Term Name : Genre CV-Term Name 1 (ref2019.1) Genre Cv Term Refined About : http://example.com/cv/genrerefinements2/ref2019.1/codeY864 Image Region Name : Listener 1, Listener 2, Speaker 1 Image Region Organisation In Image Name: Organisation name no 1 in region persltr2 (ref2019.1), Organisation name no 1 in region persltr2 (ref2019.1), Organisation name no 1 in region persltr3 (ref2019.1) Image Region Person In Image : Person name no 1 in region persltr2 (ref2019.1), Person name no 1 in region persltr3 (ref2019.1), Person name no 1 in region persltr1 (ref2019.1) Image Region Boundary H : 0.385 Image Region Boundary Shape : Rectangle, Circle, Polygon Image Region Boundary Unit : Relative, Relative, Relative Image Region Boundary W : 0.127 Image Region Boundary X : 0.31, 0.59 Image Region Boundary Y : 0.18, 0.426 Image Region Ctype Name : Region Boundary Content Type Name (ref2019.1), Region Boundary Content Type Name (ref2019.1), Region Boundary Content Type Name (ref2019.1) Image Region Ctype Identifier : https://example.org/rctype/type2019.1a, https://example.org/rctype/type2019.1b, https://example.org/rctype/type2019.1a, https://example.org/rctype/type2019.1b, https://example.org/rctype/type2019.1a, https://example.org/rctype/type2019.1b Image Region ID : persltr2, persltr3, persltr1 Image Region Role Name : Region Boundary Content Role Name (ref2019.1), Region Boundary Content Role Name (ref2019.1), Region Boundary Content Role Name (ref2019.1) Image Region Role Identifier : https://example.org/rrole/role2019.1a, https://example.org/rrole/role2019.1b, https://example.org/rrole/role2019.1a, https://example.org/rrole/role2019.1b, https://example.org/rrole/role2019.1a, https://example.org/rrole/role2019.1b Image Region Boundary Rx : 0.068 Image Region Boundary Vertices X: 0.05, 0.148, 0.375 Image Region Boundary Vertices Y: 0.713, 0.041, 0.863 Linked Encoded Rights Expr : http://example.org/linkedrightsexpression/id986/ref2019.1 Linked Encoded Rights Expr Type : IANA Media Type of ERE (ref2019.1) Linked Encoded Rights Expr Lang ID: http://example.org/RELids/id4712/ref2019.1 Location Created City : City (Location created1) (ref2019.1) Location Created Country Code : R17 Location Created Country Name : CountryName (Location created1) (ref2019.1) Location Created Location Id : Location Id (Location created1) (ref2019.1) Location Created Province State : Province/State (Location created1) (ref2019.1) Location Created Sublocation : Sublocation (Location created1) (ref2019.1) Location Created World Region : Worldregion (Location created1) (ref2019.1) Location Shown City : City (Location shown1) (ref2019.1), City (Location shown2) (ref2019.1) Location Shown Country Code : R17, R17 Location Shown Country Name : CountryName (Location shown1) (ref2019.1), CountryName (Location shown2) (ref2019.1) Location Shown Location Id : Location Id 1a(Location shown1) (ref2019.1), Location Id 1b(Location shown1) (ref2019.1), Location Id 2a(Location shown2) (ref2019.1), Location Id 2b(Location shown2) (ref2019.1) Location Shown Province State : Province/State (Location shown1) (ref2019.1), Province/State (Location shown2) (ref2019.1) Location Shown Sublocation : Sublocation (Location shown1) (ref2019.1), Sublocation (Location shown2) (ref2019.1) Location Shown World Region : Worldregion (Location shown1) (ref2019.1), Worldregion (Location shown2) (ref2019.1) Max Avail Height : 14 Max Avail Width : 20 Model Age : 25, 27, 30 Organisation In Image Code : Organisation Code 1 (ref2019.1), Organisation Code 2 (ref2019.1), Organisation Code 3 (ref2019.1) 51 Organisation In Image Name : Organisation Name 1 (ref2019.1), Organisation Name 2 (ref2019.1), Organisation Name 3 (ref2019.1) Person In Image : Person Shown 1 (ref2019.1), Person Shown 2 (ref2019.1) Person In Image Cv Term Cv Id : http://example.com/cv/test99/ref2019.1 Person In Image Cv Term Id : http://example.com/cv/test99/code987/ref2019.1 Person In Image Cv Term Name : Person Characteristic Name 1 (ref2019.1) Person In Image Cv Term Refined About: http://example.com/cv/refinements987/codeY765/ref2019.1 Person In Image Description : Person Description 1 (ref2019.1) Person In Image Id : http://wikidata.org/item/Q123456789/ref2019.1, http://freebase.com/m/987654321/ref2019.1 Person In Image Name : Person Name 1 (ref2019.1) Product In Image Description : Product Description 1 (ref2019.1) Product In Image GTIN : 123456782019.1 Product In Image Name : Product Name 1 (ref2019.1) Registry Entry Role : Registry Entry Role ID 1 (ref2019.1), Registry Entry Role ID 2 (ref2019.1) Registry Item ID : Registry Image ID 1 (ref2019.1), Registry Image ID 2 (ref2019.1) Registry Organisation ID : Registry Organisation ID 1 (ref2019.1), Registry Organisation ID 2 (ref2019.1) Creator : Creator1 (ref2019.1), Creator2 (ref2019.1) Description : The description aka caption (ref2019.1) Rights : Copyright (Notice) 2019.1 IPTC - www.iptc.org (ref2019.1) Subject : Keyword1ref2019.1, Keyword2ref2019.1, Keyword3ref2019.1 Title : The Title (ref2019.1) Authors Position : Creator's Job Title (ref2019.1) Caption Writer : Description Writer (ref2019.1) City : City (Core) (ref2019.1) Country : Country (Core) (ref2019.1) Credit : Credit Line (ref2019.1) Date Created : 2019:10:16 19:01:00+00:00 Headline : The Headline (ref2019.1) Instructions : An Instruction (ref2019.1) Source : Source (ref2019.1) State : Province/State (Core) (ref2019.1) Transmission Reference : Job Id (ref2019.1) Copyright Owner ID : Copyright Owner Id 1 (ref2019.1), Copyright Owner Id 2 (ref2019.1) Copyright Owner Name : Copyright Owner Name 1 (ref2019.1), Copyright Owner Name 2 (ref2019.1) Image Creator ID : Image Creator Id 1 (ref2019.1), Image Creator Id 2 (ref2019.1) Image Creator Name : Image Creator Name 1 (ref2019.1), Image Creator Name 2 (ref2019.1) Image Creator Image ID : Image Creator Image ID (ref2019.1) Image Supplier ID : Image Supplier Id (ref2019.1) Image Supplier Name : Image Supplier Name (ref2019.1) Image Supplier Image ID : Image Supplier Image ID (ref2019.1) Licensor City : Licensor City 1 (ref2019.1), Licensor City 2 (ref2019.1) Licensor Country : Licensor Country 1 (ref2019.1), Licensor Country 2 (ref2019.1) Licensor Email : Licensor Email 1 (ref2019.1), Licensor Email 2 (ref2019.1) Licensor Extended Address : Licensor Ext Addr 1 (ref2019.1), Licensor Ext Addr 2 (ref2019.1) Licensor ID : Licensor ID 1 (ref2019.1), Licensor ID 2 (ref2019.1) Licensor Name : Licensor Name 1 (ref2019.1), Licensor Name 2 (ref2019.1) Licensor Postal Code : Licensor Postcode 1 (ref2019.1), Licensor Postcode 2 (ref2019.1) Licensor Region : Licensor Region 1 (ref2019.1), Licensor Region 2 (ref2019.1) Licensor Street Address : Licensor Street Addr 1 (ref2019.1), Licensor Street Addr 2 (ref2019.1) Licensor Telephone 1 : Licensor Phone1 1 (ref2019.1), Licensor Phone1 2 (ref2019.1) Licensor Telephone 2 : Licensor Phone2 1 (ref2019.1), Licensor Phone2 2 (ref2019.1) Licensor URL : Licensor URL 1 (ref2019.1), Licensor URL 2 (ref2019.1) Minor Model Age Disclosure : Age 25 or Over Model Release ID : Model Release ID 1 (ref2019.1), Model Release ID 2 (ref2019.1) Model Release Status : Not Applicable Property Release ID : Property Release ID 1 (ref2019.1), Property Release ID 2 (ref2019.1) Property Release Status : Not Applicable Rating : 1.0 Usage Terms : Rights Usage Termns (ref2019.1) Web Statement : http://www.WebStatementOfRights.org/2019.1 DCT Encode Version : 100 APP14 Flags 0 : (none) APP14 Flags 1 : (none) Color Transform : YCbCr Image Width : 1000 52 Image Height : 500 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:4:4 (1 1) Image Size : 1000x500 Megapixels : 0.500 Date/Time Created : 2019:10:16 19:01:00+00:00 Date/Time Original : 2019:10:16 19:01:00+00:00 53 Appendix IV: Output of PyExifTool library testing script Introduce the name of an image to analyze its metadata: Tivenys.jpg SourceFile Tivenys.jpg ExifTool:ExifToolVersion 11.99 File:FileName Tivenys.jpg File:Directory . File:FileSize 2137863 File:FileModifyDate 2021:03:16 16:58:10+01:00 File:FileAccessDate 2021:03:16 16:59:03+01:00 File:FileInodeChangeDate 2021:03:16 16:59:03+01:00 File:FilePermissions 644 File:FileType JPEG File:FileTypeExtension JPG File:MIMEType image/jpeg File:ExifByteOrder MM File:CurrentIPTCDigest 6973f3cedf1cc0919df9208428c7eb84 File:ImageWidth 3724 File:ImageHeight 2095 File:EncodingProcess 0 File:BitsPerSample 8 File:ColorComponents 3 File:YCbCrSubSampling 1 1 JFIF:JFIFVersion 1 1 JFIF:ResolutionUnit 0 JFIF:XResolution 72 JFIF:YResolution 72 EXIF:Make Apple EXIF:Model iPhone 7 EXIF:Orientation 1 EXIF:XResolution 72 EXIF:YResolution 72 EXIF:ResolutionUnit 2 EXIF:Software Instagram EXIF:ModifyDate 2020:01:07 17:59:46 EXIF:ExposureTime 0.01 EXIF:FNumber 1.8 EXIF:ExposureProgram 2 EXIF:ISO 32 EXIF:DateTimeOriginal 2020:01:07 17:59:46 EXIF:CreateDate 2020:01:07 17:59:46 EXIF:OffsetTime +01:00 EXIF:OffsetTimeOriginal +01:00 EXIF:OffsetTimeDigitized +01:00 EXIF:ShutterSpeedValue 0.0099989999964845 EXIF:ApertureValue 1.79999999993144 EXIF:BrightnessValue 5.405560449 EXIF:ExposureCompensation 0 EXIF:MeteringMode 5 EXIF:Flash 16 EXIF:FocalLength 3.99 EXIF:SubjectArea 1861 1047 2048 922 EXIF:SubSecTimeOriginal 323 EXIF:SubSecTimeDigitized 323 EXIF:ColorSpace 1 EXIF:ExifImageWidth 3724 EXIF:ExifImageHeight 2095 EXIF:SensingMethod 2 EXIF:SceneType 1 EXIF:ExposureMode 0 EXIF:WhiteBalance 0 EXIF:FocalLengthIn35mmFormat 33 EXIF:LensInfo 3.99000001 3.99000001 1.8 1.8 EXIF:LensMake Apple EXIF:LensModel iPhone 7 back camera 3.99mm f/1.8 MakerNotes:RunTimeFlags 1 MakerNotes:RunTimeValue 26935085311125 MakerNotes:RunTimeEpoch 0 MakerNotes:RunTimeScale 1000000000 54 MakerNotes:AccelerationVector -0.9902680512 -0.01313300897 0.1290269494 XMP:XMPToolkit Image::ExifTool 12.21 XMP:Creator Jordi Domenech Fons XMP:DateCreated 2020:01:07 17:59:46.323 XMP:CreateDate 2020:01:07 17:59:46.323 XMP:CreatorTool Instagram XMP:ModifyDate 2020:01:07 17:59:46 IPTC:CodedCharacterSet %G IPTC:EnvelopeRecordVersion 4 IPTC:ApplicationRecordVersion 2 IPTC:DigitalCreationTime 17:59:46 IPTC:DigitalCreationDate 2020:01:07 IPTC:DateCreated 2020:01:07 IPTC:TimeCreated 17:59:46 IPTC:City Tivenys Photoshop:IPTCDigest 5506f87b54ab2687ff9a954d70603f29 Composite:RunTimeSincePowerUp 26935.085311125 Composite:Aperture 1.8 Composite:ImageSize 3724 2095 Composite:Megapixels 7.80178 Composite:ScaleFactor35efl 8.27067669172932 Composite:ShutterSpeed 0.01 Composite:SubSecCreateDate 2020:01:07 17:59:46.323+01:00 Composite:SubSecDateTimeOriginal 2020:01:07 17:59:46.323+01:00 Composite:SubSecModifyDate 2020:01:07 17:59:46+01:00 Composite:DateTimeCreated 2020:01:07 17:59:46 Composite:DigitalCreationDateTime 2020:01:07 17:59:46 Composite:CircleOfConfusion 0.00363286605785387 Composite:FOV 57.2209676644142 Composite:FocalLength35efl 33 Composite:HyperfocalDistance 2.43457916123253 Composite:LightValue 9.98370619265935 55 Appendix V: PyExifTool testing script 1. import exiftool 2. import re 3. 4. while (True): 5. try: 6. print("Introduce the name of an image to analyze its metadata: ") 7. 8. file = input() 9. # Extract image metadata from the file 10. with exiftool.ExifTool() as et: 11. metadata = et.get_metadata(file) 12. 13. break 14. 15. except ValueError: 16. print("Error: File not found!") 17. 18. # Print all the metadata 19. for m in range(0, len(metadata)): 20. print(list(metadata)[m],list(metadata.values())[m]) 21. 56 Appendix VI: PyExifTool Library 1. # -*- coding: utf-8 -*- 2. # PyExifTool <http://github.com/smarnach/pyexiftool> 3. # Copyright 2012 Sven Marnach 4. 5. # This file is part of PyExifTool. 6. # 7. # PyExifTool is free software: you can redistribute it and/or modify 8. # it under the terms of the GNU General Public License as published by 9. # the Free Software Foundation, either version 3 of the licence, or 10. # (at your option) any later version, or the BSD licence. 11. # 12. # PyExifTool is distributed in the hope that it will be useful, 13. # but WITHOUT ANY WARRANTY; without even the implied warranty of 14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15. # 16. # See COPYING.GPL or COPYING.BSD for more details. 17. 18. """ 19. PyExifTool is a Python library to communicate with an instance of Phil 20. Harvey's excellent ExifTool_ command-line application. The library 21. provides the class :py:class:`ExifTool` that runs the command-line 22. tool in batch mode and features methods to send commands to that 23. program, including methods to extract meta-information from one or 24. more image files. Since ``exiftool`` is run in batch mode, only a 25. single instance needs to be launched and can be reused for many 26. queries. This is much more efficient than launching a separate 27. process for every single query. 28. 29. .. _ExifTool: http://www.sno.phy.queensu.ca/~phil/exiftool/ 30. 31. The source code can be checked out from the github repository with 32. 33. :: 34. 35. git clone git://github.com/smarnach/pyexiftool.git 36. 37. Alternatively, you can download a tarball_. There haven't been any 38. releases yet. 39. 40. .. _tarball: https://github.com/smarnach/pyexiftool/tarball/master 41. 42. PyExifTool is licenced under GNU GPL version 3 or later. 43. 44. Example usage:: 45. 46. import exiftool 47. 48. files = ["a.jpg", "b.png", "c.tif"] 49. with exiftool.ExifTool() as et: 50. metadata = et.get_metadata_batch(files) 51. for d in metadata: 52. print("{:20.20} {:20.20}".format(d["SourceFile"], 53. d["EXIF:DateTimeOriginal"])) 54. """ 55. 56. from __future__ import unicode_literals 57. 58. import sys 59. import subprocess 60. import os 61. import json 62. import warnings 63. import codecs 64. 63 Appendix VIII: Installation procedure of the Image Metadata Analyzer Module For the proper installation of the module you will have to install first of all the Jython Installer on your computer from the following URL [17]. Figure 38. Jython Download We only have to follow the installation procedure. In my case, I installed the Standard version on the C:\jython2.7.2 folder of my computer. Figure 39. Jython Installation (I) Figure 40. Jython Installation (II) 64 Figure 41. Jython Installation (III) Figure 42. Jython Installation (IV) Once the installation of Jython is done, we are going to install the ExifTool command-line tool developed by Phil Harvey [6]. Figure 43. ExifTool Download A zip file will be downloaded with the .exe inside. We will only need to copy and paste it on the proper directory: C:\Windows\ . 65 Figure 44. ExifTool Installation (I) Figure 45. ExifTool Installation (II) Once the executable is copied, we will have to rename it to “exiftool.exe” for commandline use: our module uses the ExifTool software as a command-line. Figure 46. ExifTool Installation (III) Figure 47. ExifTool Installation (IV) After installing both Jython and ExifTool we are ready to install the Image Metadata Analyzer Module in Autopsy. For doing so, we will download the module code from my following public repository in GitHub as a ZIP file [18]. 66 Figure 48. Image Metadata Analyzer Module github repository When we have downloaded it, we only have to copy the folder “image_metadata_module”, that contains the module code, to the “python_module” folder of Autopsy (Tools > Python Plugins, see Figure 50 and Figure 51). Look at chapter 2 and 3 to learn how to add new Python modules in Autopsy. Figure 49. Image Metadata Analyzer Module Download 67 Figure 50. Image Metadata Analyzer Module Installation (I) Figure 51. Image Metadata Analyzer Module Installation (II) Once the Image Metadata Analyzer Module is installed in the proper path, we are finally able to use it in our case! For doing so, we go to Tools > Run Ingest Modules (see Figure 50) and select the Data Source we want the module run. We can search the module in the pull of modules that Autopsy has and we will find it as Image Metadata Analyzer Module. 68 Figure 52. Image Metadata Analyzer Module GUI (I) Figure 53. Image Metadata Analyzer Module GUI (II) CAUTION: The module works with Jython 2.7.2, ExifTool 12.25 and Autopsy 4.18.0. It is not checked if it also runs with further versions of the programs. 69 Appendix IX: Usage of the Image Metadata Analyzer Module Once we have downloaded the module, we are ready to use it. In this section, I will show you a basic example of how to properly employ it. We are going to analyze a folder that contains 6 different images. First of all, we start analyzing only the metadata of each image. Accordingly, we select in the Analyzer Menu of the GUI the type of metadata we want to analyze and the type of image file; we select all the boxes because we want to analyze all the available metadata of the 5 different type of images (jpg, png, tiff, gif and heic). After that, we load the module just clicking on the button “Load Module”. CAUTION: It is important to click on the “Load Module” button every time we want to load the module. If we do not do it, the changes will not be saved and the module will not be executed correctly. Figue 54. Analyzer Menu GUI After loading the module, the results of the analyzed images will appear on the main page of Autopsy. 70 Figure 55. Analyzer Mode output in Autopsy Secondly, once the metadata of each image is analyzed, we are going to filter images by its metadata. To do so, we load again the module but this time using the “Filter Menu”. In the Filter Menu we will select the box “Use only the Image Metadata Filter”, because we have analyzed the image metadata before and we do not want to do it again. After that, we can add as much filters as we want (clicking on the “+” button) and we load the module again (“Load Module” button). Figure 56. Filter Menu GUI (I) The results will be shown as Interesting Items in the Tree Viewer of Autopsy. 71 You can see that the name of Interesting Items is the filter used. Apart from that, in the images filtered there is a section of comments that specifies you the metadata fields where the filters have been found and its value. Figure 57. Filter Mode output in Autopsy (I) If we want to insert new filters we only have to follow the same procedure making use only of the Image Metadata Filter in the Filter Menu: Figure 58. Filter Menu GUI (II) 72 Figure 59. Filter Mode output in Autopsy (II) 79 344. # - 5th level => filter by specific metadata attribute (Author == Jordi) 345. # - 6th level => filter by specific metadata attribute (Author != Jordi) 346. # - 7th level => filter by specific metadata attribute (Author CONTAIN Jordi) 347. # - 8th level => filter by specific metadata attribute (Author DOES NOT CONTAIN Jordi) 348. # TODO: - 9th level => "AND", "OR", "NOT" mixed filter 349. 350. validation = 0 351. 352. pattern_1 = "[a-zA-Z0-9]" 353. 354. pattern_2 = "[a-zA-Z0-9]\s(AND)\s[a-zA-Z0-9]" 355. 356. pattern_3 = "[a-zA-Z0-9]\s(OR)\s[a-zA-Z0-9]" 357. 358. pattern_4 = "(NOT)\s[a-zA-Z0-9]" 359. 360. pattern_5 = "[a-zA-Z0-9]\s(==)\s[a-zA-Z0-9]" 361. 362. pattern_6 = "[a-zA-Z0-9]\s(!=)\s[a-zA-Z0-9]" 363. 364. pattern_7 = "[a-zA-Z0-9]\s(CONTAINS)\s[a-zA-Z0-9]" 365. 366. pattern_8 = "[a-zA-Z0-9]\s(DOES\sNOT\sCONTAIN)\s[a-zA-Z0-9]" 367. 368. self.filterFound = True 369. 370. self.fileHitName_info = "" 371. self.fileHitComment_info = "" 372. 373. global imageFound 374. 375. 376. for m in range(filterCounter): 377. self.wordToSearch = self.local_settings.getSetting("word_search_" + str(m+1)) 378. self.log(Level.INFO, "word_search_" + str(m+1) + ": " + self.wordToSearch) 379. 380. 381. interestingFileHitArtifact = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT) 382. 383. for m in range(filterCounter): 384. 385. self.wordToSearch = self.local_settings.getSetting("word_search_" + str(m+1)) 386. 387. self.fileHitName_info += self.wordToSearch + " | \n" 388. 389. 390. if self.filterFound is True: 391. 392. # 5th LEVEL: "==" 393. if (re.search(pattern_5, self.wordToSearch)): 394. validation = 0 395. 396. # output[0] = tag of the metadata 397. # output[1] = corresponding value of the metadata 398. output = re.split("\s==\s", self.wordToSearch) 399. 400. for m in range(0, len(metadata)): 401. 402. metadataValue = ImageAnalyzerLib.metadataToString(imageMetadataValueList[m]) 80 403. 404. metadataTagPairs = re.split(":", imageMetadataTagList[m]) 405. 406. # There is usually an error with the first metadata because does not cotain the ':', 407. # and for that reason there is only 1 name in the list and not 2 408. try: 409. metadataTag = metadataTagPairs[1] 410. except: 411. metadataTag = metadataTagPairs[0] 412. 413. # If the tag is the same as introduced and it is the same name as the metadata value introduced, the filter is found 414. if metadataTag.lower() == output[0].lower() and metadataValue.lower() == output[1].lower(): 415. validation += 1 416. metadataEntireTag = imageMetadataTagList[m] 417. break 418. 419. # If it is true, the "==" condition has been accomplished 420. if validation == 1: 421. 422. metadataTagValue = metadataEntireTag + "=>" + metadataValue 423. 424. self.fileHitComment_info += "\n" + metadataTagValue + " | " 425. 426. else: 427. self.filterFound = False 428. self.log(Level.INFO, '"' + self.wordToSearch + '" filter not found in the metadata of ' + '"' + file.getName() + '"') 429. 430. # 6th LEVEL: "!=" 431. elif (re.search(pattern_6, self.wordToSearch)): 432. validation = 0 433. 434. # output[0] = tag of the metadata 435. # output[1] = corresponding value of the metadata 436. output = re.split("\s!=\s", self.wordToSearch) 437. 438. for m in range(0, len(metadata)): 439. 440. metadataValue = ImageAnalyzerLib.metadataToString(imageMetadataValueList[m]) 441. 442. metadataTagPairs = re.split(":", imageMetadataTagList[m]) 443. 444. # There is usually an error with the first metadata because does not cotain the ':', 445. # and for that reason there is only 1 name in the list and not 2 446. try: 447. metadataTag = metadataTagPairs[1] 448. except: 449. metadataTag = metadataTagPairs[0] 450. 451. # If the tag is the same as introduced and it is NOT the same name as the metadata value introduced, the filter is found 452. if metadataTag.lower() == output[0].lower() and metadataValue.lower() != output[1].lower(): 453. validation += 1 454. metadataEntireTag = imageMetadataTagList[m] 455. break 456. 81 457. # If it is true, the "!=" condition has been accomplished 458. if validation == 1: 459. 460. metadataTagValue = metadataEntireTag + "=>" + metadataValue 461. 462. self.fileHitComment_info += "\n" + metadataTagValue + " | " 463. 464. else: 465. self.filterFound = False 466. self.log(Level.INFO, '"' + self.wordToSearch + '" filter not found in the metadata of ' + '"' + file.getName() + '"') 467. 468. # 7th LEVEL: "CONTAINS" 469. elif (re.search(pattern_7, self.wordToSearch)): 470. validation = 0 471. 472. # output[0] = tag of the metadata 473. # output[1] = corresponding value of the metadata 474. output = re.split("\sCONTAINS\s", self.wordToSearch) 475. 476. for m in range(0, len(metadata)): 477. 478. metadataValue = ImageAnalyzerLib.metadataToString(imageMetadataValueList[m]) 479. 480. metadataTagPairs = re.split(":", imageMetadataTagList[m]) 481. 482. # There is usually an error with the first metadata because does not cotain the ':', 483. # and for that reason there is only 1 name in the list and not 2 484. try: 485. metadataTag = metadataTagPairs[1] 486. except: 487. metadataTag = metadataTagPairs[0] 488. 489. # If the tag is the same as introduced and it CONTAINS the metadata value introduced, the filter is found 490. # Here is the difference between '==' and 'CONTAINS' => output[1] in metadataValue 491. if (metadataTag.lower() == output[0].lower()) and (output[1].lower() in metadataValue.lower()): 492. validation += 1 493. metadataEntireTag = imageMetadataTagList[m] 494. break 495. 496. # If it is true, the "CONTAINS" condition has been accomplished 497. if validation == 1: 498. 499. metadataTagValue = metadataEntireTag + "=>" + metadataValue 500. 501. self.fileHitComment_info += "\n" + metadataTagValue + " | " 502. 503. else: 504. self.filterFound = False 505. self.log(Level.INFO, '"' + self.wordToSearch + '" filter not found in the metadata of ' + '"' + file.getName() + '"') 506. 507. # 8th LEVEL: "DOES NOT CONTAIN" 508. elif (re.search(pattern_8, self.wordToSearch)): 509. validation = 0 510. 82 511. # output[0] = tag of the metadata 512. # output[1] = corresponding value of the metadata 513. output = re.split("\sDOES\sNOT\sCONTAIN\s", self.wordToSearch) 514. 515. for m in range(0, len(metadata)): 516. 517. metadataValue = ImageAnalyzerLib.metadataToString(imageMetadataValueList[m]) 518. 519. metadataTagPairs = re.split(":", imageMetadataTagList[m]) 520. 521. # There is usually an error with the first metadata because does not cotain the ':', 522. # and for that reason there is only 1 name in the list and not 2 523. try: 524. metadataTag = metadataTagPairs[1] 525. except: 526. metadataTag = metadataTagPairs[0] 527. 528. # If the tag is the same as introduced and it DOES NOT CONTAIN the metadata value introduced, the filter is found 529. # Here is the difference between '!=' and 'DOES NOT CONTAIN' => output[1] not in metadataValue 530. if (metadataTag.lower() == output[0].lower()) and (output[1].lower() not in metadataValue.lower()): 531. validation += 1 532. metadataEntireTag = imageMetadataTagList[m] 533. break 534. 535. # If it is true, the "DOES NOT CONTAIN" condition has been accomplished 536. if validation == 1: 537. 538. metadataTagValue = metadataEntireTag + "=>" + metadataValue 539. 540. self.fileHitComment_info += "\n" + metadataTagValue + " | " 541. 542. else: 543. self.filterFound = False 544. self.log(Level.INFO, '"' + self.wordToSearch + '" filter not found in the metadata of ' + '"' + file.getName() + '"') 545. 546. # 2nd LEVEL: "AND". 547. # - We can include as many "AND" as we want: Canon AND iPhone AND Jordi AND ... 548. elif (re.search(pattern_2, self.wordToSearch)): 549. metadataTagValueList = [] 550. validation = 0 551. output = re.split("\sAND\s", self.wordToSearch) # Output is a list containing the words to search 552. 553. for x in output: 554. 555. for m in range(0, len(metadata)): 556. 557. # Check the value of the metadata: if it is not a string, convert it to string for a correct evaluation 558. # metadataValue is the str of each metadata value 559. metadataValue = ImageAnalyzerLib.metadataToString(imageMetadataValueList[m]) 560. 561. if x.lower() in metadataValue.lower(): 562. validation += 1 83 563. break 564. 565. # If it is true, the "AND" condition has been accomplished 566. if validation == len(output): 567. 568. # Adding the comments, that is the tags where the metadata values have been found 569. for x in output: 570. for m in range(0, len(metadata)): 571. 572. metadataValue = ImageAnalyzerLib.metadataToString(imageMetadataValueList[m]) 573. 574. if x.lower() in metadataValue.lower(): 575. metadataTagValue = imageMetadataTagList[m] + "=>" + metadataValue 576. metadataTagValueList.append(metadataTagValue) 577. 578. self.fileHitComment_info += "\n" + ' | \n'.join(metadataTagValueList) 579. 580. else: 581. self.filterFound = False 582. self.log(Level.INFO, '"' + self.wordToSearch + '" filter not found in the metadata of ' + '"' + file.getName() + '"') 583. 584. # 3rd LEVEL: "OR". 585. # - We can include as many "OR" as we want: Canon OR iPhone OR Jordi OR ... 586. elif (re.search(pattern_3, self.wordToSearch)): 587. metadataTagValueList = [] 588. validation = 0 589. output = re.split("\sOR\s", self.wordToSearch) # Output is a list containing the words to search 590. 591. for x in output: 592. 593. for m in range(0, len(metadata)): 594. 595. # Check the value of the metadata: if it is not a string, convert it to string for a correct evaluation 596. # metadataValue is the str of each metadata value 597. metadataValue = ImageAnalyzerLib.metadataToString(imageMetadataValueList[m]) 598. 599. if x.lower() in metadataValue.lower(): 600. validation += 1 601. 602. # If it is true, the "OR" condition has been accomplished 603. if validation > 0: 604. 605. # Adding the comments, that is the tags where the metadata values have been found 606. for x in output: 607. for m in range(0, len(metadata)): 608. 609. metadataValue = ImageAnalyzerLib.metadataToString(imageMetadataValueList[m]) 610. 611. if x.lower() in metadataValue.lower(): 612. metadataTagValue = imageMetadataTagList[m] + "=>" + metadataValue 613. metadataTagValueList.append(metadataTagValue) 614. 615. self.fileHitComment_info += "\n" + ' | \n'.join(metadataTagValueList) 84 616. 617. else: 618. self.filterFound = False 619. self.log(Level.INFO, '"' + self.wordToSearch + '" filter not found in the metadata of ' + '"' + file.getName() + '"') 620. 621. # 4th LEVEL: "NOT". 622. # - We can only include one "not" 623. elif (re.search(pattern_4, self.wordToSearch)): 624. validation = 0 625. output = re.sub("NOT\s", "", self.wordToSearch) # Output is a list containing the words to search 626. 627. for m in range(0, len(metadata)): 628. 629. # Check the value of the metadata: if it is not a string, convert it to string for a correct evaluation 630. # metadataValue is the str of each metadata value 631. metadataValue = ImageAnalyzerLib.metadataToString(imageMetadataValueList[m]) 632. 633. if output.lower() in metadataValue.lower(): 634. validation += 1 635. 636. # If it is true, the "NOT" condition has been accomplished 637. if validation == 0: 638. 639. self.fileHitComment_info += "\n" + "The metadata of the image does NOT contain the word searched: " + output + " | " 640. 641. else: 642. self.filterFound = False 643. self.log(Level.INFO, '"' + self.wordToSearch + '" filter not found in the metadata of ' + '"' + file.getName() + '"') 644. 645. # 1st LEVEL: One word. 646. # - We can only include one word to search 647. elif (re.search(pattern_1, self.wordToSearch)): 648. validation = 0 649. metadataTagValueList = [] 650. output = self.wordToSearch 651. 652. for m in range(0, len(metadata)): 653. 654. # Check the value of the metadata: if it is not a string, convert it to string for a correct evaluation 655. # metadataValue is the str of each metadata value 656. metadataValue = ImageAnalyzerLib.metadataToString(imageMetadataValueList[m]) 657. 658. if output.lower() in metadataValue.lower(): 659. metadataTagValue = imageMetadataTagList[m] + "=>" + metadataValue 660. metadataTagValueList.append(metadataTagValue) 661. validation += 1 662. 663. # If it is true, the 1st level condition has been accomplished 664. # Adding the comments, that is the tags where the metadata values have been found 665. if validation > 0: 666. 667. self.fileHitComment_info += "\n" + ' | \n'.join(metadataTagValueList) 668. 669. else: 670. self.filterFound = False 85 671. self.log(Level.INFO, '"' + self.wordToSearch + '" filter not found in the metadata of ' + '"' + file.getName() + '"') 672. 673. elif (self.wordToSearch == ""): 674. 675. self.filterFound = False 676. self.log(Level.INFO, "You have not entered any filter") 677. 678. else: 679. 680. self.filterFound = False 681. ImageAnalyzerLib.postInformationForTheUser(self, ImageMetadataFileIngestModuleWithUIFactory.moduleName, 682. Level.WARNING, IngestMessage.MessageType.ERROR, "Incorrect filter's input!") 683. 684. # If we find an image that contains the filters, we add the Interesting File Hit Attribute 685. if self.filterFound: 686. 687. # Dictionary (key:value) with the attribute name (key) and its type (value) 688. # { AttributeName: AttributeType } 689. attributesDict = { 690. self.fileHitName_info: BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, 691. self.fileHitComment_info: BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT 692. } 693. 694. ImageAnalyzerLib.addInterestingFileHitAttributes(interestingFileHitArtifact, 695. ImageMetadataFileIngestModuleWithUIFactory.moduleName, 696. attributesDict) 697. 698. imageFound = True 699. 700. 701. self.log(Level.INFO, "Image Found: " + str(imageFound)) 702. 703. #================== end of IMAGE METADATA FILTERING ==================# 704. 705. 706. return IngestModule.ProcessResult.OK 707. 708. 709. 710. # Where any shutdown code is run and resources are freed. 711. def shutDown(self): 712. # As a final part, we'll send a message to the ingest inbox with the number of files found (in this thread) 713. message = IngestMessage.createMessage( 714. IngestMessage.MessageType.INFO, ImageMetadataFileIngestModuleWithUIFactory.moduleName, 715. str(self.filesAnalyzed) + " files analyzed") 716. ingestServices = IngestServices.getInstance().postMessage(message) 717. 718. global imageFound 719. 720. # If we have not found any image that contain the filters introduced, we send a message to the user 721. if (not imageFound) and (self.fileHitName_info != " | \n"): 722. self.log(Level.WARNING, 'Filter "' + self.fileHitName_info + '" NOT FOUND !') 723. ImageAnalyzerLib.postInformationForTheUser(self, ImageMetadataFileIngestModuleWithUIFactory.moduleName, 86 724. Level.WARNING, IngestMessage.MessageType.WARNING, 'Filter "' + self.fileHitName_info + '" NOT FOUND !') 725. 726. 727. 728. 729. 730. #==============================================================================# 731. # -- PANEL GUI RELATED CLASSES -- # 732. #==============================================================================# 733. 734. #========================= start of GENERIC GUI CLASS =========================# 735. 736. # UI that is shown to user for each ingest job so they can configure the job. 737. class ImageMetadataFileIngestModuleWithUISettingsPanel(IngestModuleIngestJobSettingsPanel): 738. # Note, we can't use a self.settings instance variable. 739. # Rather, self.local_settings is used. 740. # https://wiki.python.org/jython/UserGuide#javabean-properties 741. # Jython Introspector generates a property - 'settings' on the basis 742. # of getSettings() defined in this class. Since only getter function 743. # is present, it creates a read-only 'settings' property. This auto- 744. # generated read-only property overshadows the instance-variable - 745. # 'settings' 746. 747. # We get passed in a previous version of the settings so that we can 748. # prepopulate the UI 749. def __init__(self, settings): 750. self.local_settings = settings 751. self.initComponents() 752. #self.customizeComponents() 753. 754. 755. def initComponents(self): 756. 757. self.setLayout(None) 758. 759. self.card = CardLayout() 760. self.mainPanel = JPanel(self.card) 761. self.mainPanel.setBounds(0,0,350,265) 762. 763. metadataAnalyzerGUI = JMetadataAnalyzerGUI(self.local_settings, self) 764. metadataFilterGUI = JMetadataFilterGUI(self.local_settings, self) 765. 766. metadataAnalyzerGUIPanel = metadataAnalyzerGUI.getPanel() 767. metadataFilterGUIPanel = metadataFilterGUI.getPanel() 768. 769. self.mainPanel.add(metadataAnalyzerGUIPanel, "1") 770. self.mainPanel.add(metadataFilterGUIPanel, "2") 771. 772. self.add(self.mainPanel) 773. 774. button1 = JButton("Analyzer Menu", actionPerformed = self.testEvent1) 775. button1.setHorizontalAlignment(SwingConstants.CENTER) 776. button1.setBounds(15, 275, 125, 22) 777. self.add(button1) 778. 779. button2 = JButton("Filter Menu", actionPerformed = self.testEvent2) 780. button2.setHorizontalAlignment(SwingConstants.CENTER) 781. button2.setBounds(160, 275, 125, 22) 782. self.add(button2) 783. 784. button3 = JButton("Load Module", actionPerformed = metadataFilterGUI.wordCheckBoxEvent) 785. button3.setHorizontalAlignment(SwingConstants.CENTER) 786. button3.setBounds(0, 300, 300, 22) 787. self.add(button3) 87 788. 789. 790. def customizeComponents(self): 791. pass 792. 793. 794. def testEvent1(self, event): 795. self.card.show(self.mainPanel, "1") 796. 797. 798. def testEvent2(self, event): 799. self.card.show(self.mainPanel, "2") 800. 801. # Return the settings used 802. def getSettings(self): 803. return self.local_settings 804. 805. #========================== end of GENERIC GUI CLASS ==========================# 806. 807. 808. #==================== start of METADATA ANALYZER GUI CLASS ====================# 809. 810. class JMetadataAnalyzerGUI: 811. 812. def __init__(self, settings, frame): 813. 814. self.local_settings = settings 815. self.frame = frame 816. self.initComponents() 817. self.customizeComponents() 818. 819. 820. def initComponents(self): 821. 822. self.panel = JPanel() 823. self.panel.setLayout(None) 824. #self.panel.setBackground(Color.gray) 825. 826. title1 = JLabel("IMAGE METADATA ANALYZER") 827. title1.setHorizontalAlignment(SwingConstants.LEFT) 828. title1.setFont(Font("Tahoma", Font.BOLD, 14)) 829. title1.setBounds(5, 10, 300, 20) 830. self.panel.add(title1) 831. 832. label1 = JLabel("Select the type of Metadata you want to analyze:") 833. label1.setHorizontalAlignment(SwingConstants.LEFT) 834. label1.setFont(Font("Default", Font.PLAIN, 11)) 835. label1.setBounds(5, 40, 300, 20) 836. self.panel.add(label1) 837. 838. # EXIF checkbox 839. self.exif_checkbox = JCheckBox("EXIF Metadata", actionPerformed=self.exifCheckBoxEvent) 840. self.exif_checkbox.setBounds(10, 60, 110, 20) 841. self.panel.add(self.exif_checkbox) 842. 843. # IPTC checkbox 844. self.iptc_checkbox = JCheckBox("IPTC Metadata", actionPerformed=self.iptcCheckBoxEvent) 845. self.iptc_checkbox.setBounds(130, 60, 110, 20) 846. self.panel.add(self.iptc_checkbox) 847. 848. # XMP checkbox 849. self.xmp_checkbox = JCheckBox("XMP Metadata", actionPerformed=self.xmpCheckBoxEvent) 850. self.xmp_checkbox.setBounds(10, 80, 110, 20) 851. self.panel.add(self.xmp_checkbox) 852. 88 853. # Other checkbox 854. self.other_checkbox = JCheckBox("Other", actionPerformed=self.otherCheckBoxEvent) 855. self.other_checkbox.setBounds(130, 80, 110, 20) 856. self.panel.add(self.other_checkbox) 857. 858. 859. label2 = JLabel("Select the type of image file you want to analyze:") 860. label2.setHorizontalAlignment(SwingConstants.LEFT) 861. label2.setFont(Font("Default", Font.PLAIN, 11)) 862. label2.setBounds(5, 110, 300, 20) 863. self.panel.add(label2) 864. 865. # JPG checkbox 866. self.jpg_checkbox = JCheckBox("JPG (JPEG)", actionPerformed=self.jpgCheckBoxEvent) 867. self.jpg_checkbox.setBounds(10, 130, 80, 20) 868. self.panel.add(self.jpg_checkbox) 869. 870. # PNG checkbox 871. self.png_checkbox = JCheckBox("PNG", actionPerformed=self.pngCheckBoxEvent) 872. self.png_checkbox.setBounds(105, 130, 80, 20) 873. self.panel.add(self.png_checkbox) 874. 875. # TIFF checkbox 876. self.tiff_checkbox = JCheckBox("TIFF", actionPerformed=self.tiffCheckBoxEvent) 877. self.tiff_checkbox.setBounds(200, 130, 80, 20) 878. self.panel.add(self.tiff_checkbox) 879. 880. # GIF checkbox 881. self.gif_checkbox = JCheckBox("GIF", actionPerformed=self.gifCheckBoxEvent) 882. self.gif_checkbox.setBounds(10, 150, 80, 20) 883. self.panel.add(self.gif_checkbox) 884. 885. # HEIC checkbox 886. self.heic_checkbox = JCheckBox("HEIC", actionPerformed=self.heicCheckBoxEvent) 887. self.heic_checkbox.setBounds(105, 150, 80, 20) 888. self.panel.add(self.heic_checkbox) 889. 890. self.frame.add(self.panel) 891. 892. 893. def customizeComponents(self): 894. 895. # Mantain the GUI EXIF box selected if selected before 896. self.exif_checkbox.setSelected(self.local_settings.getSetting("exif") == "true") 897. 898. # Mantain the GUI IPTC box selected if selected before 899. self.iptc_checkbox.setSelected(self.local_settings.getSetting("iptc") == "true") 900. 901. # Mantain the GUI XMP box selected if selected before 902. self.xmp_checkbox.setSelected(self.local_settings.getSetting("xmp") == "true") 903. 904. # Mantain the GUI Other box selected if selected before 905. self.other_checkbox.setSelected(self.local_settings.getSetting("other") == "true") 906. 907. # Mantain the GUI JPG box selected if selected before 908. self.jpg_checkbox.setSelected(self.local_settings.getSetting("jpg") == "true") 909. 910. # Mantain the GUI PNG box selected if selected before 95 125. IngestServices.getInstance().fireModuleDataEvent(ModuleDataEvent(moduleName, artId, None)) 126. 127. 128. 129. # Add a new Attribute in the File Interesting Hit Artifact 130. # artifact -> File Interesting Hit Artifact 131. # moduleName -> name of the module 132. # attributeName -> name of the attribute we want to visualize on the blackboard 133. def addInterestingFileHitAttribute(artifact, moduleName, attributeName): 134. 135. attribute = BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), moduleName, attributeName) 136. 137. artifact.addAttribute(attribute) 138. 139. IngestServices.getInstance().fireModuleDataEvent(ModuleDataEvent(moduleName, BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT, None)) 140. 141. 142. 143. # Add a new Attributes in the File Interesting Hit Artifact 144. # artifact -> File Interesting Hit Artifact 145. # moduleName -> name of the module 146. # attributeName -> name of the attribute we want to visualize on the blackboard 147. # comment -> string, comment you want to add 148. # attributesDict -> dictrionary with the name of the attributes and its type (ex: {'iPhone' : BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME}) 149. def addInterestingFileHitAttributes(artifact, moduleName, attributesDict): 150. attributesList = [] 151. 152. for m in range(0, len(attributesDict)): 153. attribute = BlackboardAttribute(list(attributesDict.values())[m].getTypeID(), moduleName, list(attributesDict)[m]) 154. attributesList.append(attribute) 155. 156. 157. artifact.addAttributes(attributesList) 158. 159. IngestServices.getInstance().fireModuleDataEvent(ModuleDataEvent(moduleName, 160. BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT, None))