what I'm looking for
I have a binary that, for various reasons, I'm pretty sure is executable machine code (although possibly for a VM language, although I doubt it's Java). I'm looking for a table of byte frequencies for byte values v. architecture.
I recognize that those values will vary by compiler, operating system ABI / API, application, and binary format, but for my purposes I'm assuming they vary most markedly by architecture, and:
- I just need frequencies for the actual executable code- the
.textsection- not the entire binary. - the binary's targeting one of the most common end-user operating systems from 1985 - 2005 (so, old-style unices, Linux, VMS, DOS, Windows NT, MacOS, or OSX).
- it was compiled with default flags on the most common compilers for those systems
If all that fails, I'd at least want a list of
Wait, there's this list on wikipedia. Thank you, wikipedia.nop opcodes for all the most common architectures, since I think it's probably fair to assume most compilers use nops for padding, and runs of nops will help me figure out where a good entry point for a disassembler would be.
my use case
I have a snippet of a binary, which I'm pretty sure is executable object code (sans headers / section information. I think it's the .text section (or whatever you'd call that) in its original format).
I'm not sure that it's even from a binary, but when converted to a grayscale bitmap it has some clear patterns (stripes at regular intervals), and I've noticed that the bytes FF FF appear often enough, and beside other bytes in the form Fx, that I get the feeling I'm looking at high memory addresses. The shannon entropy is low enough I'm pretty sure it's not compressed or encrypted (around 7.76), but all 256 possible byte values are represented.
I can't actually give the hexdump itself for personal reasons.
binwalk, which in fairness I hadn't found in previous searches on the larger internet. I feel kind of silly now, but I'll leave this question and answer it myself in a bit. Assuming binwalk actually helps. If it doesn't help, I guess I'll just... wait around... – Parthian Shot Mar 03 '16 at 20:39binwalk -Aisn't getting me anything, nor isbinwalk -I. Literally- they're giving me no hits. Just as a sanity check, runningbinwalk -Aagainst/bin/bashalso got me no hits and no error codes, so I'm not sure what to think. – Parthian Shot Mar 03 '16 at 23:13binwalkdoes give me entropy values consistently around 0.94 for all four kilobytes, while/bin/bash(for the code section) consistently fluctuates around 0.75. Not sure what to make of that. – Parthian Shot Mar 03 '16 at 23:32binwalk -Hreports that both /bin/bash and the binary I'm looking at appear to have a "high entropy" section that extends for nearly the same number of KB (~5 for bash and ~6 for the binary I'm using). According toreadelf, that starts at the tail end of.gnu.hashand the rest (most of it) is in.dynsym. – Parthian Shot Mar 03 '16 at 23:34/bin/bashexecutable's.textsection. Based on the fact that it doesn't seem to contain any actual meaningful opcodes in and of itself, and it's broken into nearly fixed-length records with delimiters, my money's on a trampoline. – Parthian Shot Mar 04 '16 at 01:30