@isopodlabs/binary_libs 0.1.5 → 0.2.0
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/README.md +49 -85
- package/dist/CompoundDocument.d copy.ts +95 -0
- package/dist/CompoundDocument.d.ts +2 -36
- package/dist/arch.d copy.ts +18 -0
- package/dist/arch.d.ts +1 -1
- package/dist/arch.js +1 -1
- package/dist/clr.d copy.ts +409 -0
- package/dist/clr.d.ts +223 -18
- package/dist/clr.js +224 -276
- package/dist/elf.d copy.ts +152 -0
- package/dist/elf.d.ts +1 -1
- package/dist/elf.js +4 -4
- package/dist/mach.d copy.ts +505 -0
- package/dist/mach.d.ts +11 -7
- package/dist/mach.js +9 -10
- package/dist/pe.d copy.ts +144 -0
- package/dist/pe.d.ts +4 -19
- package/dist/pe.js +4 -6
- package/package.json +3 -2
package/dist/clr.js
CHANGED
|
@@ -222,278 +222,236 @@ const clr_Blob = {
|
|
|
222
222
|
const Signature = clr_Blob;
|
|
223
223
|
const CustomAttributeValue = clr_Blob;
|
|
224
224
|
const clr_Code = binary.UINT32_LE;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
get(s) { return s.getIndex(this.table); }
|
|
225
|
+
function Indexed(table) {
|
|
226
|
+
return {
|
|
227
|
+
get(s) { return s.getIndex(table); }
|
|
228
|
+
};
|
|
231
229
|
}
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
function IndexedList(table) {
|
|
231
|
+
return {
|
|
232
|
+
get(s) { return s.getIndex(table); }
|
|
233
|
+
};
|
|
234
234
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
this.trans = trans;
|
|
240
|
-
this.B = B;
|
|
241
|
-
}
|
|
242
|
-
get(s) { return s.getCodedIndex(this.B, this.trans); }
|
|
235
|
+
function CodedIndex(trans, B) {
|
|
236
|
+
return {
|
|
237
|
+
get(s) { return s.getCodedIndex(B, trans); }
|
|
238
|
+
};
|
|
243
239
|
}
|
|
244
|
-
const TypeDefOrRef =
|
|
245
|
-
const HasConstant =
|
|
246
|
-
const HasCustomAttribute =
|
|
240
|
+
const TypeDefOrRef = CodedIndex([TABLE.TypeDef, TABLE.TypeRef, TABLE.TypeSpec], 2);
|
|
241
|
+
const HasConstant = CodedIndex([TABLE.Field, TABLE.Param, TABLE.Property], 2);
|
|
242
|
+
const HasCustomAttribute = CodedIndex([
|
|
247
243
|
TABLE.MethodDef, TABLE.Field, TABLE.TypeRef, TABLE.TypeDef, TABLE.Param, TABLE.InterfaceImpl, TABLE.MemberRef, TABLE.Module, TABLE.DeclSecurity, TABLE.Property, TABLE.Event, TABLE.StandAloneSig,
|
|
248
244
|
TABLE.ModuleRef, TABLE.TypeSpec, TABLE.Assembly, TABLE.AssemblyRef, TABLE.File, TABLE.ExportedType, TABLE.ManifestResource, TABLE.GenericParam, TABLE.GenericParamConstraint, TABLE.MethodSpec,
|
|
249
245
|
], 5);
|
|
250
|
-
const HasFieldMarshall =
|
|
251
|
-
const HasDeclSecurity =
|
|
252
|
-
const MemberRefParent =
|
|
253
|
-
const HasSemantics =
|
|
254
|
-
const MethodDefOrRef =
|
|
255
|
-
const MemberForwarded =
|
|
256
|
-
const Implementation =
|
|
257
|
-
const CustomAttributeType =
|
|
258
|
-
const TypeOrMethodDef =
|
|
259
|
-
const ResolutionScope =
|
|
260
|
-
const ENTRY_Module = {
|
|
261
|
-
generation: binary.UINT16_LE,
|
|
262
|
-
name: clr_String,
|
|
263
|
-
mvid: clr_GUID,
|
|
264
|
-
encid: clr_GUID,
|
|
265
|
-
encbaseid: clr_GUID,
|
|
266
|
-
};
|
|
267
|
-
const ENTRY_TypeRef = {
|
|
268
|
-
scope: ResolutionScope,
|
|
269
|
-
name: clr_String,
|
|
270
|
-
namespce: clr_String,
|
|
271
|
-
};
|
|
272
|
-
const ENTRY_TypeDef = {
|
|
273
|
-
flags: binary.UINT32_LE,
|
|
274
|
-
name: clr_String,
|
|
275
|
-
namespce: clr_String,
|
|
276
|
-
extends: TypeDefOrRef,
|
|
277
|
-
fields: new IndexedList(TABLE.Field),
|
|
278
|
-
methods: new IndexedList(TABLE.MethodDef),
|
|
279
|
-
};
|
|
280
|
-
const ENTRY_Field = {
|
|
281
|
-
flags: binary.UINT16_LE,
|
|
282
|
-
name: clr_String,
|
|
283
|
-
signature: Signature,
|
|
284
|
-
};
|
|
285
|
-
const ENTRY_MethodDef = {
|
|
286
|
-
code: clr_Code,
|
|
287
|
-
implflags: binary.UINT16_LE,
|
|
288
|
-
flags: binary.UINT16_LE,
|
|
289
|
-
name: clr_String,
|
|
290
|
-
signature: Signature,
|
|
291
|
-
paramlist: new IndexedList(TABLE.Param),
|
|
292
|
-
};
|
|
293
|
-
const ENTRY_Param = {
|
|
294
|
-
flags: binary.UINT16_LE,
|
|
295
|
-
sequence: binary.UINT16_LE,
|
|
296
|
-
name: clr_String,
|
|
297
|
-
};
|
|
298
|
-
const ENTRY_InterfaceImpl = {
|
|
299
|
-
clss: new Indexed(TABLE.TypeDef),
|
|
300
|
-
interfce: TypeDefOrRef,
|
|
301
|
-
};
|
|
302
|
-
const ENTRY_MemberRef = {
|
|
303
|
-
clss: MemberRefParent,
|
|
304
|
-
name: clr_String,
|
|
305
|
-
signature: Signature,
|
|
306
|
-
};
|
|
307
|
-
const ENTRY_Constant = {
|
|
308
|
-
type: binary.UINT16_LE,
|
|
309
|
-
parent: HasConstant,
|
|
310
|
-
value: clr_Blob,
|
|
311
|
-
};
|
|
312
|
-
const ENTRY_CustomAttribute = {
|
|
313
|
-
parent: HasCustomAttribute,
|
|
314
|
-
type: CustomAttributeType,
|
|
315
|
-
value: CustomAttributeValue,
|
|
316
|
-
};
|
|
317
|
-
const ENTRY_FieldMarshal = {
|
|
318
|
-
parent: HasFieldMarshall,
|
|
319
|
-
native_type: clr_Blob,
|
|
320
|
-
};
|
|
321
|
-
const ENTRY_DeclSecurity = {
|
|
322
|
-
action: binary.UINT16_LE,
|
|
323
|
-
parent: HasDeclSecurity,
|
|
324
|
-
permission_set: clr_Blob,
|
|
325
|
-
};
|
|
326
|
-
const ENTRY_ClassLayout = {
|
|
327
|
-
packing_size: binary.UINT16_LE,
|
|
328
|
-
class_size: binary.UINT32_LE,
|
|
329
|
-
parent: new Indexed(TABLE.TypeDef),
|
|
330
|
-
};
|
|
331
|
-
const ENTRY_FieldLayout = {
|
|
332
|
-
offset: binary.UINT32_LE,
|
|
333
|
-
field: new Indexed(TABLE.Field),
|
|
334
|
-
};
|
|
335
|
-
const ENTRY_StandAloneSig = {
|
|
336
|
-
signature: Signature,
|
|
337
|
-
};
|
|
338
|
-
const ENTRY_EventMap = {
|
|
339
|
-
parent: new Indexed(TABLE.TypeDef),
|
|
340
|
-
event_list: new IndexedList(TABLE.Event),
|
|
341
|
-
};
|
|
342
|
-
const ENTRY_Event = {
|
|
343
|
-
flags: binary.UINT16_LE,
|
|
344
|
-
name: clr_String,
|
|
345
|
-
event_type: TypeDefOrRef,
|
|
346
|
-
};
|
|
347
|
-
const ENTRY_PropertyMap = {
|
|
348
|
-
parent: new Indexed(TABLE.TypeDef),
|
|
349
|
-
property_list: new IndexedList(TABLE.Property),
|
|
350
|
-
};
|
|
351
|
-
const ENTRY_Property = {
|
|
352
|
-
flags: binary.UINT16_LE,
|
|
353
|
-
name: clr_String,
|
|
354
|
-
type: Signature,
|
|
355
|
-
};
|
|
356
|
-
const ENTRY_MethodSemantics = {
|
|
357
|
-
flags: binary.UINT16_LE,
|
|
358
|
-
method: new Indexed(TABLE.MethodDef),
|
|
359
|
-
association: HasSemantics,
|
|
360
|
-
};
|
|
361
|
-
const ENTRY_MethodImpl = {
|
|
362
|
-
clss: new Indexed(TABLE.TypeDef),
|
|
363
|
-
method_body: MethodDefOrRef,
|
|
364
|
-
method_declaration: MethodDefOrRef,
|
|
365
|
-
};
|
|
366
|
-
const ENTRY_ModuleRef = {
|
|
367
|
-
name: clr_String,
|
|
368
|
-
};
|
|
369
|
-
const ENTRY_TypeSpec = {
|
|
370
|
-
signature: clr_Blob,
|
|
371
|
-
};
|
|
372
|
-
const ENTRY_ImplMap = {
|
|
373
|
-
flags: binary.UINT16_LE,
|
|
374
|
-
member_forwarded: MemberForwarded,
|
|
375
|
-
name: clr_String,
|
|
376
|
-
scope: new Indexed(TABLE.ModuleRef),
|
|
377
|
-
};
|
|
378
|
-
const ENTRY_FieldRVA = {
|
|
379
|
-
rva: binary.UINT32_LE,
|
|
380
|
-
field: new Indexed(TABLE.Field),
|
|
381
|
-
};
|
|
382
|
-
const ENTRY_Assembly = {
|
|
383
|
-
hashalg: binary.UINT32_LE,
|
|
384
|
-
major: binary.UINT16_LE,
|
|
385
|
-
minor: binary.UINT16_LE,
|
|
386
|
-
build: binary.UINT16_LE,
|
|
387
|
-
rev: binary.UINT16_LE,
|
|
388
|
-
flags: binary.UINT32_LE,
|
|
389
|
-
publickey: clr_Blob,
|
|
390
|
-
name: clr_String,
|
|
391
|
-
culture: clr_String,
|
|
392
|
-
};
|
|
393
|
-
const ENTRY_AssemblyProcessor = {
|
|
394
|
-
processor: binary.UINT32_LE,
|
|
395
|
-
};
|
|
396
|
-
const ENTRY_AssemblyOS = {
|
|
397
|
-
platform: binary.UINT32_LE,
|
|
398
|
-
minor: binary.UINT32_LE,
|
|
399
|
-
major: binary.UINT32_LE,
|
|
400
|
-
};
|
|
401
|
-
const ENTRY_AssemblyRef = {
|
|
402
|
-
major: binary.UINT16_LE,
|
|
403
|
-
minor: binary.UINT16_LE,
|
|
404
|
-
build: binary.UINT16_LE,
|
|
405
|
-
rev: binary.UINT16_LE,
|
|
406
|
-
flags: binary.UINT32_LE,
|
|
407
|
-
publickey: clr_Blob,
|
|
408
|
-
name: clr_String,
|
|
409
|
-
culture: clr_String,
|
|
410
|
-
hashvalue: clr_Blob,
|
|
411
|
-
};
|
|
412
|
-
const ENTRY_AssemblyRefProcessor = {
|
|
413
|
-
processor: binary.UINT32_LE,
|
|
414
|
-
assembly: new Indexed(TABLE.AssemblyRef),
|
|
415
|
-
};
|
|
416
|
-
const ENTRY_AssemblyRefOS = {
|
|
417
|
-
platform: binary.UINT32_LE,
|
|
418
|
-
major: binary.UINT32_LE,
|
|
419
|
-
minor: binary.UINT32_LE,
|
|
420
|
-
assembly: new Indexed(TABLE.AssemblyRef),
|
|
421
|
-
};
|
|
422
|
-
const ENTRY_File = {
|
|
423
|
-
flags: binary.UINT32_LE,
|
|
424
|
-
name: clr_String,
|
|
425
|
-
hash: clr_Blob,
|
|
426
|
-
};
|
|
427
|
-
const ENTRY_ExportedType = {
|
|
428
|
-
flags: binary.UINT32_LE,
|
|
429
|
-
typedef_id: binary.UINT32_LE, //(a 4-byte index into a TypeDef table of another module in this Assembly).
|
|
430
|
-
name: clr_String,
|
|
431
|
-
namespce: clr_String,
|
|
432
|
-
implementation: Implementation,
|
|
433
|
-
};
|
|
434
|
-
const ENTRY_ManifestResource = {
|
|
435
|
-
data: binary.UINT32_LE,
|
|
436
|
-
flags: binary.UINT32_LE,
|
|
437
|
-
name: clr_String,
|
|
438
|
-
implementation: Implementation,
|
|
439
|
-
};
|
|
440
|
-
const ENTRY_NestedClass = {
|
|
441
|
-
nested_class: new Indexed(TABLE.TypeDef),
|
|
442
|
-
enclosing_class: new Indexed(TABLE.TypeDef),
|
|
443
|
-
};
|
|
444
|
-
const ENTRY_GenericParam = {
|
|
445
|
-
number: binary.UINT16_LE,
|
|
446
|
-
flags: binary.UINT16_LE,
|
|
447
|
-
owner: TypeOrMethodDef,
|
|
448
|
-
name: clr_String,
|
|
449
|
-
};
|
|
450
|
-
const ENTRY_MethodSpec = {
|
|
451
|
-
method: MethodDefOrRef,
|
|
452
|
-
instantiation: Signature,
|
|
453
|
-
};
|
|
454
|
-
const ENTRY_GenericParamConstraint = {
|
|
455
|
-
owner: new Indexed(TABLE.GenericParam),
|
|
456
|
-
constraint: TypeDefOrRef,
|
|
457
|
-
};
|
|
246
|
+
const HasFieldMarshall = CodedIndex([TABLE.Field, TABLE.Param], 1);
|
|
247
|
+
const HasDeclSecurity = CodedIndex([TABLE.TypeDef, TABLE.MethodDef, TABLE.Assembly], 2);
|
|
248
|
+
const MemberRefParent = CodedIndex([TABLE.TypeDef, TABLE.TypeRef, TABLE.ModuleRef, TABLE.MethodDef, TABLE.TypeSpec], 1);
|
|
249
|
+
const HasSemantics = CodedIndex([TABLE.Event, TABLE.Property], 1);
|
|
250
|
+
const MethodDefOrRef = CodedIndex([TABLE.MethodDef, TABLE.MemberRef], 1);
|
|
251
|
+
const MemberForwarded = CodedIndex([TABLE.Field, TABLE.MethodDef], 1);
|
|
252
|
+
const Implementation = CodedIndex([TABLE.File, TABLE.AssemblyRef, TABLE.ExportedType], 2);
|
|
253
|
+
const CustomAttributeType = CodedIndex([0, 0, TABLE.MethodDef, TABLE.MemberRef], 3);
|
|
254
|
+
const TypeOrMethodDef = CodedIndex([TABLE.TypeDef, TABLE.MethodDef], 1);
|
|
255
|
+
const ResolutionScope = CodedIndex([TABLE.Module, TABLE.ModuleRef, TABLE.AssemblyRef, TABLE.TypeRef], 2);
|
|
458
256
|
const TableReaders = {
|
|
459
|
-
[TABLE.Module]:
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
[TABLE.
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
[TABLE.
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
[TABLE.
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
[TABLE.
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
[TABLE.
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
257
|
+
[TABLE.Module]: {
|
|
258
|
+
generation: binary.UINT16_LE,
|
|
259
|
+
name: clr_String,
|
|
260
|
+
mvid: clr_GUID,
|
|
261
|
+
encid: clr_GUID,
|
|
262
|
+
encbaseid: clr_GUID,
|
|
263
|
+
},
|
|
264
|
+
[TABLE.TypeRef]: {
|
|
265
|
+
scope: ResolutionScope,
|
|
266
|
+
name: clr_String,
|
|
267
|
+
namespce: clr_String,
|
|
268
|
+
},
|
|
269
|
+
[TABLE.TypeDef]: {
|
|
270
|
+
flags: binary.UINT32_LE,
|
|
271
|
+
name: clr_String,
|
|
272
|
+
namespce: clr_String,
|
|
273
|
+
extends: TypeDefOrRef,
|
|
274
|
+
fields: IndexedList(TABLE.Field),
|
|
275
|
+
methods: IndexedList(TABLE.MethodDef),
|
|
276
|
+
},
|
|
277
|
+
[TABLE.Field]: {
|
|
278
|
+
flags: binary.UINT16_LE,
|
|
279
|
+
name: clr_String,
|
|
280
|
+
signature: Signature,
|
|
281
|
+
},
|
|
282
|
+
[TABLE.MethodDef]: {
|
|
283
|
+
code: clr_Code,
|
|
284
|
+
implflags: binary.UINT16_LE,
|
|
285
|
+
flags: binary.UINT16_LE,
|
|
286
|
+
name: clr_String,
|
|
287
|
+
signature: Signature,
|
|
288
|
+
paramlist: IndexedList(TABLE.Param),
|
|
289
|
+
},
|
|
290
|
+
[TABLE.Param]: {
|
|
291
|
+
flags: binary.UINT16_LE,
|
|
292
|
+
sequence: binary.UINT16_LE,
|
|
293
|
+
name: clr_String,
|
|
294
|
+
},
|
|
295
|
+
[TABLE.InterfaceImpl]: {
|
|
296
|
+
clss: Indexed(TABLE.TypeDef),
|
|
297
|
+
interfce: TypeDefOrRef,
|
|
298
|
+
},
|
|
299
|
+
[TABLE.MemberRef]: {
|
|
300
|
+
clss: MemberRefParent,
|
|
301
|
+
name: clr_String,
|
|
302
|
+
signature: Signature,
|
|
303
|
+
},
|
|
304
|
+
[TABLE.Constant]: {
|
|
305
|
+
type: binary.UINT16_LE,
|
|
306
|
+
parent: HasConstant,
|
|
307
|
+
value: clr_Blob,
|
|
308
|
+
},
|
|
309
|
+
[TABLE.CustomAttribute]: {
|
|
310
|
+
parent: HasCustomAttribute,
|
|
311
|
+
type: CustomAttributeType,
|
|
312
|
+
value: CustomAttributeValue,
|
|
313
|
+
},
|
|
314
|
+
[TABLE.FieldMarshal]: {
|
|
315
|
+
parent: HasFieldMarshall,
|
|
316
|
+
native_type: clr_Blob,
|
|
317
|
+
},
|
|
318
|
+
[TABLE.DeclSecurity]: {
|
|
319
|
+
action: binary.UINT16_LE,
|
|
320
|
+
parent: HasDeclSecurity,
|
|
321
|
+
permission_set: clr_Blob,
|
|
322
|
+
},
|
|
323
|
+
[TABLE.ClassLayout]: {
|
|
324
|
+
packing_size: binary.UINT16_LE,
|
|
325
|
+
class_size: binary.UINT32_LE,
|
|
326
|
+
parent: Indexed(TABLE.TypeDef),
|
|
327
|
+
},
|
|
328
|
+
[TABLE.FieldLayout]: {
|
|
329
|
+
offset: binary.UINT32_LE,
|
|
330
|
+
field: Indexed(TABLE.Field),
|
|
331
|
+
},
|
|
332
|
+
[TABLE.StandAloneSig]: {
|
|
333
|
+
signature: Signature,
|
|
334
|
+
},
|
|
335
|
+
[TABLE.EventMap]: {
|
|
336
|
+
parent: Indexed(TABLE.TypeDef),
|
|
337
|
+
event_list: IndexedList(TABLE.Event),
|
|
338
|
+
},
|
|
339
|
+
[TABLE.Event]: {
|
|
340
|
+
flags: binary.UINT16_LE,
|
|
341
|
+
name: clr_String,
|
|
342
|
+
event_type: TypeDefOrRef,
|
|
343
|
+
},
|
|
344
|
+
[TABLE.PropertyMap]: {
|
|
345
|
+
parent: Indexed(TABLE.TypeDef),
|
|
346
|
+
property_list: IndexedList(TABLE.Property),
|
|
347
|
+
},
|
|
348
|
+
[TABLE.Property]: {
|
|
349
|
+
flags: binary.UINT16_LE,
|
|
350
|
+
name: clr_String,
|
|
351
|
+
type: Signature,
|
|
352
|
+
},
|
|
353
|
+
[TABLE.MethodSemantics]: {
|
|
354
|
+
flags: binary.UINT16_LE,
|
|
355
|
+
method: Indexed(TABLE.MethodDef),
|
|
356
|
+
association: HasSemantics,
|
|
357
|
+
},
|
|
358
|
+
[TABLE.MethodImpl]: {
|
|
359
|
+
clss: Indexed(TABLE.TypeDef),
|
|
360
|
+
method_body: MethodDefOrRef,
|
|
361
|
+
method_declaration: MethodDefOrRef,
|
|
362
|
+
},
|
|
363
|
+
[TABLE.ModuleRef]: {
|
|
364
|
+
name: clr_String,
|
|
365
|
+
},
|
|
366
|
+
[TABLE.TypeSpec]: {
|
|
367
|
+
signature: clr_Blob,
|
|
368
|
+
},
|
|
369
|
+
[TABLE.ImplMap]: {
|
|
370
|
+
flags: binary.UINT16_LE,
|
|
371
|
+
member_forwarded: MemberForwarded,
|
|
372
|
+
name: clr_String,
|
|
373
|
+
scope: Indexed(TABLE.ModuleRef),
|
|
374
|
+
},
|
|
375
|
+
[TABLE.FieldRVA]: {
|
|
376
|
+
rva: binary.UINT32_LE,
|
|
377
|
+
field: Indexed(TABLE.Field),
|
|
378
|
+
},
|
|
379
|
+
[TABLE.Assembly]: {
|
|
380
|
+
hashalg: binary.UINT32_LE,
|
|
381
|
+
major: binary.UINT16_LE,
|
|
382
|
+
minor: binary.UINT16_LE,
|
|
383
|
+
build: binary.UINT16_LE,
|
|
384
|
+
rev: binary.UINT16_LE,
|
|
385
|
+
flags: binary.UINT32_LE,
|
|
386
|
+
publickey: clr_Blob,
|
|
387
|
+
name: clr_String,
|
|
388
|
+
culture: clr_String,
|
|
389
|
+
},
|
|
390
|
+
[TABLE.AssemblyProcessor]: {
|
|
391
|
+
processor: binary.UINT32_LE,
|
|
392
|
+
},
|
|
393
|
+
[TABLE.AssemblyOS]: {
|
|
394
|
+
platform: binary.UINT32_LE,
|
|
395
|
+
minor: binary.UINT32_LE,
|
|
396
|
+
major: binary.UINT32_LE,
|
|
397
|
+
},
|
|
398
|
+
[TABLE.AssemblyRef]: {
|
|
399
|
+
major: binary.UINT16_LE,
|
|
400
|
+
minor: binary.UINT16_LE,
|
|
401
|
+
build: binary.UINT16_LE,
|
|
402
|
+
rev: binary.UINT16_LE,
|
|
403
|
+
flags: binary.UINT32_LE,
|
|
404
|
+
publickey: clr_Blob,
|
|
405
|
+
name: clr_String,
|
|
406
|
+
culture: clr_String,
|
|
407
|
+
hashvalue: clr_Blob,
|
|
408
|
+
},
|
|
409
|
+
[TABLE.AssemblyRefProcessor]: {
|
|
410
|
+
processor: binary.UINT32_LE,
|
|
411
|
+
assembly: Indexed(TABLE.AssemblyRef),
|
|
412
|
+
},
|
|
413
|
+
[TABLE.AssemblyRefOS]: {
|
|
414
|
+
platform: binary.UINT32_LE,
|
|
415
|
+
major: binary.UINT32_LE,
|
|
416
|
+
minor: binary.UINT32_LE,
|
|
417
|
+
assembly: Indexed(TABLE.AssemblyRef),
|
|
418
|
+
},
|
|
419
|
+
[TABLE.File]: {
|
|
420
|
+
flags: binary.UINT32_LE,
|
|
421
|
+
name: clr_String,
|
|
422
|
+
hash: clr_Blob,
|
|
423
|
+
},
|
|
424
|
+
[TABLE.ExportedType]: {
|
|
425
|
+
flags: binary.UINT32_LE,
|
|
426
|
+
typedef_id: binary.UINT32_LE, //(a 4-byte index into a TypeDef table of another module in this Assembly).
|
|
427
|
+
name: clr_String,
|
|
428
|
+
namespce: clr_String,
|
|
429
|
+
implementation: Implementation,
|
|
430
|
+
},
|
|
431
|
+
[TABLE.ManifestResource]: {
|
|
432
|
+
data: binary.UINT32_LE,
|
|
433
|
+
flags: binary.UINT32_LE,
|
|
434
|
+
name: clr_String,
|
|
435
|
+
implementation: Implementation,
|
|
436
|
+
},
|
|
437
|
+
[TABLE.NestedClass]: {
|
|
438
|
+
nested_class: Indexed(TABLE.TypeDef),
|
|
439
|
+
enclosing_class: Indexed(TABLE.TypeDef),
|
|
440
|
+
},
|
|
441
|
+
[TABLE.GenericParam]: {
|
|
442
|
+
number: binary.UINT16_LE,
|
|
443
|
+
flags: binary.UINT16_LE,
|
|
444
|
+
owner: TypeOrMethodDef,
|
|
445
|
+
name: clr_String,
|
|
446
|
+
},
|
|
447
|
+
[TABLE.MethodSpec]: {
|
|
448
|
+
method: MethodDefOrRef,
|
|
449
|
+
instantiation: Signature,
|
|
450
|
+
},
|
|
451
|
+
[TABLE.GenericParamConstraint]: {
|
|
452
|
+
owner: Indexed(TABLE.GenericParam),
|
|
453
|
+
constraint: TypeDefOrRef,
|
|
454
|
+
},
|
|
497
455
|
};
|
|
498
456
|
const ResourceManagerHeader = {
|
|
499
457
|
magic: binary.UINT32_LE,
|
|
@@ -512,22 +470,12 @@ const ResourceEntry = {
|
|
|
512
470
|
offset: binary.UINT32_LE,
|
|
513
471
|
};
|
|
514
472
|
class CLR {
|
|
473
|
+
raw;
|
|
515
474
|
header;
|
|
516
475
|
table_info;
|
|
517
476
|
heaps = [];
|
|
518
477
|
tables;
|
|
519
|
-
raw;
|
|
520
478
|
Resources;
|
|
521
|
-
/*
|
|
522
|
-
static async load(dll: string) {
|
|
523
|
-
const p = await pe.PE.load(dll);
|
|
524
|
-
if (p) {
|
|
525
|
-
const clr_data = p.GetDataDir(p.opt.DataDirectory.CLR_DESCRIPTOR);
|
|
526
|
-
if (clr_data)
|
|
527
|
-
return new CLR(p, clr_data);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
*/
|
|
531
479
|
constructor(pe, clr_data) {
|
|
532
480
|
this.header = binary.read(new binary.stream(clr_data), CLR_HEADER);
|
|
533
481
|
const meta_data = pe.GetDataDir(this.header.MetaData);
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import * as binary from '@isopodlabs/binary';
|
|
2
|
+
declare const PT: {
|
|
3
|
+
readonly NULL: 0;
|
|
4
|
+
readonly LOAD: 1;
|
|
5
|
+
readonly DYNAMIC: 2;
|
|
6
|
+
readonly INTERP: 3;
|
|
7
|
+
readonly NOTE: 4;
|
|
8
|
+
readonly SHLIB: 5;
|
|
9
|
+
readonly PHDR: 6;
|
|
10
|
+
readonly TLS: 7;
|
|
11
|
+
readonly LOOS: 1610612736;
|
|
12
|
+
readonly UNWIND: 1684333904;
|
|
13
|
+
readonly EH_FRAME: 1685382480;
|
|
14
|
+
readonly GNU_STACK: 1685382481;
|
|
15
|
+
readonly GNU_RELRO: 1685382482;
|
|
16
|
+
readonly OS_SCE: 1879047936;
|
|
17
|
+
readonly HIOS: 1879048191;
|
|
18
|
+
readonly LOPROC: 1879048192;
|
|
19
|
+
readonly HIPROC: 2147483647;
|
|
20
|
+
};
|
|
21
|
+
declare const SHT: {
|
|
22
|
+
readonly NULL: 0;
|
|
23
|
+
readonly PROGBITS: 1;
|
|
24
|
+
readonly SYMTAB: 2;
|
|
25
|
+
readonly STRTAB: 3;
|
|
26
|
+
readonly RELA: 4;
|
|
27
|
+
readonly HASH: 5;
|
|
28
|
+
readonly DYNAMIC: 6;
|
|
29
|
+
readonly NOTE: 7;
|
|
30
|
+
readonly NOBITS: 8;
|
|
31
|
+
readonly REL: 9;
|
|
32
|
+
readonly SHLIB: 10;
|
|
33
|
+
readonly DYNSYM: 11;
|
|
34
|
+
readonly LOOS: 1610612736;
|
|
35
|
+
readonly HIOS: 1879048191;
|
|
36
|
+
readonly LOPROC: 1879048192;
|
|
37
|
+
readonly HIPROC: 2147483647;
|
|
38
|
+
readonly LOUSER: 2147483648;
|
|
39
|
+
readonly HIUSER: 4294967295;
|
|
40
|
+
readonly PS3_RELA: number;
|
|
41
|
+
};
|
|
42
|
+
export declare class ELFFile {
|
|
43
|
+
static check(data: Uint8Array): boolean;
|
|
44
|
+
segments: [string, {
|
|
45
|
+
data: binary.MappedMemory;
|
|
46
|
+
p_type: string;
|
|
47
|
+
p_flags: Record<string, bigint | boolean> | Record<string, number | boolean>;
|
|
48
|
+
p_offset: number | bigint;
|
|
49
|
+
p_vaddr: binary.hex<number | bigint>;
|
|
50
|
+
p_paddr: binary.hex<number | bigint>;
|
|
51
|
+
p_filesz: number | bigint;
|
|
52
|
+
p_memsz: number | bigint;
|
|
53
|
+
p_align: number | bigint;
|
|
54
|
+
}][];
|
|
55
|
+
sections: [string, {
|
|
56
|
+
data: binary.MappedMemory;
|
|
57
|
+
sh_name: number;
|
|
58
|
+
sh_type: string;
|
|
59
|
+
sh_flags: Record<string, bigint | boolean> | Record<string, number | boolean>;
|
|
60
|
+
sh_addr: binary.hex<number | bigint>;
|
|
61
|
+
sh_offset: number | bigint;
|
|
62
|
+
sh_size: number | bigint;
|
|
63
|
+
sh_link: number;
|
|
64
|
+
sh_info: number;
|
|
65
|
+
sh_addralign: number | bigint;
|
|
66
|
+
sh_entsize: number | bigint;
|
|
67
|
+
}][];
|
|
68
|
+
header: {
|
|
69
|
+
e_type: string;
|
|
70
|
+
e_machine: string;
|
|
71
|
+
e_version: string;
|
|
72
|
+
e_entry: binary.hex<number | bigint>;
|
|
73
|
+
e_phoff: number | bigint;
|
|
74
|
+
e_shoff: number | bigint;
|
|
75
|
+
e_flags: number;
|
|
76
|
+
e_ehsize: number;
|
|
77
|
+
e_phentsize: number;
|
|
78
|
+
e_phnum: number;
|
|
79
|
+
e_shentsize: number;
|
|
80
|
+
e_shnum: number;
|
|
81
|
+
e_shstrndx: number;
|
|
82
|
+
};
|
|
83
|
+
getDynamic: () => {
|
|
84
|
+
d_tag: string;
|
|
85
|
+
d_val: number | bigint;
|
|
86
|
+
}[] | undefined;
|
|
87
|
+
getRel: () => {
|
|
88
|
+
r_offset: binary.hex<number | bigint>;
|
|
89
|
+
r_info: never;
|
|
90
|
+
}[] | undefined;
|
|
91
|
+
getRelA: () => {
|
|
92
|
+
r_addend: number | bigint;
|
|
93
|
+
r_offset: binary.hex<number | bigint>;
|
|
94
|
+
r_info: never;
|
|
95
|
+
}[] | undefined;
|
|
96
|
+
getSymbols: () => [string, {
|
|
97
|
+
st_info: {
|
|
98
|
+
type: string;
|
|
99
|
+
binding: string;
|
|
100
|
+
};
|
|
101
|
+
st_other: {
|
|
102
|
+
visibility: string;
|
|
103
|
+
other: number | bigint;
|
|
104
|
+
};
|
|
105
|
+
st_shndx: string;
|
|
106
|
+
st_value: binary.hex<number | bigint>;
|
|
107
|
+
st_size: number | bigint;
|
|
108
|
+
data: binary.MappedMemory | undefined;
|
|
109
|
+
st_name: number;
|
|
110
|
+
}][] | undefined;
|
|
111
|
+
getDynamicSymbols: () => [string, {
|
|
112
|
+
st_info: {
|
|
113
|
+
type: string;
|
|
114
|
+
binding: string;
|
|
115
|
+
};
|
|
116
|
+
st_other: {
|
|
117
|
+
visibility: string;
|
|
118
|
+
other: number | bigint;
|
|
119
|
+
};
|
|
120
|
+
st_shndx: string;
|
|
121
|
+
st_value: binary.hex<number | bigint>;
|
|
122
|
+
st_size: number | bigint;
|
|
123
|
+
data: binary.MappedMemory | undefined;
|
|
124
|
+
st_name: number;
|
|
125
|
+
}][] | undefined;
|
|
126
|
+
constructor(data: Uint8Array);
|
|
127
|
+
getSegmentByType(type: keyof typeof PT): {
|
|
128
|
+
data: binary.MappedMemory;
|
|
129
|
+
p_type: string;
|
|
130
|
+
p_flags: Record<string, bigint | boolean> | Record<string, number | boolean>;
|
|
131
|
+
p_offset: number | bigint;
|
|
132
|
+
p_vaddr: binary.hex<number | bigint>;
|
|
133
|
+
p_paddr: binary.hex<number | bigint>;
|
|
134
|
+
p_filesz: number | bigint;
|
|
135
|
+
p_memsz: number | bigint;
|
|
136
|
+
p_align: number | bigint;
|
|
137
|
+
} | undefined;
|
|
138
|
+
getSectionByType(type: keyof typeof SHT): {
|
|
139
|
+
data: binary.MappedMemory;
|
|
140
|
+
sh_name: number;
|
|
141
|
+
sh_type: string;
|
|
142
|
+
sh_flags: Record<string, bigint | boolean> | Record<string, number | boolean>;
|
|
143
|
+
sh_addr: binary.hex<number | bigint>;
|
|
144
|
+
sh_offset: number | bigint;
|
|
145
|
+
sh_size: number | bigint;
|
|
146
|
+
sh_link: number;
|
|
147
|
+
sh_info: number;
|
|
148
|
+
sh_addralign: number | bigint;
|
|
149
|
+
sh_entsize: number | bigint;
|
|
150
|
+
} | undefined;
|
|
151
|
+
}
|
|
152
|
+
export {};
|
package/dist/elf.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as binary from '@isopodlabs/binary';
|
|
2
2
|
export declare class ELFFile {
|
|
3
|
+
static check(data: Uint8Array): boolean;
|
|
3
4
|
segments: [string, {
|
|
4
5
|
data: binary.MappedMemory;
|
|
5
6
|
p_type: string;
|
|
@@ -39,7 +40,6 @@ export declare class ELFFile {
|
|
|
39
40
|
e_shnum: number;
|
|
40
41
|
e_shstrndx: number;
|
|
41
42
|
};
|
|
42
|
-
static check(data: Uint8Array): boolean;
|
|
43
43
|
getDynamic: () => {
|
|
44
44
|
d_tag: string;
|
|
45
45
|
d_val: number | bigint;
|