I have a binary file with a structure unknown. I have found 2 perl scripts that it seems to do the convertion but I get sintactic errors when I run them, may somebody test these 2 scripts please and see if really work?
I'm not sure if some library is missing for me or if I'm running the script in wrong way.
I get this:
$ . conv.pl -t -f binaryfile
Order not found �use�, maybe wanted to say:
the order �nse� of packet �ns2� (universe)
the order �muse� of packet �muse� (universe)
the order �uae� of packet �uae� (multiverse)
use: order not found
my: order not found
my: order not found
bash: conv.pl: line 7: sintax error near unexpected element `('
bash: conv.pl: line 7: `sub tobinary() {'
If I convert some text file to binary with this script the output is 0s and 1s and If I convert the generated binary to text, the conversion is correct.
The issue is the file I want to convert, with this script doesn't show correctly converted to text.
Do you know another script or command to get this?
@Ophiuchus
This script is designed in a way that it converts all the characters to either binary or to text. By looking into the code, it uses functions such as
I suspect you're confused about what those scripts do. What those scripts refer to as "binary" is actually an ascii text string of ones and zeroes. They're simply converting ascii text input into different ascii text output. Initially, each byte is an ascii character (perhaps a letter, a digit, some punctuation). The output converts each of those ascii bytes into 8 ascii bytes, where in the output the only possible value for a byte is 48 (ascii code in decimal for the digit 0) and 49 (ascii code in decimal value for the digit 1).
If you have a binary file (a file which may contain any byte value in any sequence it sees fit), and you don't know the format, what are you trying to achieve with a conversion? What is your goal? You can't expect some random set of bytes in a binary file to be convertible to meaningful text. Are you simply trying to extract embedded strings from an executable? If so, try the strings command.
$ od -c /usr/bin/ls | head
0000000 M Z 220 \0 003 \0 \0 \0 004 \0 \0 \0 377 377 \0 \0
0000020 270 \0 \0 \0 \0 \0 \0 \0 @ \0 \0 \0 \0 \0 \0 \0
0000040 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000060 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 200 \0 \0 \0
0000100 016 037 272 016 \0 264 \t 315 ! 270 001 L 315 ! T h
0000120 i s p r o g r a m c a n n o
0000140 t b e r u n i n D O S
0000160 m o d e . \r \r \n $ \0 \0 \0 \0 \0 \0 \0
0000200 P E \0 \0 L 001 005 \0 270 334 / O \0 216 001 \0
0000220 \0 \0 \0 \0 340 \0 / 003 \v 001 002 026 \0 0 001 \0