Solved

figuring out extensions

Posted on 2014-03-20
8
209 Views
Last Modified: 2014-03-25
make a text file
compress it
rename it to .jpg
compress it again
 rename it to .jpg

it is not a .jpg, but will allowed to say so.

why did windows allow this? is it just a way to anonymize a file, if need be?

when you rename a extension, does it corrupt the file by any chance?

if the extension is renamed, is there any tool to extract the original extension in which it was created?
0
Comment
Question by:25112
8 Comments
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 144 total points
ID: 39942668
In general, extensions are just a convenience. They are functional in finding the correct application to open with file with if you double-click on one in Windows explorer. Changing the extension does not, by itself, change the file content.

It isn't clear why you would want to do such a series of actions
0
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 144 total points
ID: 39942675
The format of many file types can be determined or guessed at by looking at the contents, but there is no systematic way of doing so. If successful the original extension can be inferred.
0
 
LVL 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 71 total points
ID: 39942684
You could rename a jpg to png and the browsers and Windows Photo Viewer will still display it without problems, so I guess they test if the file has the right extension, and decide upon the header, kind of like in Linux.

Try to load a jpg renamed in png in Photoshop though, and all you'll get is an error.

My point is that it's the application's choice to trust that the extension is correct or not.

HTH,
Dan
0
 
LVL 14

Assisted Solution

by:Don Thomson
Don Thomson earned 71 total points
ID: 39942693
The only way to do it would be something like

Orig File   Text.txt
Compress it to Text.zip
Rename to Text.txt.jpg
Compress it to Text.txt.zip
rename it to Text.txt..zip.jpg
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 58

Assisted Solution

by:Gary
Gary earned 71 total points
ID: 39942703
The extension is pretty much just an indicator of what type of file it is and what program to use to open it with.
0
 
LVL 62

Assisted Solution

by:☠ MASQ ☠
☠ MASQ ☠ earned 71 total points
ID: 39942705
You can change a file extension to whatever you like, like changing the file name it has no effect on the content. However Windows has historically used file extensions to inform its Open With... command so most people will have an entry in their Windows registry that says if it ends with .jpg then treat it as a JPEG graphics format and open it with an appropriate program.  It's just a shorthand and makes the assumption that users will adopt a standard naming policy, as you describe it can be used to hide the true format of a file (sometimes maliciously).

The best way to get to the identify of a file is to look at the Hex signature in the file header though - if that's "FF D8 FF" then chances are whatever the file name and extension is it's probably a JPEG - some cleverer multimedia packages already look at the file header and will warn you if that and the file extension don't seem to be the same file type.

Although I said files aren't damaged simply by changing the file extension they can be harmed if they are then opened by the wrong program as a result.  Changing a .jpg extension to .txt and then opening and saving the file in a text editor rather than graphics program as a result might well convert the data from something like Unicode to ANSII rendering it useless if the file extension is changed back to its original setting.
0
 
LVL 47

Accepted Solution

by:
dbrunton earned 72 total points
ID: 39943226
>>  if the extension is renamed, is there any tool to extract the original extension in which it was created?

There are utils to determine what the file content is and thus the correct extension.

Examples:

Trid

Other Tools
0
 
LVL 5

Author Comment

by:25112
ID: 39954895
thanks- it helped me out
0

Featured Post

Integrate social media with email signatures

Is your company active on social media? Do you also use email signatures? Including social media icons in your email signature is a great way to get fans for free. Let all your email users know you’re on social media quickly and easily, in a single click.

Join & Write a Comment

Suggested Solutions

A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now