Identifying File Types with the file Command

  • Thread starter Thread starter messiah166
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around identifying file types, specifically focusing on files with the .oct extension. Participants explore methods for determining whether these files are Octave files and discuss tools and approaches for reverse engineering them. The conversation includes technical suggestions for file inspection and potential software to use.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant questions whether the .oct files are indeed Octave files and suggests using MATLAB to read them.
  • Another participant expresses skepticism about the ability to reverse engineer the files without first determining how to open them, recommending MATLAB as a test.
  • A different viewpoint suggests opening the file with a text editor like Notepad, proposing that if it is a program file, it might be a text file with a different extension, while a binary file would not be readable.
  • Another participant recommends using the hexdump command on Linux to view the file contents for identification purposes.
  • One post shares a link to external discussion about Octave files and their interaction with MATLAB.
  • A participant mentions the file command available on UNIX-like systems, which can identify files based on their content rather than their extension, and explains the concept of "magic" bytes in files.

Areas of Agreement / Disagreement

Participants present various methods for identifying the file type and express differing opinions on the best approach. There is no consensus on a single method or tool to use for reverse engineering the .oct files.

Contextual Notes

Some methods suggested depend on the operating system being used, and there may be limitations based on the file's actual content versus its extension. The effectiveness of each approach may vary based on the file's characteristics.

messiah166
Messages
1
Reaction score
0
Are these octave files? I have a program that ends in .oct that I am trying to reverse engineer, but I have no experience with .oct at all. If so, would MATLAB be the program to use to read the program?
 
Computer science news on Phys.org
I don't think anyone can divine this based on the information. If you can't figure out to how open it I doubt you're going to have much success trying to reverse engineer whatever it is.

Try it in MATLAB and see what happens.
 
First of all - try to open it with a notepad. If it is a program file, chances are it is just a text file with a different extension. If it is a binary file - notepad will just refuse to read it.
 
If you're on Linux or some variant thereof you could use the hexdump command to view the contents and determine what you have.
 
Also, most variants of UNIX, particularly Linux, have the file command, with broad capabilities to identify files based on what is in them. Not by extension.
Try the file command
Code:
file  [your filename goes here]
It will tell you if it is an octave file. Many proprietary files, especially for opensource programs, have "magic" at the beginning of the file ex:
Code:
#!/bin/bash
so the extension (in the example it could be: .sh, .shl, .bash) does not really matter, except to humans. The OS or the program knows to pretty much ignore the extension and check "magic" first.

It can usually identify source code file for common languages.

Solaris and its descendants have a magic.h file to implement this for example.
 
  • Like
Likes   Reactions: Borek and jedishrfu

Similar threads

Replies
38
Views
5K
  • · Replies 19 ·
Replies
19
Views
6K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 31 ·
2
Replies
31
Views
3K
Replies
10
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 16 ·
Replies
16
Views
6K
Replies
10
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K