1

In Windows you can check if IMAGE_OPTIONAL_HEADERS.Subsystem from the PE header is equal to either IMAGE_SUBSYSTEM_WIN_GUI or IMAGE_SUBSYSTEM_WIN_CUI.

Is there a UNIX/ELF equivalent?

I've checked

https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header

along with general Google and

http://linux.die.net/man/5/elf

a few times but I haven't found anything.

clark
  • 395
  • 5
  • 12

1 Answers1

0

Is there a UNIX/ELF equivalent?

No. UNIX has no concept of a GUI or CUI Subsystem, so the question "what subsystem does this executable use?" is completely meaningless.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • Despite that, you could see what libraries an executable is linked to (with ldd) and heuristically, if it's linked to gnome or kde or x, it's like GUI capable. However, even GUI capable programs still have a console, but you generally don't see it. – Max Jan 29 '14 at 05:07
  • @Max Your heuristic fails spectacularly when you run `ldd java` -- Java is perfectly capable of using GUI, but usually has no dependency on any of the GUI libraries. – Employed Russian Jan 29 '14 at 05:09
  • It *is* a heuristic. As Java is a runtime and dynamically loads most of itself, it defies most classification. – Max Jan 29 '14 at 05:17