File Names & Extensions
Every file inside a computer is given a file name that allows the computer user to easily remember the data contained within. Most, files are also given a file extension. File extensions are used not only by the user to help remember what type of data is being stored in the file but they also allow the operating system to know what application software should be responsible for using that file. It is important to note that file extensions aren't necessary. Just because a file has a .jpg extension on the end does not mean that it is necessarily a JPEG image file.
File Manipulation
As we stated at the beginning of the chapter, a file is nothing more than a string of bytes. It is all in how the bytes are interpreted that makes those bytes into the Word document or JPEG image. If you were to save the following JPEG image file and open it via NotePad (on Windows XP), Text Edit (OS X), or Pico (Linux) you would notice that the file opens just fine.
The main problem is that none of this information is readable by a human. However, this information (that has been translated by the above programs) is just a representation of the bytes that make up the image. Photo Shop, MS Paint, or any other image viewing/editing software simply understands how to interpret those bytes to create an image that your eyes and brain understands.
If you used NotePad, Text Edit, or Pico, you could remove a block of information from near the bottom of the file or add a bit of your own information, such as your name. If you were then to save the file (in a well behaving piece of software) you would find something that might look like something like the following file.
If you now double click the file (so your default graphics program opens the file), notice how the image has changed. The bottom portion of the image now has a pink tint to it. Also notice that area is not lined up correctly, especially if you look closely at the bushes and the placard in front of the statue. The file was manipulated, the bytes were changed, and the graphics software simply translated the new information and changed the way the image looked.
Malicious Use
The fact that file extensions do not necessarily make a file a certain type or behave a certain way can lend itself to malicious use. This often has to do with the carelessness of the user as well as the default setting in your operating system. For example, a virus is created and saved to a file. Now in order for the computer to run the virus program, the computer needs to think that the virus file is a .exe (or executable) file. Unfortunately, some operating systems hide certain file extensions to make the file names and icons appear cleaner. So the virus could be saved as Funnypic.exe and all the user would see is a file called Funnypic.
Now the icon of the file may be one that tips the user off that it is an executable and the user doesn't double click the file. What if however, the file were renamed to Funnypic.jpg.exe? The .exe portion of the file name/extension combo would be hidden so all the user would see is a file Funnypic.jpg. The only hint to tip the user off would be that the icon may not be a traditional .jpg icon.
This example reinforces the importance of anti-virus software that will scan real time files before they have the chance to severely damage your system.




