@isopodlabs/binary_libs 0.2.2 → 1.0.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/dist/arch.d.ts +11 -19
- package/dist/clr.d.ts +398 -396
- package/dist/elf.d.ts +42 -2
- package/dist/elf.js +4 -4
- package/dist/mach.d.ts +399 -287
- package/dist/pe.d.ts +88 -86
- package/package.json +1 -1
package/dist/elf.d.ts
CHANGED
|
@@ -1,4 +1,44 @@
|
|
|
1
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
|
+
};
|
|
2
42
|
export declare class ELFFile {
|
|
3
43
|
static check(data: Uint8Array): boolean;
|
|
4
44
|
segments: [string, {
|
|
@@ -84,7 +124,7 @@ export declare class ELFFile {
|
|
|
84
124
|
st_name: number;
|
|
85
125
|
}][] | undefined;
|
|
86
126
|
constructor(data: Uint8Array);
|
|
87
|
-
getSegmentByType(type:
|
|
127
|
+
getSegmentByType(type: keyof typeof PT): {
|
|
88
128
|
data: binary.MappedMemory;
|
|
89
129
|
p_type: string;
|
|
90
130
|
p_flags: Record<string, bigint | boolean> | Record<string, number | boolean>;
|
|
@@ -95,7 +135,7 @@ export declare class ELFFile {
|
|
|
95
135
|
p_memsz: number | bigint;
|
|
96
136
|
p_align: number | bigint;
|
|
97
137
|
} | undefined;
|
|
98
|
-
getSectionByType(type:
|
|
138
|
+
getSectionByType(type: keyof typeof SHT): {
|
|
99
139
|
data: binary.MappedMemory;
|
|
100
140
|
sh_name: number;
|
|
101
141
|
sh_type: string;
|
package/dist/elf.js
CHANGED
|
@@ -41,7 +41,7 @@ const OSABI = {
|
|
|
41
41
|
HPUX: 1, // HP-UX operating system
|
|
42
42
|
STANDALONE: 255, // Standalone (embedded)application
|
|
43
43
|
};
|
|
44
|
-
const Ident =
|
|
44
|
+
const Ident = {
|
|
45
45
|
//enum {MAGIC = '\177ELF'};
|
|
46
46
|
magic: binary.UINT32_LE,
|
|
47
47
|
file_class: binary.asEnum(binary.UINT8, CLASS),
|
|
@@ -53,7 +53,7 @@ const Ident = binary.SizeType(16, {
|
|
|
53
53
|
abiversion: binary.UINT8,
|
|
54
54
|
pad: binary.ArrayType(7, binary.UINT8),
|
|
55
55
|
})
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
57
|
const ET = {
|
|
58
58
|
NONE: 0, // No file type
|
|
59
59
|
REL: 1, // Relocatable file
|
|
@@ -682,7 +682,7 @@ class ELFFile {
|
|
|
682
682
|
const flags = (this.p_flags.R ? 1 /* binary.MEM.READ */ : 0)
|
|
683
683
|
| (this.p_flags.W ? 2 /* binary.MEM.WRITE */ : 0)
|
|
684
684
|
| (this.p_flags.X ? 4 /* binary.MEM.EXECUTE */ : 0);
|
|
685
|
-
this.data = new binary.MappedMemory(s.buffer_at(Number(this.p_offset), Number(this.p_filesz)),
|
|
685
|
+
this.data = new binary.MappedMemory(s.buffer_at(Number(this.p_offset), Number(this.p_filesz)), Number(this.p_vaddr), flags);
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
class Shdr extends binary.ReadClass({
|
|
@@ -703,7 +703,7 @@ class ELFFile {
|
|
|
703
703
|
const flags = 1 /* binary.MEM.READ */
|
|
704
704
|
| (this.sh_flags.WRITE ? 2 /* binary.MEM.WRITE */ : 0)
|
|
705
705
|
| (this.sh_flags.EXECINSTR ? 4 /* binary.MEM.EXECUTE */ : 0);
|
|
706
|
-
this.data = new binary.MappedMemory(s.buffer_at(Number(this.sh_offset), Number(this.sh_size)),
|
|
706
|
+
this.data = new binary.MappedMemory(s.buffer_at(Number(this.sh_offset), Number(this.sh_size)), Number(this.sh_addr), flags);
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
709
|
const h = binary.read(s, Ehdr);
|