@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/dist/mach.d.ts ADDED
@@ -0,0 +1,543 @@
1
+ import * as binary from '@isopodlabs/binary';
2
+ declare class mach_stream extends binary.stream_endian {
3
+ base: Uint8Array;
4
+ mem?: binary.utils.memory | undefined;
5
+ constructor(base: Uint8Array, data: Uint8Array, be: boolean, mem?: binary.utils.memory | undefined);
6
+ subdata(offset: number, size?: number): Uint8Array;
7
+ substream(offset: number, size?: number): mach_stream;
8
+ getmem(address: bigint, size: number): Uint8Array | Promise<Uint8Array> | undefined;
9
+ }
10
+ declare const fat_arch: {
11
+ cputype: {
12
+ get(s: binary._stream, obj: any): string;
13
+ put(s: binary._stream, v: string): void;
14
+ };
15
+ cpusubtype: {
16
+ get(s: binary._stream, obj: any): string | number;
17
+ put(s: binary._stream, v: string | number): void;
18
+ };
19
+ offset: {
20
+ get(s: binary._stream): number;
21
+ put(s: binary._stream, v: number): void;
22
+ };
23
+ size: {
24
+ get(s: binary._stream): number;
25
+ put(s: binary._stream, v: number): void;
26
+ };
27
+ align: {
28
+ get(s: binary._stream): number;
29
+ put(s: binary._stream, v: number): void;
30
+ };
31
+ contents: {
32
+ get(s: binary._stream): MachFile | undefined;
33
+ put(s: binary._stream, v: MachFile): void;
34
+ };
35
+ };
36
+ export declare const CMD: {
37
+ readonly SEGMENT: 1;
38
+ readonly SYMTAB: 2;
39
+ readonly SYMSEG: 3;
40
+ readonly THREAD: 4;
41
+ readonly UNIXTHREAD: 5;
42
+ readonly LOADFVMLIB: 6;
43
+ readonly IDFVMLIB: 7;
44
+ readonly IDENT: 8;
45
+ readonly FVMFILE: 9;
46
+ readonly PREPAGE: 10;
47
+ readonly DYSYMTAB: 11;
48
+ readonly LOAD_DYLIB: 12;
49
+ readonly ID_DYLIB: 13;
50
+ readonly LOAD_DYLINKER: 14;
51
+ readonly ID_DYLINKER: 15;
52
+ readonly PREBOUND_DYLIB: 16;
53
+ readonly ROUTINES: 17;
54
+ readonly SUB_FRAMEWORK: 18;
55
+ readonly SUB_UMBRELLA: 19;
56
+ readonly SUB_CLIENT: 20;
57
+ readonly SUB_LIBRARY: 21;
58
+ readonly TWOLEVEL_HINTS: 22;
59
+ readonly PREBIND_CKSUM: 23;
60
+ readonly LOAD_WEAK_DYLIB: number;
61
+ readonly SEGMENT_64: 25;
62
+ readonly ROUTINES_64: 26;
63
+ readonly UUID: 27;
64
+ readonly RPATH: number;
65
+ readonly CODE_SIGNATURE: 29;
66
+ readonly SEGMENT_SPLIT_INFO: 30;
67
+ readonly REEXPORT_DYLIB: number;
68
+ readonly LAZY_LOAD_DYLIB: 32;
69
+ readonly ENCRYPTION_INFO: 33;
70
+ readonly DYLD_INFO: 34;
71
+ readonly DYLD_INFO_ONLY: number;
72
+ readonly LOAD_UPWARD_DYLIB: number;
73
+ readonly VERSION_MIN_MACOSX: 36;
74
+ readonly VERSION_MIN_IPHONEOS: 37;
75
+ readonly FUNCTION_STARTS: 38;
76
+ readonly DYLD_ENVIRONMENT: 39;
77
+ readonly MAIN: number;
78
+ readonly DATA_IN_CODE: 41;
79
+ readonly SOURCE_VERSION: 42;
80
+ readonly DYLIB_CODE_SIGN_DRS: 43;
81
+ readonly ENCRYPTION_INFO_64: 44;
82
+ readonly LINKER_OPTION: 45;
83
+ readonly LINKER_OPTIMIZATION_HINT: 46;
84
+ readonly VERSION_MIN_TVOS: 47;
85
+ readonly VERSION_MIN_WATCHOS: 48;
86
+ readonly NOTE: 49;
87
+ readonly BUILD_VERSION: 50;
88
+ readonly DYLD_EXPORTS_TRIE: number;
89
+ readonly DYLD_CHAINED_FIXUPS: number;
90
+ };
91
+ export type CMD = typeof CMD[keyof typeof CMD];
92
+ declare function segment(bits: 32 | 64): {
93
+ get(s: mach_stream): Promise<{
94
+ data: binary.utils.MappedMemory | undefined;
95
+ segname: string;
96
+ vmaddr: number | bigint;
97
+ vmsize: number | bigint;
98
+ fileoff: number | bigint;
99
+ filesize: number | bigint;
100
+ maxprot: number;
101
+ initprot: number;
102
+ nsects: number;
103
+ flags: Record<string, bigint | boolean> | Record<string, number | boolean>;
104
+ sections: Record<string, any> | undefined;
105
+ } & {}>;
106
+ };
107
+ export declare class MachFile {
108
+ header: any;
109
+ commands: {
110
+ cmd: CMD;
111
+ data: any;
112
+ }[];
113
+ ready: Promise<void>;
114
+ static check(data: Uint8Array): boolean;
115
+ constructor(data: Uint8Array, mem?: binary.utils.memory);
116
+ load(data: Uint8Array, be: boolean, bits: 32 | 64, mem?: binary.utils.memory): Promise<void>;
117
+ getCommand(cmd: CMD): any;
118
+ getCommandT<T extends CMD>(cmd: T): binary.ReadType<{
119
+ [x: number]: {};
120
+ 1: {
121
+ get(s: mach_stream): Promise<{
122
+ data: binary.utils.MappedMemory | undefined;
123
+ segname: string;
124
+ vmaddr: number | bigint;
125
+ vmsize: number | bigint;
126
+ fileoff: number | bigint;
127
+ filesize: number | bigint;
128
+ maxprot: number;
129
+ initprot: number;
130
+ nsects: number;
131
+ flags: Record<string, bigint | boolean> | Record<string, number | boolean>;
132
+ sections: Record<string, any> | undefined;
133
+ } & {}>;
134
+ };
135
+ 25: {
136
+ get(s: mach_stream): Promise<{
137
+ data: binary.utils.MappedMemory | undefined;
138
+ segname: string;
139
+ vmaddr: number | bigint;
140
+ vmsize: number | bigint;
141
+ fileoff: number | bigint;
142
+ filesize: number | bigint;
143
+ maxprot: number;
144
+ initprot: number;
145
+ nsects: number;
146
+ flags: Record<string, bigint | boolean> | Record<string, number | boolean>;
147
+ sections: Record<string, any> | undefined;
148
+ } & {}>;
149
+ };
150
+ 6: {
151
+ name: {
152
+ get(s: binary.stream): string;
153
+ };
154
+ minor_version: {
155
+ get(s: binary._stream, obj: any): binary.hex<number | bigint>;
156
+ put(s: binary._stream, v: binary.hex<number | bigint>): void;
157
+ };
158
+ header_addr: {
159
+ get(s: binary._stream, obj: any): binary.hex<number | bigint>;
160
+ put(s: binary._stream, v: binary.hex<number | bigint>): void;
161
+ };
162
+ };
163
+ 7: {
164
+ name: {
165
+ get(s: binary.stream): string;
166
+ };
167
+ minor_version: {
168
+ get(s: binary._stream, obj: any): binary.hex<number | bigint>;
169
+ put(s: binary._stream, v: binary.hex<number | bigint>): void;
170
+ };
171
+ header_addr: {
172
+ get(s: binary._stream, obj: any): binary.hex<number | bigint>;
173
+ put(s: binary._stream, v: binary.hex<number | bigint>): void;
174
+ };
175
+ };
176
+ 12: {
177
+ name: {
178
+ get(s: binary.stream): string;
179
+ };
180
+ timestamp: {
181
+ get(s: binary._stream): number;
182
+ put(s: binary._stream, v: number): void;
183
+ };
184
+ current_version: {
185
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
186
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
187
+ };
188
+ compatibility_version: {
189
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
190
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
191
+ };
192
+ };
193
+ 13: {
194
+ name: {
195
+ get(s: binary.stream): string;
196
+ };
197
+ timestamp: {
198
+ get(s: binary._stream): number;
199
+ put(s: binary._stream, v: number): void;
200
+ };
201
+ current_version: {
202
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
203
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
204
+ };
205
+ compatibility_version: {
206
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
207
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
208
+ };
209
+ };
210
+ 32: {
211
+ name: {
212
+ get(s: binary.stream): string;
213
+ };
214
+ timestamp: {
215
+ get(s: binary._stream): number;
216
+ put(s: binary._stream, v: number): void;
217
+ };
218
+ current_version: {
219
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
220
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
221
+ };
222
+ compatibility_version: {
223
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
224
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
225
+ };
226
+ };
227
+ 18: {
228
+ get(s: binary.stream): string;
229
+ };
230
+ 19: {
231
+ get(s: binary.stream): string;
232
+ };
233
+ 20: {
234
+ get(s: binary.stream): string;
235
+ };
236
+ 21: {
237
+ get(s: binary.stream): string;
238
+ };
239
+ 14: {
240
+ get(s: binary.stream): string;
241
+ };
242
+ 15: {
243
+ get(s: binary.stream): string;
244
+ };
245
+ 39: {
246
+ get(s: binary.stream): string;
247
+ };
248
+ 16: {
249
+ name: {
250
+ get(s: binary.stream): string;
251
+ };
252
+ nmodules: {
253
+ get(s: binary._stream): number;
254
+ put(s: binary._stream, v: number): void;
255
+ };
256
+ linked_modules: {
257
+ get(s: binary.stream): string;
258
+ };
259
+ };
260
+ 4: {};
261
+ 5: {};
262
+ 17: {
263
+ init_address: binary.TypeT<number> | binary.TypeT<bigint>;
264
+ init_module: binary.TypeT<number> | binary.TypeT<bigint>;
265
+ reserved1: binary.TypeT<number> | binary.TypeT<bigint>;
266
+ reserved2: binary.TypeT<number> | binary.TypeT<bigint>;
267
+ reserved3: binary.TypeT<number> | binary.TypeT<bigint>;
268
+ reserved4: binary.TypeT<number> | binary.TypeT<bigint>;
269
+ reserved5: binary.TypeT<number> | binary.TypeT<bigint>;
270
+ reserved6: binary.TypeT<number> | binary.TypeT<bigint>;
271
+ };
272
+ 26: {
273
+ init_address: binary.TypeT<number> | binary.TypeT<bigint>;
274
+ init_module: binary.TypeT<number> | binary.TypeT<bigint>;
275
+ reserved1: binary.TypeT<number> | binary.TypeT<bigint>;
276
+ reserved2: binary.TypeT<number> | binary.TypeT<bigint>;
277
+ reserved3: binary.TypeT<number> | binary.TypeT<bigint>;
278
+ reserved4: binary.TypeT<number> | binary.TypeT<bigint>;
279
+ reserved5: binary.TypeT<number> | binary.TypeT<bigint>;
280
+ reserved6: binary.TypeT<number> | binary.TypeT<bigint>;
281
+ };
282
+ 2: {
283
+ get(s: binary._stream): any[][] | undefined;
284
+ };
285
+ 22: {
286
+ get(s: mach_stream): any[] | undefined;
287
+ };
288
+ 23: {
289
+ cksum: {
290
+ get(s: binary._stream): number;
291
+ put(s: binary._stream, v: number): void;
292
+ };
293
+ };
294
+ 27: {
295
+ uuid: {
296
+ get: (s: binary._stream, obj?: any) => any;
297
+ put: (s: binary._stream, v: Uint8Array) => void;
298
+ };
299
+ };
300
+ 29: {
301
+ get(s: mach_stream): Uint8Array | undefined;
302
+ };
303
+ 30: {
304
+ get(s: mach_stream): Uint8Array | undefined;
305
+ };
306
+ 38: {
307
+ get(s: mach_stream): {
308
+ data: Uint8Array;
309
+ contents: (number | bigint)[];
310
+ };
311
+ };
312
+ 41: {
313
+ get(s: mach_stream): {
314
+ data: Uint8Array;
315
+ contents: ({
316
+ offset: binary.hex<number | bigint>;
317
+ length: number;
318
+ kind: string;
319
+ } & {})[];
320
+ };
321
+ };
322
+ 43: {
323
+ get(s: mach_stream): Uint8Array | undefined;
324
+ };
325
+ 46: {
326
+ get(s: mach_stream): Uint8Array | undefined;
327
+ };
328
+ 33: {
329
+ cryptoff: {
330
+ get(s: binary._stream): number;
331
+ put(s: binary._stream, v: number): void;
332
+ };
333
+ cryptsize: {
334
+ get(s: binary._stream): number;
335
+ put(s: binary._stream, v: number): void;
336
+ };
337
+ cryptid: {
338
+ get(s: binary._stream): number;
339
+ put(s: binary._stream, v: number): void;
340
+ };
341
+ };
342
+ 44: {
343
+ cryptoff: {
344
+ get(s: binary._stream): number;
345
+ put(s: binary._stream, v: number): void;
346
+ };
347
+ cryptsize: {
348
+ get(s: binary._stream): number;
349
+ put(s: binary._stream, v: number): void;
350
+ };
351
+ cryptid: {
352
+ get(s: binary._stream): number;
353
+ put(s: binary._stream, v: number): void;
354
+ };
355
+ pad: {
356
+ get(s: binary._stream): number;
357
+ put(s: binary._stream, v: number): void;
358
+ };
359
+ };
360
+ 36: {
361
+ version: {
362
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
363
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
364
+ };
365
+ reserved: {
366
+ get(s: binary._stream): number;
367
+ put(s: binary._stream, v: number): void;
368
+ };
369
+ };
370
+ 37: {
371
+ version: {
372
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
373
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
374
+ };
375
+ reserved: {
376
+ get(s: binary._stream): number;
377
+ put(s: binary._stream, v: number): void;
378
+ };
379
+ };
380
+ 47: {
381
+ version: {
382
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
383
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
384
+ };
385
+ reserved: {
386
+ get(s: binary._stream): number;
387
+ put(s: binary._stream, v: number): void;
388
+ };
389
+ };
390
+ 48: {
391
+ version: {
392
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
393
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
394
+ };
395
+ reserved: {
396
+ get(s: binary._stream): number;
397
+ put(s: binary._stream, v: number): void;
398
+ };
399
+ };
400
+ 34: {
401
+ rebase: {
402
+ get(s: mach_stream): Uint8Array | undefined;
403
+ };
404
+ bind: {
405
+ get(s: mach_stream): Uint8Array | undefined;
406
+ };
407
+ weak_bind: {
408
+ get(s: mach_stream): Uint8Array | undefined;
409
+ };
410
+ lazy_bind: {
411
+ get(s: mach_stream): Uint8Array | undefined;
412
+ };
413
+ exprt: {
414
+ get(s: mach_stream): Uint8Array | undefined;
415
+ };
416
+ };
417
+ 3: {
418
+ get(s: mach_stream): Uint8Array | undefined;
419
+ };
420
+ 8: {};
421
+ 9: {
422
+ name: {
423
+ get(s: binary.stream): string;
424
+ };
425
+ header_addr: {
426
+ get(s: binary._stream): number;
427
+ put(s: binary._stream, v: number): void;
428
+ };
429
+ };
430
+ 42: {
431
+ version: {
432
+ get(s: binary._stream, obj: any): {
433
+ a: number | bigint;
434
+ b: number | bigint;
435
+ c: number | bigint;
436
+ d: number | bigint;
437
+ e: number | bigint;
438
+ };
439
+ put(s: binary._stream, v: {
440
+ a: number | bigint;
441
+ b: number | bigint;
442
+ c: number | bigint;
443
+ d: number | bigint;
444
+ e: number | bigint;
445
+ }): void;
446
+ };
447
+ };
448
+ 50: {
449
+ platform: {
450
+ get(s: binary._stream, obj: any): string;
451
+ put(s: binary._stream, v: string): void;
452
+ };
453
+ minos: {
454
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
455
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
456
+ };
457
+ sdk: {
458
+ get(s: binary._stream, obj: any): Record<string, bigint | boolean> | Record<string, number | boolean>;
459
+ put(s: binary._stream, v: Record<string, bigint | boolean> | Record<string, number | boolean>): void;
460
+ };
461
+ tools: {
462
+ get: (s: binary._stream) => {
463
+ [k: string]: any;
464
+ };
465
+ put: (s: binary._stream, v: Record<string, any>) => void;
466
+ };
467
+ };
468
+ 45: {
469
+ count: {
470
+ get(s: binary._stream): number;
471
+ put(s: binary._stream, v: number): void;
472
+ };
473
+ };
474
+ 49: {
475
+ data_owner: {
476
+ get(s: binary._stream, obj?: any): string;
477
+ put(s: binary._stream, v: string): void;
478
+ };
479
+ data: {
480
+ get(s: mach_stream): Uint8Array | undefined;
481
+ };
482
+ };
483
+ 10: {};
484
+ 11: {
485
+ localsym: {
486
+ first: {
487
+ get(s: binary._stream): number;
488
+ put(s: binary._stream, v: number): void;
489
+ };
490
+ count: {
491
+ get(s: binary._stream): number;
492
+ put(s: binary._stream, v: number): void;
493
+ };
494
+ };
495
+ extdefsym: {
496
+ first: {
497
+ get(s: binary._stream): number;
498
+ put(s: binary._stream, v: number): void;
499
+ };
500
+ count: {
501
+ get(s: binary._stream): number;
502
+ put(s: binary._stream, v: number): void;
503
+ };
504
+ };
505
+ undefsym: {
506
+ first: {
507
+ get(s: binary._stream): number;
508
+ put(s: binary._stream, v: number): void;
509
+ };
510
+ count: {
511
+ get(s: binary._stream): number;
512
+ put(s: binary._stream, v: number): void;
513
+ };
514
+ };
515
+ toc: {
516
+ get(s: mach_stream): any[] | undefined;
517
+ };
518
+ modtab: {
519
+ get(s: mach_stream): any[] | undefined;
520
+ };
521
+ extrefsym: {
522
+ get(s: mach_stream): any[] | undefined;
523
+ };
524
+ indirectsym: {
525
+ get(s: mach_stream): any[] | undefined;
526
+ };
527
+ extrel: {
528
+ get(s: mach_stream): any[] | undefined;
529
+ };
530
+ locrel: {
531
+ get(s: mach_stream): any[] | undefined;
532
+ };
533
+ };
534
+ }[T]>;
535
+ getSegment(name: string): binary.ReadType<ReturnType<typeof segment>> | undefined;
536
+ }
537
+ export declare class FATMachFile {
538
+ archs: binary.ReadType<typeof fat_arch>[];
539
+ static check(data: Uint8Array): boolean;
540
+ constructor(data: Uint8Array, mem?: binary.utils.memory);
541
+ load(file: binary.stream_endian, mem?: binary.utils.memory): void;
542
+ }
543
+ export {};