@isopodlabs/binary_libs 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/tasks.json +39 -0
- package/README.md +60 -0
- package/dist/CompoundDocument.d.ts +129 -0
- package/dist/CompoundDocument.js +301 -0
- package/dist/arch.d.ts +41 -0
- package/dist/arch.js +94 -0
- package/dist/binary.d.ts +397 -0
- package/dist/binary.js +802 -0
- package/dist/binary_helpers.d.ts +69 -0
- package/dist/binary_helpers.js +328 -0
- package/dist/clr.d.ts +63 -0
- package/dist/clr.js +664 -0
- package/dist/elf.d.ts +11 -0
- package/dist/elf.js +791 -0
- package/dist/mach.d.ts +543 -0
- package/dist/mach.js +1034 -0
- package/dist/pe.d.ts +399 -0
- package/dist/pe.js +489 -0
- package/package.json +33 -0
- package/src/CompoundDocument.ts +314 -0
- package/src/arch.ts +76 -0
- package/src/clr.ts +651 -0
- package/src/elf.ts +803 -0
- package/src/mach.ts +1089 -0
- package/src/pe.ts +510 -0
- package/tsconfig.json +20 -0
package/dist/pe.d.ts
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import * as binary from '@isopodlabs/binary';
|
|
2
|
+
declare const DOS_HEADER: {
|
|
3
|
+
magic: {
|
|
4
|
+
get(s: binary._stream): number;
|
|
5
|
+
put(s: binary._stream, v: number): void;
|
|
6
|
+
};
|
|
7
|
+
cblp: {
|
|
8
|
+
get(s: binary._stream): number;
|
|
9
|
+
put(s: binary._stream, v: number): void;
|
|
10
|
+
};
|
|
11
|
+
cp: {
|
|
12
|
+
get(s: binary._stream): number;
|
|
13
|
+
put(s: binary._stream, v: number): void;
|
|
14
|
+
};
|
|
15
|
+
crlc: {
|
|
16
|
+
get(s: binary._stream): number;
|
|
17
|
+
put(s: binary._stream, v: number): void;
|
|
18
|
+
};
|
|
19
|
+
cparhdr: {
|
|
20
|
+
get(s: binary._stream): number;
|
|
21
|
+
put(s: binary._stream, v: number): void;
|
|
22
|
+
};
|
|
23
|
+
minalloc: {
|
|
24
|
+
get(s: binary._stream): number;
|
|
25
|
+
put(s: binary._stream, v: number): void;
|
|
26
|
+
};
|
|
27
|
+
maxalloc: {
|
|
28
|
+
get(s: binary._stream, obj: any): binary.hex<number | bigint>;
|
|
29
|
+
put(s: binary._stream, v: binary.hex<number | bigint>): void;
|
|
30
|
+
};
|
|
31
|
+
ss: {
|
|
32
|
+
get(s: binary._stream): number;
|
|
33
|
+
put(s: binary._stream, v: number): void;
|
|
34
|
+
};
|
|
35
|
+
sp: {
|
|
36
|
+
get(s: binary._stream): number;
|
|
37
|
+
put(s: binary._stream, v: number): void;
|
|
38
|
+
};
|
|
39
|
+
csum: {
|
|
40
|
+
get(s: binary._stream): number;
|
|
41
|
+
put(s: binary._stream, v: number): void;
|
|
42
|
+
};
|
|
43
|
+
ip: {
|
|
44
|
+
get(s: binary._stream): number;
|
|
45
|
+
put(s: binary._stream, v: number): void;
|
|
46
|
+
};
|
|
47
|
+
cs: {
|
|
48
|
+
get(s: binary._stream): number;
|
|
49
|
+
put(s: binary._stream, v: number): void;
|
|
50
|
+
};
|
|
51
|
+
lfarlc: {
|
|
52
|
+
get(s: binary._stream): number;
|
|
53
|
+
put(s: binary._stream, v: number): void;
|
|
54
|
+
};
|
|
55
|
+
ovno: {
|
|
56
|
+
get(s: binary._stream): number;
|
|
57
|
+
put(s: binary._stream, v: number): void;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
declare const EXE_HEADER: {
|
|
61
|
+
res: {
|
|
62
|
+
get: (s: binary._stream, obj?: any) => number[];
|
|
63
|
+
put: (s: binary._stream, v: {
|
|
64
|
+
get(s: binary._stream): number;
|
|
65
|
+
put(s: binary._stream, v: number): void;
|
|
66
|
+
}[]) => void;
|
|
67
|
+
};
|
|
68
|
+
oemid: {
|
|
69
|
+
get(s: binary._stream): number;
|
|
70
|
+
put(s: binary._stream, v: number): void;
|
|
71
|
+
};
|
|
72
|
+
oeminfo: {
|
|
73
|
+
get(s: binary._stream): number;
|
|
74
|
+
put(s: binary._stream, v: number): void;
|
|
75
|
+
};
|
|
76
|
+
res2: {
|
|
77
|
+
get: (s: binary._stream, obj?: any) => number[];
|
|
78
|
+
put: (s: binary._stream, v: {
|
|
79
|
+
get(s: binary._stream): number;
|
|
80
|
+
put(s: binary._stream, v: number): void;
|
|
81
|
+
}[]) => void;
|
|
82
|
+
};
|
|
83
|
+
lfanew: {
|
|
84
|
+
get(s: binary._stream): number;
|
|
85
|
+
put(s: binary._stream, v: number): void;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export declare class pe_stream extends binary.stream {
|
|
89
|
+
pe: PE;
|
|
90
|
+
constructor(pe: PE, data: Uint8Array);
|
|
91
|
+
get_rva(): Uint8Array | undefined;
|
|
92
|
+
}
|
|
93
|
+
declare const Section_base: (new (s: binary._stream) => {
|
|
94
|
+
Name: string;
|
|
95
|
+
VirtualSize: number;
|
|
96
|
+
VirtualAddress: binary.hex<number | bigint>;
|
|
97
|
+
SizeOfRawData: number;
|
|
98
|
+
PointerToRawData: binary.hex<number | bigint>;
|
|
99
|
+
PointerToRelocations: binary.hex<number | bigint>;
|
|
100
|
+
PointerToLinenumbers: binary.hex<number | bigint>;
|
|
101
|
+
NumberOfRelocations: number;
|
|
102
|
+
NumberOfLinenumbers: number;
|
|
103
|
+
Characteristics: Record<string, bigint | boolean> | Record<string, number | boolean>;
|
|
104
|
+
} & {}) & {
|
|
105
|
+
get: (s: binary._stream) => {
|
|
106
|
+
Name: string;
|
|
107
|
+
VirtualSize: number;
|
|
108
|
+
VirtualAddress: binary.hex<number | bigint>;
|
|
109
|
+
SizeOfRawData: number;
|
|
110
|
+
PointerToRawData: binary.hex<number | bigint>;
|
|
111
|
+
PointerToRelocations: binary.hex<number | bigint>;
|
|
112
|
+
PointerToLinenumbers: binary.hex<number | bigint>;
|
|
113
|
+
NumberOfRelocations: number;
|
|
114
|
+
NumberOfLinenumbers: number;
|
|
115
|
+
Characteristics: Record<string, bigint | boolean> | Record<string, number | boolean>;
|
|
116
|
+
} & {};
|
|
117
|
+
};
|
|
118
|
+
declare class Section extends Section_base {
|
|
119
|
+
data?: binary.utils.MappedMemory;
|
|
120
|
+
constructor(r: binary.stream);
|
|
121
|
+
get flags(): number;
|
|
122
|
+
}
|
|
123
|
+
interface DirectoryInfo {
|
|
124
|
+
read?: (pe: PE, data: binary.utils.MappedMemory) => any;
|
|
125
|
+
}
|
|
126
|
+
export declare const DIRECTORIES: Record<string, DirectoryInfo>;
|
|
127
|
+
export declare const DATA_DIRECTORY: {
|
|
128
|
+
VirtualAddress: {
|
|
129
|
+
get(s: binary._stream): number;
|
|
130
|
+
put(s: binary._stream, v: number): void;
|
|
131
|
+
};
|
|
132
|
+
Size: {
|
|
133
|
+
get(s: binary._stream): number;
|
|
134
|
+
put(s: binary._stream, v: number): void;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
type Directory = binary.ReadType<typeof DATA_DIRECTORY>;
|
|
138
|
+
declare const OPTIONAL_HEADER: {
|
|
139
|
+
Magic: {
|
|
140
|
+
get(s: binary._stream, obj: any): string;
|
|
141
|
+
put(s: binary._stream, v: string): void;
|
|
142
|
+
};
|
|
143
|
+
MajorLinkerVersion: {
|
|
144
|
+
get(s: binary._stream): number;
|
|
145
|
+
put(s: binary._stream, v: number): void;
|
|
146
|
+
};
|
|
147
|
+
MinorLinkerVersion: {
|
|
148
|
+
get(s: binary._stream): number;
|
|
149
|
+
put(s: binary._stream, v: number): void;
|
|
150
|
+
};
|
|
151
|
+
SizeOfCode: {
|
|
152
|
+
get(s: binary._stream): number;
|
|
153
|
+
put(s: binary._stream, v: number): void;
|
|
154
|
+
};
|
|
155
|
+
SizeOfInitializedData: {
|
|
156
|
+
get(s: binary._stream): number;
|
|
157
|
+
put(s: binary._stream, v: number): void;
|
|
158
|
+
};
|
|
159
|
+
SizeOfUninitializedData: {
|
|
160
|
+
get(s: binary._stream): number;
|
|
161
|
+
put(s: binary._stream, v: number): void;
|
|
162
|
+
};
|
|
163
|
+
AddressOfEntryPoint: {
|
|
164
|
+
get(s: binary._stream, obj: any): binary.hex<number | bigint>;
|
|
165
|
+
put(s: binary._stream, v: binary.hex<number | bigint>): void;
|
|
166
|
+
};
|
|
167
|
+
BaseOfCode: {
|
|
168
|
+
get(s: binary._stream, obj: any): binary.hex<number | bigint>;
|
|
169
|
+
put(s: binary._stream, v: binary.hex<number | bigint>): void;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
declare const OPTIONAL_HEADER32: {
|
|
173
|
+
BaseOfData: {
|
|
174
|
+
get(s: binary._stream, obj: any): binary.hex<number | bigint>;
|
|
175
|
+
put(s: binary._stream, v: binary.hex<number | bigint>): void;
|
|
176
|
+
};
|
|
177
|
+
ImageBase: {
|
|
178
|
+
get(s: binary._stream, obj: any): binary.hex<number | bigint>;
|
|
179
|
+
put(s: binary._stream, v: binary.hex<number | bigint>): void;
|
|
180
|
+
};
|
|
181
|
+
SectionAlignment: {
|
|
182
|
+
get(s: binary._stream): number;
|
|
183
|
+
put(s: binary._stream, v: number): void;
|
|
184
|
+
};
|
|
185
|
+
FileAlignment: {
|
|
186
|
+
get(s: binary._stream): number;
|
|
187
|
+
put(s: binary._stream, v: number): void;
|
|
188
|
+
};
|
|
189
|
+
MajorOperatingSystemVersion: {
|
|
190
|
+
get(s: binary._stream): number;
|
|
191
|
+
put(s: binary._stream, v: number): void;
|
|
192
|
+
};
|
|
193
|
+
MinorOperatingSystemVersion: {
|
|
194
|
+
get(s: binary._stream): number;
|
|
195
|
+
put(s: binary._stream, v: number): void;
|
|
196
|
+
};
|
|
197
|
+
MajorImageVersion: {
|
|
198
|
+
get(s: binary._stream): number;
|
|
199
|
+
put(s: binary._stream, v: number): void;
|
|
200
|
+
};
|
|
201
|
+
MinorImageVersion: {
|
|
202
|
+
get(s: binary._stream): number;
|
|
203
|
+
put(s: binary._stream, v: number): void;
|
|
204
|
+
};
|
|
205
|
+
MajorSubsystemVersion: {
|
|
206
|
+
get(s: binary._stream): number;
|
|
207
|
+
put(s: binary._stream, v: number): void;
|
|
208
|
+
};
|
|
209
|
+
MinorSubsystemVersion: {
|
|
210
|
+
get(s: binary._stream): number;
|
|
211
|
+
put(s: binary._stream, v: number): void;
|
|
212
|
+
};
|
|
213
|
+
Win32VersionValue: {
|
|
214
|
+
get(s: binary._stream): number;
|
|
215
|
+
put(s: binary._stream, v: number): void;
|
|
216
|
+
};
|
|
217
|
+
SizeOfImage: {
|
|
218
|
+
get(s: binary._stream): number;
|
|
219
|
+
put(s: binary._stream, v: number): void;
|
|
220
|
+
};
|
|
221
|
+
SizeOfHeaders: {
|
|
222
|
+
get(s: binary._stream): number;
|
|
223
|
+
put(s: binary._stream, v: number): void;
|
|
224
|
+
};
|
|
225
|
+
CheckSum: {
|
|
226
|
+
get(s: binary._stream): number;
|
|
227
|
+
put(s: binary._stream, v: number): void;
|
|
228
|
+
};
|
|
229
|
+
Subsystem: {
|
|
230
|
+
get(s: binary._stream): number;
|
|
231
|
+
put(s: binary._stream, v: number): void;
|
|
232
|
+
};
|
|
233
|
+
DllCharacteristics: {
|
|
234
|
+
get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
|
|
235
|
+
put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
|
|
236
|
+
};
|
|
237
|
+
SizeOfStackReserve: {
|
|
238
|
+
get(s: binary._stream): number;
|
|
239
|
+
put(s: binary._stream, v: number): void;
|
|
240
|
+
};
|
|
241
|
+
SizeOfStackCommit: {
|
|
242
|
+
get(s: binary._stream): number;
|
|
243
|
+
put(s: binary._stream, v: number): void;
|
|
244
|
+
};
|
|
245
|
+
SizeOfHeapReserve: {
|
|
246
|
+
get(s: binary._stream): number;
|
|
247
|
+
put(s: binary._stream, v: number): void;
|
|
248
|
+
};
|
|
249
|
+
SizeOfHeapCommit: {
|
|
250
|
+
get(s: binary._stream): number;
|
|
251
|
+
put(s: binary._stream, v: number): void;
|
|
252
|
+
};
|
|
253
|
+
LoaderFlags: {
|
|
254
|
+
get(s: binary._stream): number;
|
|
255
|
+
put(s: binary._stream, v: number): void;
|
|
256
|
+
};
|
|
257
|
+
DataDirectory: {
|
|
258
|
+
get: (s: binary._stream) => {
|
|
259
|
+
[k: string]: any;
|
|
260
|
+
};
|
|
261
|
+
put: (s: binary._stream, v: Record<string, any>) => void;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
declare const OPTIONAL_HEADER64: {
|
|
265
|
+
ImageBase: {
|
|
266
|
+
get(s: binary._stream, obj: any): binary.hex<number | bigint>;
|
|
267
|
+
put(s: binary._stream, v: binary.hex<number | bigint>): void;
|
|
268
|
+
};
|
|
269
|
+
SectionAlignment: {
|
|
270
|
+
get(s: binary._stream): number;
|
|
271
|
+
put(s: binary._stream, v: number): void;
|
|
272
|
+
};
|
|
273
|
+
FileAlignment: {
|
|
274
|
+
get(s: binary._stream): number;
|
|
275
|
+
put(s: binary._stream, v: number): void;
|
|
276
|
+
};
|
|
277
|
+
MajorOperatingSystemVersion: {
|
|
278
|
+
get(s: binary._stream): number;
|
|
279
|
+
put(s: binary._stream, v: number): void;
|
|
280
|
+
};
|
|
281
|
+
MinorOperatingSystemVersion: {
|
|
282
|
+
get(s: binary._stream): number;
|
|
283
|
+
put(s: binary._stream, v: number): void;
|
|
284
|
+
};
|
|
285
|
+
MajorImageVersion: {
|
|
286
|
+
get(s: binary._stream): number;
|
|
287
|
+
put(s: binary._stream, v: number): void;
|
|
288
|
+
};
|
|
289
|
+
MinorImageVersion: {
|
|
290
|
+
get(s: binary._stream): number;
|
|
291
|
+
put(s: binary._stream, v: number): void;
|
|
292
|
+
};
|
|
293
|
+
MajorSubsystemVersion: {
|
|
294
|
+
get(s: binary._stream): number;
|
|
295
|
+
put(s: binary._stream, v: number): void;
|
|
296
|
+
};
|
|
297
|
+
MinorSubsystemVersion: {
|
|
298
|
+
get(s: binary._stream): number;
|
|
299
|
+
put(s: binary._stream, v: number): void;
|
|
300
|
+
};
|
|
301
|
+
Win32VersionValue: {
|
|
302
|
+
get(s: binary._stream): number;
|
|
303
|
+
put(s: binary._stream, v: number): void;
|
|
304
|
+
};
|
|
305
|
+
SizeOfImage: {
|
|
306
|
+
get(s: binary._stream): number;
|
|
307
|
+
put(s: binary._stream, v: number): void;
|
|
308
|
+
};
|
|
309
|
+
SizeOfHeaders: {
|
|
310
|
+
get(s: binary._stream): number;
|
|
311
|
+
put(s: binary._stream, v: number): void;
|
|
312
|
+
};
|
|
313
|
+
CheckSum: {
|
|
314
|
+
get(s: binary._stream): number;
|
|
315
|
+
put(s: binary._stream, v: number): void;
|
|
316
|
+
};
|
|
317
|
+
Subsystem: {
|
|
318
|
+
get(s: binary._stream): number;
|
|
319
|
+
put(s: binary._stream, v: number): void;
|
|
320
|
+
};
|
|
321
|
+
DllCharacteristics: {
|
|
322
|
+
get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
|
|
323
|
+
put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
|
|
324
|
+
};
|
|
325
|
+
SizeOfStackReserve: {
|
|
326
|
+
get(s: binary._stream): bigint;
|
|
327
|
+
put(s: binary._stream, v: bigint): void;
|
|
328
|
+
};
|
|
329
|
+
SizeOfStackCommit: {
|
|
330
|
+
get(s: binary._stream): bigint;
|
|
331
|
+
put(s: binary._stream, v: bigint): void;
|
|
332
|
+
};
|
|
333
|
+
SizeOfHeapReserve: {
|
|
334
|
+
get(s: binary._stream): bigint;
|
|
335
|
+
put(s: binary._stream, v: bigint): void;
|
|
336
|
+
};
|
|
337
|
+
SizeOfHeapCommit: {
|
|
338
|
+
get(s: binary._stream): bigint;
|
|
339
|
+
put(s: binary._stream, v: bigint): void;
|
|
340
|
+
};
|
|
341
|
+
LoaderFlags: {
|
|
342
|
+
get(s: binary._stream): number;
|
|
343
|
+
put(s: binary._stream, v: number): void;
|
|
344
|
+
};
|
|
345
|
+
DataDirectory: {
|
|
346
|
+
get: (s: binary._stream) => {
|
|
347
|
+
[k: string]: any;
|
|
348
|
+
};
|
|
349
|
+
put: (s: binary._stream, v: Record<string, any>) => void;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
export declare class PE {
|
|
353
|
+
private data;
|
|
354
|
+
header: binary.ReadType<typeof DOS_HEADER> & binary.ReadType<typeof EXE_HEADER>;
|
|
355
|
+
sections: Section[];
|
|
356
|
+
opt?: binary.ReadType<typeof OPTIONAL_HEADER> & (binary.ReadType<typeof OPTIONAL_HEADER32> | binary.ReadType<typeof OPTIONAL_HEADER64>);
|
|
357
|
+
static check(data: Uint8Array): boolean;
|
|
358
|
+
constructor(data: Uint8Array);
|
|
359
|
+
get directories(): {
|
|
360
|
+
[k: string]: any;
|
|
361
|
+
} | undefined;
|
|
362
|
+
FindSectionRVA(rva: number): Section | undefined;
|
|
363
|
+
FindSectionRaw(addr: number): Section | undefined;
|
|
364
|
+
GetDataRVA(rva: number, size?: number): binary.utils.MappedMemory | undefined;
|
|
365
|
+
GetDataRaw(addr: number, size: number): Uint8Array | undefined;
|
|
366
|
+
GetDataDir(dir: Directory): binary.utils.MappedMemory | undefined;
|
|
367
|
+
ReadDirectory(name: string): any;
|
|
368
|
+
}
|
|
369
|
+
export declare function ReadExports(file: pe_stream): (string | number | binary.utils.MappedMemory | undefined)[][];
|
|
370
|
+
export declare class DLLImports extends Array {
|
|
371
|
+
}
|
|
372
|
+
export declare function ReadImports(file: pe_stream): [string, any][];
|
|
373
|
+
declare enum IRT {
|
|
374
|
+
NONE = 0,
|
|
375
|
+
CURSOR = 1,
|
|
376
|
+
BITMAP = 2,
|
|
377
|
+
ICON = 3,
|
|
378
|
+
MENU = 4,
|
|
379
|
+
DIALOG = 5,
|
|
380
|
+
STRING = 6,
|
|
381
|
+
FONTDIR = 7,
|
|
382
|
+
FONT = 8,
|
|
383
|
+
ACCELERATOR = 9,
|
|
384
|
+
RCDATA = 10,
|
|
385
|
+
MESSAGETABLE = 11,
|
|
386
|
+
GROUP_CURSOR = 12,
|
|
387
|
+
GROUP_ICON = 14,
|
|
388
|
+
VERSION = 16,
|
|
389
|
+
DLGINCLUDE = 17,
|
|
390
|
+
PLUGPLAY = 19,
|
|
391
|
+
VXD = 20,
|
|
392
|
+
ANICURSOR = 21,
|
|
393
|
+
ANIICON = 22,
|
|
394
|
+
HTML = 23,
|
|
395
|
+
MANIFEST = 24,
|
|
396
|
+
TOOLBAR = 241
|
|
397
|
+
}
|
|
398
|
+
export declare function ReadResourceDirectory(file: binary.stream, data: binary.utils.MappedMemory, type?: IRT): Record<string, any>;
|
|
399
|
+
export {};
|