mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add MachoManiac
This commit is contained in:
parent
04c0b7aeae
commit
50b1c46678
34 changed files with 5269 additions and 0 deletions
70
helpers/macho/macho.segment.js
Normal file
70
helpers/macho/macho.segment.js
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
//Global Constants
|
||||
var SG_FLAGS = [];
|
||||
|
||||
let SG_FLAG = {
|
||||
SG_HIGHVM: 0x1,
|
||||
SG_FVMLIB: 0x2,
|
||||
SG_NORELOC: 0x4,
|
||||
|
||||
DESCRIPTION: function(search) {
|
||||
let result = SG_FLAGS[search];
|
||||
return (result != undefined) ? result : search;
|
||||
},
|
||||
|
||||
toString: function() {
|
||||
return JSON.stringify(this);
|
||||
}
|
||||
};
|
||||
|
||||
SG_FLAGS[SG_FLAG.SG_HIGHVM] = 'SG_HIGHVM';
|
||||
SG_FLAGS[SG_FLAG.SG_FVMLIB] = 'SG_FVMLIB';
|
||||
SG_FLAGS[SG_FLAG.SG_NORELOC] = 'SG_NORELOC';
|
||||
|
||||
let SEGMENT = {
|
||||
SEG_PAGEZERO: "__PAGEZERO",
|
||||
SEG_TEXT: "__TEXT",
|
||||
SEG_ICON: "__ICON",
|
||||
SEG_OBJC: "__OBJC",
|
||||
SEG_LINKEDIT: "__LINKEDIT",
|
||||
SEG_UNIXSTACK: "__UNIXSTACK",
|
||||
SEG_DATA: "__DATA",
|
||||
toString: function() {
|
||||
return JSON.stringify(this);
|
||||
}
|
||||
};
|
||||
|
||||
//32-bits segment command
|
||||
var SegmentCommand = function SegmentCommand(type, size, segname, vmaddr, vmsize, fileoff, filesize, maxprot, initprot, nsects, flags) {
|
||||
this.cmd = type || 0x00000000;
|
||||
this.cmdsize = size || 0x00000000;
|
||||
this.segname = new TextEncoder("utf-8").encode(segname) || new Uint8Array(16);
|
||||
this.vmaddr = vmaddr || 0x00000000;
|
||||
this.vmsize = vmsize || 0x00000000;
|
||||
this.fileoff = fileoff || 0x00000000;
|
||||
this.filesize = filesize || 0x00000000;
|
||||
this.maxprot = maxprot || 0x00000000;
|
||||
this.initprot = initprot || 0x00000000;
|
||||
this.nsects = nsects || 0x00000000;
|
||||
this.flags = flags || 0x00000000;
|
||||
this.toString = function() {
|
||||
return JSON.stringify(this);
|
||||
};
|
||||
};
|
||||
|
||||
//64-bits segment command
|
||||
var SegmentCommand64 = function SegmentCommand64(cmd, cmdsize, segname, vmaddr, vmsize, fileoff, filesize, maxprot, initprot, nsects, flags) {
|
||||
this.cmd = cmd || 0x00000000;
|
||||
this.cmdsize = cmdsize || 0x00000000;
|
||||
this.segname = new TextEncoder("utf-8").encode(segname) || new Uint8Array(16);
|
||||
this.vmaddr = vmaddr || 0x0000000000000000;
|
||||
this.vmsize = vmsize || 0x0000000000000000;
|
||||
this.fileoff = fileoff || 0x0000000000000000;
|
||||
this.filesize = filesize || 0x0000000000000000;
|
||||
this.maxprot = maxprot || 0x00000000;
|
||||
this.initprot = initprot || 0x00000000;
|
||||
this.nsects = nsects || 0x00000000;
|
||||
this.flags = flags || 0x00000000;
|
||||
this.toString = function() {
|
||||
return JSON.stringify(this);
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue