ruby-macho-utils 0.0.1 → 0.1.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.
- checksums.yaml +5 -5
- data/README.md +2 -0
- data/bin/macho-info +31 -21
- metadata +3 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6a9643eae4cd84a7ba0e1fa5a1c18d1d7291e4993d4457bc95eab08dd7c32072
|
4
|
+
data.tar.gz: cff16dc73f775e0c26b5f2b80445bc5ba18c2affe1e782f41a82b8ea22725029
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3d160a0ca5a38f95828ec983ee70936e6eb44a9242454242fe9e77daf9f1b63768826fd16cd974c2561d6bbf4413c08360ce020725a804e1f844b24ad236773
|
7
|
+
data.tar.gz: 9903f5c9655a8877a503adf775d66a8d8dd7341d6573193905fb6376210b7a2dc6fd1012f45752eedb1d5778e5ad1ff7295d77de86288e9647a918751c1924a5
|
data/README.md
CHANGED
data/bin/macho-info
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "macho"
|
4
|
-
require "
|
5
|
+
require "optparse"
|
6
|
+
require "json"
|
5
7
|
|
6
8
|
def macho_info(macho)
|
7
9
|
puts "FILE INFORMATION:"
|
@@ -24,7 +26,7 @@ def macho_info(macho)
|
|
24
26
|
|
25
27
|
puts "\nDYNAMIC LIBRARIES:"
|
26
28
|
macho.dylib_load_commands.each do |lc|
|
27
|
-
puts "\t#{lc.name
|
29
|
+
puts "\t#{lc.name} (#{lc.type})"
|
28
30
|
end
|
29
31
|
|
30
32
|
puts "\nSEGMENTS AND SECTIONS:"
|
@@ -40,34 +42,42 @@ def macho_info(macho)
|
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
+
options = {}
|
46
|
+
OptionParser.new do |parser|
|
47
|
+
parser.banner = <<~BANNER
|
45
48
|
Dump metadata and information in the given Mach-O binary.
|
46
49
|
|
47
50
|
Usage:
|
48
|
-
macho-info [
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
exit
|
51
|
+
macho-info [options] <file>
|
52
|
+
BANNER
|
53
|
+
|
54
|
+
parser.on "-f", "--first-only", "dump only the first slice of a universal binary" do |f|
|
55
|
+
options[:first_only] = f
|
54
56
|
end
|
55
|
-
end
|
56
57
|
|
57
|
-
|
58
|
+
parser.on "-j", "--json", "dump a JSON representation of the entire binary" do |j|
|
59
|
+
options[:json] = j
|
60
|
+
end
|
61
|
+
end.parse!
|
62
|
+
|
63
|
+
filename = ARGV.shift || abort("I need a file to dump.")
|
58
64
|
|
59
65
|
macho_file = MachO.open(filename)
|
60
66
|
|
61
|
-
if
|
62
|
-
|
67
|
+
if options[:json]
|
68
|
+
puts macho_file.to_h.to_json
|
63
69
|
else
|
64
|
-
macho_slices =
|
65
|
-
|
70
|
+
macho_slices = if macho_file.is_a?(MachO::FatFile)
|
71
|
+
macho_file.machos
|
72
|
+
else
|
73
|
+
[macho_file]
|
74
|
+
end
|
66
75
|
|
67
|
-
if
|
68
|
-
|
69
|
-
else
|
70
|
-
|
71
|
-
|
76
|
+
if options[:first_only]
|
77
|
+
macho_info(macho_slices.first)
|
78
|
+
else
|
79
|
+
macho_slices.each do |macho|
|
80
|
+
macho_info(macho)
|
81
|
+
end
|
72
82
|
end
|
73
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-macho-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Woodruff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-macho
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: slop
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '4.4'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '4.4'
|
41
27
|
description: A collection of command line utilities for use with ruby-macho.
|
42
28
|
email: william@tuffbizz.com
|
43
29
|
executables:
|
@@ -67,8 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
requirements: []
|
70
|
-
|
71
|
-
rubygems_version: 2.6.8
|
56
|
+
rubygems_version: 3.0.1
|
72
57
|
signing_key:
|
73
58
|
specification_version: 4
|
74
59
|
summary: ruby-macho-utils - Command line utils for ruby-macho.
|