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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35509386f8425f29ea466dbcb1ce12cf54be230f9b4668d4ad2f5ac9b4a4b1b5
4
- data.tar.gz: 6f3f87d116877fd058a9f479de6b0aa789d74c255f832f5db132446e6250b82e
3
+ metadata.gz: 91afee9fd86b49fa4f788f4316df7c689178c6fdfbc0cf3f4743ae5cb7713dde
4
+ data.tar.gz: 056f2a2416a1a68ca2f2dcbbc404e9f6c768a5e8a742d942f04177c7044f5ff9
5
5
  SHA512:
6
- metadata.gz: b62671980b8d9e7a854523e24311af90e78b807023b65aa1d417159717c3119c34beef4e589638d3fa3708820c8732a1c82859f8b2194477a90548dfd0611b0a
7
- data.tar.gz: dc22e6f681b64658bacd6206c3cb7bdceb4afac7fac9332af230563930d8df24da1b95336647c25f7f84537c7716804d5d27e7409baa08b30e5f436e3a505c16
6
+ metadata.gz: 2294ae1a6e8d220c46bd21e4c1062783f2ce7b94ad5b5dffdfe8c62edd6e519a57b326913339f090f62bf955d3103a6bf665227865bceb9f45bb7c78478b04f0
7
+ data.tar.gz: ec84bbc24190227bedd91818bdefad90cb1472e1b7ca1db312aca651843315ab037e7b70f2322085eca70bf3ab0319af3af20270da2a006437f76cf4a4ca3f11
data/.rubocop.yml CHANGED
@@ -31,6 +31,8 @@ Layout/LineLength:
31
31
  Max: 100
32
32
  Exclude:
33
33
  - 'lib/app_info/helper/signatures.rb'
34
+ - 'lib/app_info/android/signatures/info.rb'
35
+ - 'lib/app_info/apk.rb'
34
36
 
35
37
  Lint/AssignmentInCondition:
36
38
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -9,21 +9,30 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9
9
 
10
10
  > List all changes before release a new version.
11
11
 
