HEX Seperator

Description:

This code takes a text file that should consist of HEX values and divides it into sections based on the marker "FFD8", which is the start of a JPEG file. The output files are text files labeled sections followed by their iteration. From previous experiences working with JPEG images, I learned that as long as the end of the file marker exists, the garbage data after that marker doesn't matter.

Limitation:

Dividing a HEX conversion of a file into sections was done so that I could examine each individually. Initially, I only expected a few sections in my case, but I was wrong (see Flash Memory). 

If the file has multiple "FFD8" markers, expect a lot of text files. An issue with this code is that it only looks for the string "ffd8" in a text file and does not look for HEX markers in other file types.

Figure 1: Expected Input Text File

Figure 2: One of the Expected Output Text Files