binfmt-detector-cli: rewrite to support PE32+ binaries (#38)

Rewrite with hard-coded offsets into the PE file format to discern
if a binary is PE32 or PE32+, and then to determine if it contains
a "CLR Data Directory" entry that looks valid.

Tested with PE32 and PE32+ compiled Mono binaries, PE32 and PE32+ native
binaries, and a random assortment of garbage files.

Former-commit-id: 9e7ac86ec84f653a2f79b87183efd5b0ebda001b
This commit is contained in:
Pat Tullmann
2023-10-16 11:16:47 -07:00
committed by GitHub
parent bb231c5b06
commit 0cb742dafb
4772 changed files with 11391249 additions and 2669 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 KiB

View File

@@ -1 +0,0 @@
46433c00389589497d99ff2e79dcf83023296e01

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

View File

@@ -1 +0,0 @@
df3793b75d6cee3b26fe3c185d13e3571f9c642a

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

View File

@@ -1 +0,0 @@
5ccc54918652a6259dae107b639a2b5d3f6cbb47

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@@ -1 +0,0 @@
0180c185f7348570ae3f06b4ddaaa7a14b43aa4d

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

View File

@@ -1 +0,0 @@
1b66c769ef80c6b605297b78f3cc74ed3b6e918e

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 KiB

View File

@@ -1 +0,0 @@
e561129169054649dd46375d279afed767a79ea4

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

View File

@@ -1 +0,0 @@
b300feb3c4c96de8ef5666678ea7c9967fa59ed0

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

View File

@@ -1 +0,0 @@
95814649cbf7011875194335eddf0fc9fbc6ed73

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

View File

@@ -1 +0,0 @@
b4f58f697ad20a2034a406a9e6f7e8bba24b501b

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

@@ -1 +0,0 @@
a312208573cdc218ab1cc42476aef20d1fd5cc21

Some files were not shown because too many files have changed in this diff Show More