app-info 3.0.0.beta1 → 3.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +14 -3
- data/README.md +4 -4
- data/lib/app_info/aab.rb +33 -112
- data/lib/app_info/android/signature.rb +5 -5
- data/lib/app_info/android/signatures/base.rb +41 -37
- data/lib/app_info/android/signatures/info.rb +135 -129
- data/lib/app_info/android/signatures/v1.rb +56 -52
- data/lib/app_info/android/signatures/v2.rb +114 -110
- data/lib/app_info/android/signatures/v3.rb +124 -120
- data/lib/app_info/android/signatures/v4.rb +13 -9
- data/lib/app_info/android.rb +162 -0
- data/lib/app_info/apk.rb +45 -99
- data/lib/app_info/apple.rb +192 -0
- data/lib/app_info/certificate.rb +11 -17
- data/lib/app_info/const.rb +47 -13
- data/lib/app_info/dsym.rb +6 -3
- data/lib/app_info/error.rb +1 -7
- data/lib/app_info/file.rb +30 -4
- data/lib/app_info/helper/file_size.rb +1 -1
- data/lib/app_info/info_plist.rb +54 -25
- data/lib/app_info/ipa.rb +39 -118
- data/lib/app_info/macos.rb +38 -94
- data/lib/app_info/mobile_provision.rb +50 -21
- data/lib/app_info/pe.rb +39 -5
- data/lib/app_info/png_uncrush.rb +19 -0
- data/lib/app_info/proguard.rb +21 -2
- data/lib/app_info/protobuf/manifest.rb +5 -1
- data/lib/app_info/version.rb +1 -1
- data/lib/app_info.rb +4 -3
- metadata +3 -1
data/lib/app_info/pe.rb
CHANGED
@@ -24,14 +24,21 @@ module AppInfo
|
|
24
24
|
0x5128 => 'RISC-v 128'
|
25
25
|
}.freeze
|
26
26
|
|
27
|
-
|
28
|
-
Format::PE
|
29
|
-
end
|
30
|
-
|
27
|
+
# @return [Symbol] {Platform}
|
31
28
|
def platform
|
32
29
|
Platform::WINDOWS
|
33
30
|
end
|
34
31
|
|
32
|
+
# @return [Symbol] {OperaSystem}
|
33
|
+
def opera_system
|
34
|
+
OperaSystem::WINDOWS
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [Symbol] {Device}
|
38
|
+
def device
|
39
|
+
Device::WINDOWS
|
40
|
+
end
|
41
|
+
|
35
42
|
# return file size
|
36
43
|
# @example Read file size in integer
|
37
44
|
# aab.size # => 3618865
|
@@ -49,23 +56,38 @@ module AppInfo
|
|
49
56
|
file_to_human_size(binary_file, human_size: human_size)
|
50
57
|
end
|
51
58
|
|
59
|
+
# @!method product_name
|
60
|
+
# @see VersionInfo#product_name
|
61
|
+
# @return [String]
|
62
|
+
# @!method product_version
|
63
|
+
# @see VersionInfo#product_version
|
64
|
+
# @return [String]
|
65
|
+
# @!method company_name
|
66
|
+
# @see VersionInfo#company_name
|
67
|
+
# @return [String]
|
68
|
+
# @!method assembly_version
|
69
|
+
# @see VersionInfo#assembly_version
|
70
|
+
# @return [String]
|
52
71
|
def_delegators :version_info, :product_name, :product_version, :company_name, :assembly_version
|
53
72
|
|
54
73
|
alias name product_name
|
55
74
|
alias release_version product_version
|
56
75
|
alias build_version assembly_version
|
57
76
|
|
77
|
+
# @return [String]
|
58
78
|
def archs
|
59
79
|
ARCH[image_file_header.Machine] || 'unknown'
|
60
80
|
end
|
61
81
|
alias architectures archs
|
62
82
|
|
83
|
+
# @return [Hash{String => String}] imports imports of libraries
|
63
84
|
def imports
|
64
85
|
@imports ||= pe.imports.each_with_object({}) do |import, obj|
|
65
86
|
obj[import.module_name] = import.first_thunk.map(&:name).compact
|
66
87
|
end
|
67
88
|
end
|
68
89
|
|
90
|
+
# @return [Array{String}] icons paths of bmp image icons
|
69
91
|
def icons
|
70
92
|
@icons ||= lambda {
|
71
93
|
# Fetch the largest size icon
|
@@ -105,6 +127,7 @@ module AppInfo
|
|
105
127
|
}.call
|
106
128
|
end
|
107
129
|
|
130
|
+
# @return [PEdump]
|
108
131
|
def pe
|
109
132
|
@pe ||= lambda {
|
110
133
|
pe = PEdump.new(io)
|
@@ -113,6 +136,7 @@ module AppInfo
|
|
113
136
|
}.call
|
114
137
|
end
|
115
138
|
|
139
|
+
# @return [VersionInfo]
|
116
140
|
def version_info
|
117
141
|
@version_info ||= VersionInfo.new(pe.version_info)
|
118
142
|
end
|
@@ -124,6 +148,7 @@ module AppInfo
|
|
124
148
|
@imports = nil
|
125
149
|
end
|
126
150
|
|
151
|
+
# @return [String] binary_file path
|
127
152
|
def binary_file
|
128
153
|
@binary_file ||= lambda {
|
129
154
|
file_io = ::File.open(@file, 'rb')
|
@@ -131,7 +156,7 @@ module AppInfo
|
|
131
156
|
|
132
157
|
zip_file = Zip::File.open(@file)
|
133
158
|
zip_entry = zip_file.glob('*.exe').first
|
134
|
-
raise
|
159
|
+
raise NotFoundError, 'Not found .exe file in archive file' if zip_entry.nil?
|
135
160
|
|
136
161
|
exe_file = tempdir(zip_entry.name, prefix: 'pe-exe', system: true)
|
137
162
|
zip_entry.extract(exe_file)
|
@@ -147,6 +172,7 @@ module AppInfo
|
|
147
172
|
@image_file_header ||= pe.pe.image_file_header
|
148
173
|
end
|
149
174
|
|
175
|
+
# @return [Hash{Symbol => String}]
|
150
176
|
def icon_metadata(file, mask_file: nil)
|
151
177
|
{
|
152
178
|
name: ::File.basename(file),
|
@@ -156,6 +182,7 @@ module AppInfo
|
|
156
182
|
}
|
157
183
|
end
|
158
184
|
|
185
|
+
# @return [File]
|
159
186
|
def io
|
160
187
|
@io ||= ::File.open(binary_file, 'rb')
|
161
188
|
end
|
@@ -168,30 +195,37 @@ module AppInfo
|
|
168
195
|
@raw = raw
|
169
196
|
end
|
170
197
|
|
198
|
+
# @return [String]
|
171
199
|
def company_name
|
172
200
|
@company_name ||= value_of('CompanyName')
|
173
201
|
end
|
174
202
|
|
203
|
+
# @return [String]
|
175
204
|
def product_name
|
176
205
|
@product_name ||= value_of('ProductName')
|
177
206
|
end
|
178
207
|
|
208
|
+
# @return [String]
|
179
209
|
def product_version
|
180
210
|
@product_version ||= value_of('ProductVersion')
|
181
211
|
end
|
182
212
|
|
213
|
+
# @return [String]
|
183
214
|
def assembly_version
|
184
215
|
@assembly_version ||= value_of('Assembly Version')
|
185
216
|
end
|
186
217
|
|
218
|
+
# @return [String]
|
187
219
|
def file_version
|
188
220
|
@file_version ||= value_of('FileVersion')
|
189
221
|
end
|
190
222
|
|
223
|
+
# @return [String]
|
191
224
|
def file_description
|
192
225
|
@file_description ||= value_of('FileDescription')
|
193
226
|
end
|
194
227
|
|
228
|
+
# @return [String]
|
195
229
|
def copyright
|
196
230
|
@copyright ||= value_of('LegalCopyright')
|
197
231
|
end
|
data/lib/app_info/png_uncrush.rb
CHANGED
@@ -32,18 +32,24 @@ module AppInfo
|
|
32
32
|
@data = String.new
|
33
33
|
end
|
34
34
|
|
35
|
+
# @return [Integer]
|
35
36
|
def size
|
36
37
|
@io.size
|
37
38
|
end
|
38
39
|
|
40
|
+
# @param [String] format
|
41
|
+
# @return [String]
|
42
|
+
# @see IO package data
|
39
43
|
def unpack(format)
|
40
44
|
@io.unpack(format)
|
41
45
|
end
|
42
46
|
|
47
|
+
# @return [String]
|
43
48
|
def header
|
44
49
|
@header ||= self[0, 8]
|
45
50
|
end
|
46
51
|
|
52
|
+
# @return [Boolean]
|
47
53
|
def png?
|
48
54
|
header.bytes == PNG_HEADER
|
49
55
|
end
|
@@ -61,10 +67,17 @@ module AppInfo
|
|
61
67
|
end
|
62
68
|
end
|
63
69
|
|
70
|
+
# Decompress crushed png file.
|
71
|
+
# @param [String] input path of png file
|
72
|
+
# @param [String] output path of output file
|
73
|
+
# @return [Boolean] result whether decompress successfully
|
64
74
|
def self.decompress(input, output)
|
65
75
|
new(input).decompress(output)
|
66
76
|
end
|
67
77
|
|
78
|
+
# get png dimensions
|
79
|
+
# @param [String] input path of png file
|
80
|
+
# @return [Array<Integer>] dimensions width, height value of png file
|
68
81
|
def self.dimensions(input)
|
69
82
|
new(input).dimensions
|
70
83
|
end
|
@@ -74,10 +87,16 @@ module AppInfo
|
|
74
87
|
raise FormatError, 'not a png file' unless @io.png?
|
75
88
|
end
|
76
89
|
|
90
|
+
# get png dimensions
|
91
|
+
# @param [String] input path of png file
|
92
|
+
# @return [Array<Integer>] dimensions width, height value of png file
|
77
93
|
def dimensions
|
78
94
|
_dump_sections(dimensions: true)
|
79
95
|
end
|
80
96
|
|
97
|
+
# Decompress crushed png file.
|
98
|
+
# @param [String] output path of output file
|
99
|
+
# @return [Boolean] result whether decompress successfully
|
81
100
|
def decompress(output)
|
82
101
|
content = _remap(_dump_sections)
|
83
102
|
return false unless content
|
data/lib/app_info/proguard.rb
CHANGED
@@ -10,41 +10,54 @@ module AppInfo
|
|
10
10
|
|
11
11
|
NAMESPACE = UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, 'icyleaf.com')
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
# @return [Symbol] {Platform}
|
14
|
+
def platform
|
15
|
+
Platform::GOOGLE
|
15
16
|
end
|
16
17
|
|
18
|
+
# @return [Symbol] {OperaSystem}
|
19
|
+
def opera_system
|
20
|
+
OperaSystem::ANDROID
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [String]
|
17
24
|
def uuid
|
18
25
|
# Similar to https://docs.sentry.io/workflow/debug-files/#proguard-uuids
|
19
26
|
UUIDTools::UUID.sha1_create(NAMESPACE, ::File.read(mapping_path)).to_s
|
20
27
|
end
|
21
28
|
alias debug_id uuid
|
22
29
|
|
30
|
+
# @return [Boolean]
|
23
31
|
def mapping?
|
24
32
|
::File.exist?(mapping_path)
|
25
33
|
end
|
26
34
|
|
35
|
+
# @return [Boolean]
|
27
36
|
def manifest?
|
28
37
|
::File.exist?(manifest_path)
|
29
38
|
end
|
30
39
|
|
40
|
+
# @return [Boolean]
|
31
41
|
def symbol?
|
32
42
|
::File.exist?(symbol_path)
|
33
43
|
end
|
34
44
|
alias resource? symbol?
|
35
45
|
|
46
|
+
# @return [String, nil]
|
36
47
|
def package_name
|
37
48
|
return unless manifest?
|
38
49
|
|
39
50
|
manifest.root.attributes['package']
|
40
51
|
end
|
41
52
|
|
53
|
+
# @return [String, nil]
|
42
54
|
def releasd_version
|
43
55
|
return unless manifest?
|
44
56
|
|
45
57
|
manifest.root.attributes['package']
|
46
58
|
end
|
47
59
|
|
60
|
+
# @return [String, nil]
|
48
61
|
def version_name
|
49
62
|
return unless manifest?
|
50
63
|
|
@@ -52,6 +65,7 @@ module AppInfo
|
|
52
65
|
end
|
53
66
|
alias release_version version_name
|
54
67
|
|
68
|
+
# @return [String, nil]
|
55
69
|
def version_code
|
56
70
|
return unless manifest?
|
57
71
|
|
@@ -59,25 +73,30 @@ module AppInfo
|
|
59
73
|
end
|
60
74
|
alias build_version version_code
|
61
75
|
|
76
|
+
# @return [REXML::Document]
|
62
77
|
def manifest
|
63
78
|
return unless manifest?
|
64
79
|
|
65
80
|
@manifest ||= REXML::Document.new(::File.new(manifest_path))
|
66
81
|
end
|
67
82
|
|
83
|
+
# @return [String]
|
68
84
|
def mapping_path
|
69
85
|
@mapping_path ||= Dir.glob(::File.join(contents, '*mapping*.txt')).first
|
70
86
|
end
|
71
87
|
|
88
|
+
# @return [String]
|
72
89
|
def manifest_path
|
73
90
|
@manifest_path ||= ::File.join(contents, 'AndroidManifest.xml')
|
74
91
|
end
|
75
92
|
|
93
|
+
# @return [String]
|
76
94
|
def symbol_path
|
77
95
|
@symbol_path ||= ::File.join(contents, 'R.txt')
|
78
96
|
end
|
79
97
|
alias resource_path symbol_path
|
80
98
|
|
99
|
+
# @return [String] contents path of contents
|
81
100
|
def contents
|
82
101
|
@contents ||= unarchive(@file, prefix: 'proguard')
|
83
102
|
end
|
@@ -6,6 +6,7 @@ require 'app_info/core_ext'
|
|
6
6
|
|
7
7
|
module AppInfo
|
8
8
|
module Protobuf
|
9
|
+
# AAB Protobuf Base class
|
9
10
|
class Base
|
10
11
|
include Helper::GenerateClass
|
11
12
|
|
@@ -21,6 +22,7 @@ module AppInfo
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
25
|
+
# AAB Protobuf Attribute
|
24
26
|
class Attribute < Base
|
25
27
|
attr_reader :namespace, :name, :value, :resource_id
|
26
28
|
|
@@ -47,6 +49,8 @@ module AppInfo
|
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
52
|
+
# AAB Protobuf Node class.
|
53
|
+
# example: manifest,activity, activity-alias, service, receiver, provider, application
|
50
54
|
class Node < Base
|
51
55
|
attr_reader :name, :attributes, :children
|
52
56
|
|
@@ -106,6 +110,7 @@ module AppInfo
|
|
106
110
|
end
|
107
111
|
end
|
108
112
|
|
113
|
+
# AAB Protobuf Manifest
|
109
114
|
class Manifest < Node
|
110
115
|
def self.parse(io, resources = nil)
|
111
116
|
doc = Aapt::Pb::XmlNode.decode(io)
|
@@ -170,7 +175,6 @@ module AppInfo
|
|
170
175
|
end.flatten.uniq
|
171
176
|
end
|
172
177
|
|
173
|
-
# :nodoc:
|
174
178
|
# Workaround ruby always return true by called `Object.const_defined?(Data)`
|
175
179
|
class Data < Node; end
|
176
180
|
|
data/lib/app_info/version.rb
CHANGED
data/lib/app_info.rb
CHANGED
@@ -11,18 +11,19 @@ require 'app_info/file'
|
|
11
11
|
require 'app_info/info_plist'
|
12
12
|
require 'app_info/mobile_provision'
|
13
13
|
|
14
|
+
require 'app_info/apple'
|
15
|
+
require 'app_info/macos'
|
14
16
|
require 'app_info/ipa'
|
15
17
|
require 'app_info/ipa/plugin'
|
16
18
|
require 'app_info/ipa/framework'
|
17
19
|
|
18
|
-
require 'app_info/android
|
20
|
+
require 'app_info/android'
|
19
21
|
require 'app_info/apk'
|
20
22
|
require 'app_info/aab'
|
21
23
|
|
22
24
|
require 'app_info/proguard'
|
23
25
|
require 'app_info/dsym'
|
24
26
|
|
25
|
-
require 'app_info/macos'
|
26
27
|
require 'app_info/pe'
|
27
28
|
|
28
29
|
# fix invaild date format warnings
|
@@ -45,7 +46,7 @@ module AppInfo
|
|
45
46
|
when Format::MACOS then Macos.new(file)
|
46
47
|
when Format::PE then PE.new(file)
|
47
48
|
else
|
48
|
-
raise
|
49
|
+
raise UnknownFormatError, "Do not detect file format: #{file}"
|
49
50
|
end
|
50
51
|
|
51
52
|
return parser unless block_given?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app-info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icyleaf
|
@@ -226,6 +226,7 @@ files:
|
|
226
226
|
- lib/app-info.rb
|
227
227
|
- lib/app_info.rb
|
228
228
|
- lib/app_info/aab.rb
|
229
|
+
- lib/app_info/android.rb
|
229
230
|
- lib/app_info/android/signature.rb
|
230
231
|
- lib/app_info/android/signatures/base.rb
|
231
232
|
- lib/app_info/android/signatures/info.rb
|
@@ -234,6 +235,7 @@ files:
|
|
234
235
|
- lib/app_info/android/signatures/v3.rb
|
235
236
|
- lib/app_info/android/signatures/v4.rb
|
236
237
|
- lib/app_info/apk.rb
|
238
|
+
- lib/app_info/apple.rb
|
237
239
|
- lib/app_info/certificate.rb
|
238
240
|
- lib/app_info/const.rb
|
239
241
|
- lib/app_info/core_ext.rb
|