macho/macho-go/internal/wrapper/cli_parser.go

104 lines
6.1 KiB
Go
Raw Normal View History

2023-05-31 16:17:03 +07:00
package wrapper
type WrapArgument struct {
Config string `short:"c" required help:"User config.json" type:"existingfile"`
Out string `short:"o" required name:"outfile" help:"Modified Mach-O/Fat binary output file" type:"path"`
Bcell string `short:"b" required help:"bcell.dat output file" type:"path"`
Signed bool `short:"s" required help:"Output Protobuf<SignedData> for bcell.dat"`
OFile string `arg help:"Path to Mach-O/Fat binary file" type:"existingfile"`
}
type VltkArgument struct {
2023-05-31 16:31:52 +07:00
Out string `short:"o" required name:"outfile" help:"Modified Mach-O/Fat binary output file" type:"path"`
OFile string `arg help:"Path to Mach-O/Fat binary file" type:"existingfile"`
2023-05-31 16:17:03 +07:00
}
type InfoArgument struct {
OFile string `arg help:"Path to Mach-O/Fat binary file" type:"existingfile"`
2023-05-31 16:31:52 +07:00
All bool `short:"a" help:"If print all information"`
Arch string `help:"Only print information in this arch"`
2023-05-31 16:17:03 +07:00
}
type RemoveCodesignArgument struct {
Out string `short:"o" required name:"outfile" help:"Modified Mach-O/Fat binary output file" type:"path"`
OFile string `arg help:"Path to Mach-O/Fat binary file" type:"existingfile"`
}
2023-06-01 17:29:23 +07:00
type RemoveImportsArgument struct {
Out string `short:"o" required name:"outfile" help:"Modified Mach-O/Fat binary output file" type:"path"`
2023-06-26 15:28:16 +07:00
Bcell string `short:"b" required help:"bcell.dat output file" type:"path"`
2023-06-01 17:29:23 +07:00
OFile string `arg help:"Path to Mach-O/Fat binary file" type:"existingfile"`
}
2023-05-31 16:17:03 +07:00
type SignedBcellArgument struct {
Out string `short:"o" required name:"outfile" help:"bcell.dat.signed output file" type:"existingfile"`
Bcell string `arg short:"b" required help:"bcell.dat input file" type:"existingfile"`
}
type DisplayBcellArgument struct {
Bcell string `arg short:"b" required help:"Protobuf<BcellFile> bcell.dat input file" type:"existingfile"`
}
type Addr2LineArgument struct {
Load string `short:"l" required help:"Load address of binary"`
Dwarf string `short:"d" required help:"Path to Mach-O DWARF binary file" type:"existingfile"`
Addresses []string `arg help:"Addresses to resolve"`
}
type LipoArgument struct {
2023-05-31 16:31:52 +07:00
Join struct {
Out string `short:"o" required help:"Output Fat binary file" type:"path"`
Macho []string `arg help:"Macho binaries to join" type:"existingfile"`
} `cmd help:"Join Macho binaries into Fat binary"`
Split struct {
Fat string `arg help:"Fat binary to split" type:"existingfile"`
} `cmd help:"Split fat binary into files, named <name>_<arch>"`
2023-05-31 16:17:03 +07:00
}
type PepeArgument struct {
2023-06-26 15:28:16 +07:00
Out string `short:"o" required name:"outfile" help:"Output file after transformation" type:"path"`
Bcell string `short:"b" required help:"bcell.dat output file" type:"path"`
OFile string `arg help:"Path to Mach-O/Fat binary file" type:"existingfile"`
Dylibs []string `short:"l" help:"Add more LC_DYLIB"`
Rpath []string `short:"r" help:"Add more LC_RPATH"`
RemoveCodeSign bool `default:"false" negatable:"" help:"Remove LC_CODE_SIGNATURE"`
RemoveExports bool `default:"false" negatable:"" help:"Clear the export table/trie"`
RemoveSymbolTable bool `default:"true" negatable:"" help:"Remove LC_SYMTAB and LC_DYSYMTAB"`
RemoveOthers bool `default:"false" negatable:"" help:"Remove LC_FUNCTION_STARTS, LC_DATA_IN_CODE, ..."`
RemoveID bool `default:"false" negatable:"" help:"(TODO) Remove LC_ID_DYLIB"`
RemoveInitFunctions bool `default:"false" name:"remove-inits" negatable:"" help:"Clear MOD_INIT_FUNC section"`
RemoveBindSymbols bool `default:"false" name:"remove-imports" negatable:"" help:"Remove all bind symbols information"`
RemoveObjCString bool `default:"false" negatable:"" help:"(TODO) Remove references, string litteral to Objctive-C strings"`
RebuildLinkEdit bool `default:"false" negatable:"" help:"(TODO) Rebuild the LINKEDIT section"`
FullRemoval bool `default:"false" help:"Apply every removal possible"`
2023-07-11 10:06:59 +07:00
2023-07-12 13:37:54 +07:00
KeepImports []string `short:"keep" help:"Do not remove import symbols and allow dyld resolve. If symbols is found with more than 1 occurrances, specify the library with a comma or else all occurrances will be kept. e.g., _symbol,libLIB.dylib"`
2023-06-15 10:41:18 +07:00
}
type BcellToHeaderArgument struct {
2023-06-26 15:28:16 +07:00
Out string `short:"o" required name:"outfile" help:"Header file name to output to" type:"path"`
Bcell string `short:"b" required help:"Input bcell.dat file" type:"existingfile"`
2023-05-31 16:17:03 +07:00
}
type Argument struct {
Wrap WrapArgument `cmd help:"Modifies Mach-O/Fat binary"`
Vltk VltkArgument `cmd help:"Modifies Mach-O/Fat binary"`
Info InfoArgument `cmd help:"Show Mach-O/Fat binary information"`
2023-06-01 17:29:23 +07:00
RemoveImports RemoveImportsArgument `cmd aliases:"remove-imports" name:"remove-imports" help:"Remove imports"`
2023-05-31 16:17:03 +07:00
RemoveCodesign RemoveCodesignArgument `cmd aliases:"remove-signature" name:"remove-codesign" help:"Remove LC_CODE_SIGNATURE from Mach-O/Fat binary"`
SignedBcell SignedBcellArgument `cmd name:"signed-bcell" help:"Change Protobuf<BcellFile> into Protobuf<SignedData>"`
2023-05-31 16:31:52 +07:00
DisplayBcell DisplayBcellArgument `cmd name:"display-bcell" help:"Display Protobuf<BcellFile> content"`
Addr2Line Addr2LineArgument `cmd name:"addr2line" help:"Resolve crash address from DWARF file"`
Lipo LipoArgument `cmd help:"split Fat binary or join Mach-O binares"`
2023-06-15 10:41:18 +07:00
Pepe PepeArgument `cmd help:"custom command"`
2023-06-26 15:28:16 +07:00
BcellToHeader BcellToHeaderArgument `cmd name:"bcell2header" help:"Build C header file from bcell file"`
AddSection struct {
Out string `short:"o" required name:"outfile" help:"Output file after transformation"`
Data string `arg help:"Input data file to fill in this section, or null if not provided" type:"existingfile"`
OFile string `arg help:"Path to Mach-O/Fat binary file" type:"existingfile"`
Segment string `required help:"Segment name"`
Section string `required help:"Section name"`
Size int `required help:"Size of segment/section"`
} `cmd:"" default:"false" help:"(TODO) Add a new segment with 1 section, segment starts at the end of last segment"`
2023-05-31 16:17:03 +07:00
}