12
- ## [3.0.0.beta1] (2023-04-?)
12
+ ## [3.0.0.beta2] (2023-04-04)
13
+
14
+ ### Changed
15
+
16
+ - Re-organize categories `.platform`, `.opera_sytem` and `.device` for all parsers. [#58](https://github.com/icyleaf/app_info/pull/58)
17
+ - Change ExportType values type to symbol both IPA and macOS parsers. [#58](https://github.com/icyleaf/app_info/pull/58)
18
+
19
+ ## [3.0.0.beta1] (2023-04-04)
13
20
 
14
21
  ### Added
15
22
 
16
23
  - New Windows PE format parser. [#47](https://github.com/icyleaf/app_info/pull/47)
17
24
  - Android parser add v2, v3 scheme signature support. [#55](https://github.com/icyleaf/app_info/pull/55]
18
25
  - dSYM parer accept multi dSYM target in a zip file. [#56](https://github.com/icyleaf/app_info/pull/56)
26
+ - Better document for yardoc.
19
27
 
20
28
  ### Changed
21
29
 
22
30
  - Add `AppInfo::File` base class for all parsers.
23
31
  - Add `AppInfo::Certifiate` X509 certificate wrapped and apply in Android/MobileProvision.
24
- - Remove `AppInfo::MobileProvision::DeveloperCertificate` class, use `AppInfo::Certifiate` instead.
25
32
  - Remove `.sign_version` method in Android parser.
33
+ - Rename `.file_type` to `.format` method in all parers and return a `AppInfo::Format` type.
26
34
  - Remove duplice `AppInfo::AndroidDevice` class.
35
+ - Remove `AppInfo::MobileProvision::DeveloperCertificate` class, use `AppInfo::Certifiate` instead.
27
36
  - Deprecate `.signs` and `.certifiates` methods in Android parser, use `.signatures` instead.
28
37
  - Deprecate `.developer_certs` method in MobileProvision parser, use `.certificates` instead.
29
38
 
@@ -269,7 +278,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
269
278
 
270
279
  - Updated dependency of CFPropertly list be a range between 2.3.4. (thanks @[cschroed](https://github.com/cschroed))
271
280
 
272
- [Unreleased]: https://github.com/icyleaf/app-info/compare/v2.8.5..HEAD
281
+ [Unreleased]: https://github.com/icyleaf/app-info/compare/v3.0.0.beta2..HEAD
282
+ [3.0.0.beta2]: https://github.com/icyleaf/app-info/compare/v3.0.0.beta1...v3.0.0.beta2
283
+ [3.0.0.beta1]: https://github.com/icyleaf/app-info/compare/v2.8.5...v3.0.0.beta1
273
284
  [2.8.5]: https://github.com/icyleaf/app-info/compare/v2.8.4...v2.8.5
274
285
  [2.8.4]: https://github.com/icyleaf/app-info/compare/v2.8.3...v2.8.4
275
286
  [2.8.3]: https://github.com/icyleaf/app-info/compare/v2.8.2...v2.8.3
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # app_info
1
+ # app-info
2
2
 
3
- [![Language](https://img.shields.io/badge/ruby-2.5+-701516.svg)](.github/workflows/ci.yml)
3
+ [![Language](https://img.shields.io/badge/ruby-2.5+-701516)](.github/workflows/ci.yml)
4
+ [![Gem version](https://img.shields.io/gem/v/app-info?include_prereleases)](https://rubygems.org/gems/app-info)
4
5
  [![Build Status](https://img.shields.io/github/actions/workflow/status/icyleaf/app_info/ci.yml)](https://github.com/icyleaf/app_info/actions/workflows/ci.yml)
5
- [![Gem version](https://img.shields.io/gem/v/app-info.svg?style=flat)](https://rubygems.org/gems/app_info)
6
- [![License](https://img.shields.io/badge/license-MIT-red.svg?style=flat)](LICENSE)
6
+ [![License](https://img.shields.io/github/license/icyleaf/app-info)](LICENSE)
7
7
 
8
8
  Teardown tool for mobile app (ipa, apk and aab file), macOS app, dSYM.zip file and Windows PE file.
9
9
  Analysis metedata like version, name, icon etc.
data/lib/app_info/aab.rb CHANGED
@@ -1,53 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'app_info/protobuf/manifest'
4
- require 'image_size'
5
- require 'forwardable'
6
4
 
7
5
  module AppInfo
8
6
  # Parse APK file parser
9
- class AAB < File
10
- include Helper::HumanFileSize
11
- extend Forwardable
12
-
13
- attr_reader :file
14
-
15
- # APK Devices
16
- module Device
17
- PHONE = 'Phone'
18
- TABLET = 'Tablet'
19
- WATCH = 'Watch'
20
- TV = 'Television'
21
- AUTOMOTIVE = 'Automotive'
22
- end
23
-
7
+ class AAB < Android
24
8
  BASE_PATH = 'base'
25
9
  BASE_MANIFEST = "#{BASE_PATH}/manifest/AndroidManifest.xml"
26
10
  BASE_RESOURCES = "#{BASE_PATH}/resources.pb"
27
11
 
28
- # return file size
29
- # @example Read file size in integer
30
- # aab.size # => 3618865
31
- #
32
- # @example Read file size in human readabale
33
- # aab.size(human_size: true) # => '3.45 MB'
34
- #
35
- # @param [Boolean] human_size Convert integer value to human readable.
36
- # @return [Integer, String]
37
- def size(human_size: false)
38
- file_to_human_size(@file, human_size: human_size)
39
- end
40
-
41
- # @return [Symbol] {Format::AAB}
42
- def file_type
43
- Format::AAB
44
- end
45
-
46
- # @return [String] {Platform::ANDROID}
47
- def platform
48
- Platform::ANDROID
49
- end
50
-
12
+ # @!method version_name
13
+ # @see Protobuf::Manifest#version_name
14
+ # @return [String]
15
+ # @!method deep_links
16
+ # @see Protobuf::Manifest#deep_links
17
+ # @return [String]
18
+ # @!method schemes
19
+ # @see Protobuf::Manifest#schemes
20
+ # @return [String]
51
21
  def_delegators :manifest, :version_name, :deep_links, :schemes
52
22
 
53
23
  alias release_version version_name
@@ -70,43 +40,6 @@ module AppInfo
70
40
  manifest.label
71
41
  end
72
42
 
73
- # @return [String] {Device}
74
- def device_type
75
- if wear?
76
- Device::WATCH
77
- elsif tv?
78
- Device::TV
79
- elsif automotive?
80
- Device::AUTOMOTIVE
81
- else
82
- Device::PHONE
83
- end
84
- end
85
-
86
- # TODO: find a way to detect
87
- # Found answer but not works: https://stackoverflow.com/questions/9279111/determine-if-the-device-is-a-smartphone-or-tablet
88
- # def tablet?
89
- # resource.first_package
90
- # .entries('bool')
91
- # .select{|e| e.name == 'isTablet' }
92
- # .size >= 1
93
- # end
94
-
95
- # @return [Boolean]
96
- def wear?
97
- !!use_features&.include?('android.hardware.type.watch')
98
- end
99
-
100
- # @return [Boolean]
101
- def tv?
102
- !!use_features&.include?('android.software.leanback')
103
- end
104
-
105
- # @return [Boolean]
106
- def automotive?
107
- !!use_features&.include?('android.hardware.type.automotive')
108
- end
109
-
110
43
  # @return [String]
111
44
  def min_sdk_version
112
45
  manifest.uses_sdk.min_sdk_version
@@ -132,39 +65,21 @@ module AppInfo
132
65
  @use_permissions ||= manifest&.uses_permission&.map(&:name)
133
66
  end
134
67
 
68
+ # @return [Protobuf::Node]
135
69
  def activities
136
70
  @activities ||= manifest.activities
137
71
  end
138
72
 
73
+ # @return [Protobuf::Node]
139
74
  def services
140
75
  @services ||= manifest.services
141
76
  end
142
77
 
78
+ # @return [Protobuf::Node]
143
79
  def components
144
80
  @components ||= manifest.components.transform_values
145
81
  end
146
82
 
147
- # Return multi version certifiates of signatures
148
- # @return [Array<Hash>] signatures
149
- # @see AppInfo::Android::Signature.verify
150
- def signatures
151
- @signatures ||= Android::Signature.verify(self)
152
- end
153
-
154
- # Legacy v1 scheme signatures, it will remove soon.
155
- # @deprecated Use {#signatures}
156
- # @return [Array<OpenSSL::PKCS7, nil>] signatures
157
- def signs
158
- @signs ||= v1sign&.signatures || []
159
- end
160
-
161
- # Legacy v1 scheme certificates, it will remove soon.
162
- # @deprecated Use {#signatures}
163
- # @return [Array<OpenSSL::PKCS7, nil>] certificates
164
- def certificates
165
- @certificates ||= v1sign&.certificates || []
166
- end
167
-
168
83
  def each_file
169
84
  zip.each do |entry|
170
85
  next unless entry.file?
@@ -187,6 +102,7 @@ module AppInfo
187
102
  entry
188
103
  end
189
104
 
105
+ # @return [Protobuf::Manifest]
190
106
  def manifest
191
107
  io = zip.read(zip.find_entry(BASE_MANIFEST))
192
108
  @manifest ||= Protobuf::Manifest.parse(io, resource)
@@ -198,12 +114,22 @@ module AppInfo
198
114
  @resource ||= Protobuf::Resources.parse(io)
199
115
  end
200
116
 
201
- # @return [Zip::File]
202
- def zip
203
- @zip ||= Zip::File.open(@file)
204
- end
205
-
206
- # @return [Array<Hash>]
117
+ # Full icons metadata
118
+ # @example
119
+ # aab.icons
120
+ # # => [
121
+ # # {
122
+ # # name: 'icon.png',
123
+ # # file: '/path/to/icon.png',
124
+ # # dimensions: [29, 29]
125
+ # # },
126
+ # # {
127
+ # # name: 'icon1.png',
128
+ # # file: '/path/to/icon1.png',
129
+ # # dimensions: [120, 120]
130
+ # # }
131
+ # # ]
132
+ # @return [Array<Hash{Symbol => String, Array<Integer>}>] icons paths of icons
207
133
  def icons
208
134
  @icons ||= manifest.icons.each_with_object([]) do |res, obj|
209
135
  path = res.value
@@ -235,18 +161,13 @@ module AppInfo
235
161
  @info = nil
236
162
  end
237
163
 
238
- def contents
239
- @contents ||= ::File.join(Dir.mktmpdir, "AppInfo-android-#{SecureRandom.hex}")
164
+ # @return [Zip::File]
165
+ def zip
166
+ @zip ||= Zip::File.open(@file)
240
167
  end
241
168
 
242
169
  private
243
170
 
244
- def v1sign
245
- @v1sign ||= Android::Signature::V1.verify(self)
246
- rescue Android::Signature::NotFoundError
247
- nil
248
- end
249
-
250
171
  def xml_file?(file)
251
172
  ::File.extname(file) == '.xml'
252
173
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppInfo
4
- module Android
4
+ class Android < File
5
5
  # Android Signature
6
6
  #
7
7
  # Support digest and length:
@@ -15,10 +15,10 @@ module AppInfo
15
15
  class NotFoundError < NotFoundError; end
16
16
 
17
17
  module Version
18
- V1 = 1
19
- V2 = 2
20
- V3 = 3
21
- V4 = 4
18
+ V1 = 1
19
+ V2 = 2
20
+ V3 = 3
21
+ V4 = 4
22
22
  end
23
23
 
24
24
  # All registerd verions to verify
@@ -2,43 +2,47 @@
2
2
 
3
3
  require 'app_info/android/signatures/info'
4
4
 
5
- module AppInfo::Android::Signature
6
- class Base
7
- def self.verify(parser)
8
- instance = new(parser)
9
- instance.verify
10
- instance
11
- end
12
-
13
- DESCRIPTION = 'APK Signature Scheme'
14
-
15
- attr_reader :verified
16
-
17
- def initialize(parser)
18
- @parser = parser
19
- @verified = false
20
- end
21
-
22
- # @abstract Subclass and override {#verify} to implement
23
- def verify
24
- raise NotImplementedError, ".#{__method__} method implantation required in #{self.class}"
25
- end
26
-
27
- # @abstract Subclass and override {#certificates} to implement
28
- def certificates
29
- raise NotImplementedError, ".#{__method__} method implantation required in #{self.class}"
30
- end
31
-
32
- def scheme
33
- "v#{version}"
34
- end
35
-
36
- def description
37
- "#{DESCRIPTION} #{scheme}"
38
- end
39
-
40
- def logger
41
- @parser.logger
5
+ module AppInfo
6
+ class Android < File
7
+ module Signature
8
+ class Base
9
+ def self.verify(parser)
10
+ instance = new(parser)
11
+ instance.verify
12
+ instance
13
+ end
14
+
15
+ DESCRIPTION = 'APK Signature Scheme'
16
+
17
+ attr_reader :verified
18
+
19
+ def initialize(parser)
20
+ @parser = parser
21
+ @verified = false
22
+ end
23
+
24
+ # @abstract Subclass and override {#verify} to implement
25
+ def verify
26
+ raise NotImplementedError, ".#{__method__} method implantation required in #{self.class}"
27
+ end
28
+
29
+ # @abstract Subclass and override {#certificates} to implement
30
+ def certificates
31
+ raise NotImplementedError, ".#{__method__} method implantation required in #{self.class}"
32
+ end
33
+
34
+ def scheme
35
+ "v#{version}"
36
+ end
37
+
38
+ def description
39
+ "#{DESCRIPTION} #{scheme}"
40
+ end
41
+
42
+ def logger
43
+ @parser.logger
44
+ end
45
+ end
42
46
  end
43
47
  end
44
48
  end