Skip to content

A lib to distinguish a shared library from an executable. Mostly for ELF, but some rudimentary (file name extension-based) support of windows was added.

License

Notifications You must be signed in to change notification settings

KOLANICH-libs/isExecutable.cpp

Repository files navigation

isExecutable.cpp Unlicensed work

GitHub Actions Libraries.io Status

We have moved to https://codeberg.org/KOLANICH-libs/isExecutable.cpp, grab new versions there.

Under the disguise of "better security" Micro$oft-owned GitHub has discriminated users of 1FA passwords while having commercial interest in success and wide adoption of FIDO 1FA specifications and Windows Hello implementation which it promotes as a replacement for passwords. It will result in dire consequencies and is competely inacceptable, read why.

If you don't want to participate in harming yourself, it is recommended to follow the lead and migrate somewhere away of GitHub and Micro$oft. Here is the list of alternatives and rationales to do it. If they delete the discussion, there are certain well-known places where you can get a copy of it. Read why you should also leave GitHub.


A library for checking if a file is executable.

Features

Does:

  • parses headers of
    • ELF
    • PE
    • Mach-O
  • reports
    • file class
      • ordinary
      • executable
      • shared library
      • shell script
    • whether PIC used (according to headers)
    • bitness: 32 or 64
    • access rights - whether x bit is set
  • POSIX platforms:
    • checks shebang
  • Win32
    • if a file name matches the one of shell scripts
  • provides functions to convert machine-readable reports into strings, both human-readable and machine-readable
    • JSON
    • human-readable 1 char space-separated "brief" format
    • human-readable space-separated "verbose" format
  • provides C wrappers to be used from the languages other than C++

Doesn't do:

  • doesn't parse the format fully, only some few checks on headers are done
  • big-endian machines are out of scope, everything is assummed to be little endian
  • doesn't check machine code
  • doesn't check whether content is really a shell script
  • doesn't check if we can really run that file

Installation

Packaging with CPack is implemented, you can generate an installable package for Debian and RPM-based distros. All the dependencies are assummed to be installed the same way.

Usage

See the example in bin directory.

Related projects

About

A lib to distinguish a shared library from an executable. Mostly for ELF, but some rudimentary (file name extension-based) support of windows was added.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages