File tree 5 files changed +520
-0
lines changed 5 files changed +520
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import (
40
40
_ "github.com/wader/fq/format/ogg"
41
41
_ "github.com/wader/fq/format/opus"
42
42
_ "github.com/wader/fq/format/pcap"
43
+ _ "github.com/wader/fq/format/pe"
43
44
_ "github.com/wader/fq/format/png"
44
45
_ "github.com/wader/fq/format/postgres"
45
46
_ "github.com/wader/fq/format/prores"
Original file line number Diff line number Diff line change @@ -145,6 +145,9 @@ var (
145
145
Opus_Packet = & decode.Group {Name : "opus_packet" }
146
146
PCAP = & decode.Group {Name : "pcap" }
147
147
PCAPNG = & decode.Group {Name : "pcapng" }
148
+ PE = & decode.Group {Name : "pe" }
149
+ PE_COFF = & decode.Group {Name : "pe_coff" }
150
+ PE_MSDOS_Stub = & decode.Group {Name : "pe_msdos_stub" }
148
151
Pg_BTree = & decode.Group {Name : "pg_btree" }
149
152
Pg_Control = & decode.Group {Name : "pg_control" }
150
153
Pg_Heap = & decode.Group {Name : "pg_heap" }
Original file line number Diff line number Diff line change
1
+ package pe
2
+
3
+ // https://osandamalith.com/2020/07/19/exploring-the-ms-dos-stub/
4
+
5
+ import (
6
+ "github.com/wader/fq/format"
7
+ "github.com/wader/fq/pkg/decode"
8
+ "github.com/wader/fq/pkg/interp"
9
+ )
10
+
11
+ // TODO: probe?
12
+ // TODO: not pe_ prefix for format names?
13
+
14
+ var peMSDosStubGroup decode.Group
15
+ var peCOFFGroup decode.Group
16
+
17
+ func init () {
18
+ interp .RegisterFormat (
19
+ format .PE ,
20
+ & decode.Format {
21
+ Description : "Portable Executable" ,
22
+ Groups : []* decode.Group {format .Probe },
23
+ Dependencies : []decode.Dependency {
24
+ {Groups : []* decode.Group {format .PE_MSDOS_Stub }, Out : & peMSDosStubGroup },
25
+ {Groups : []* decode.Group {format .PE_COFF }, Out : & peCOFFGroup },
26
+ },
27
+ DecodeFn : peDecode ,
28
+ })
29
+ }
30
+
31
+ func peDecode (d * decode.D ) any {
32
+
33
+ d .FieldFormat ("ms_dos_stub" , & peMSDosStubGroup , nil )
34
+ d .FieldFormat ("coff" , & peCOFFGroup , nil )
35
+
36
+ return nil
37
+ }
You can’t perform that action at this time.
0 commit comments