app-info 2.8.5 → 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/.github/dependabot.yml +12 -7
- data/.github/workflows/ci.yml +3 -1
- data/.rubocop.yml +33 -11
- data/CHANGELOG.md +34 -1
- data/Gemfile +7 -1
- data/README.md +68 -13
- data/Rakefile +11 -0
- data/app_info.gemspec +12 -3
- data/lib/app_info/aab.rb +48 -108
- data/lib/app_info/android/signature.rb +114 -0
- data/lib/app_info/android/signatures/base.rb +53 -0
- data/lib/app_info/android/signatures/info.rb +158 -0
- data/lib/app_info/android/signatures/v1.rb +63 -0
- data/lib/app_info/android/signatures/v2.rb +121 -0
- data/lib/app_info/android/signatures/v3.rb +131 -0
- data/lib/app_info/android/signatures/v4.rb +18 -0
- data/lib/app_info/android.rb +162 -0
- data/lib/app_info/apk.rb +54 -111
- data/lib/app_info/apple.rb +192 -0
- data/lib/app_info/certificate.rb +175 -0
- data/lib/app_info/const.rb +75 -0
- data/lib/app_info/core_ext/object/try.rb +3 -1
- data/lib/app_info/core_ext/string/inflector.rb +2 -0
- data/lib/app_info/dsym/debug_info.rb +72 -0
- data/lib/app_info/dsym/macho.rb +55 -0
- data/lib/app_info/dsym.rb +31 -135
- data/lib/app_info/error.rb +2 -2
- data/lib/app_info/file.rb +49 -0
- data/lib/app_info/helper/archive.rb +37 -0
- data/lib/app_info/helper/file_size.rb +25 -0
- data/lib/app_info/helper/generate_class.rb +29 -0
- data/lib/app_info/helper/protobuf.rb +12 -0
- data/lib/app_info/helper/signatures.rb +229 -0
- data/lib/app_info/helper.rb +5 -126
- data/lib/app_info/info_plist.rb +66 -29
- data/lib/app_info/ipa/framework.rb +4 -4
- data/lib/app_info/ipa.rb +61 -135
- data/lib/app_info/macos.rb +54 -102
- data/lib/app_info/mobile_provision.rb +67 -49
- data/lib/app_info/pe.rb +260 -0
- data/lib/app_info/png_uncrush.rb +24 -4
- data/lib/app_info/proguard.rb +29 -16
- data/lib/app_info/protobuf/manifest.rb +6 -3
- data/lib/app_info/protobuf/models/Configuration_pb.rb +1 -0
- data/lib/app_info/protobuf/models/README.md +7 -0
- data/lib/app_info/protobuf/models/Resources_pb.rb +2 -0
- data/lib/app_info/protobuf/resources.rb +5 -5
- data/lib/app_info/version.rb +1 -1
- data/lib/app_info.rb +90 -46
- metadata +48 -35
@@ -6,8 +6,9 @@ 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
|
-
include Helper::
|
11
|
+
include Helper::GenerateClass
|
11
12
|
|
12
13
|
def initialize(doc, resources = nil)
|
13
14
|
@resources = resources
|
@@ -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
|
|
@@ -222,7 +226,6 @@ module AppInfo
|
|
222
226
|
|
223
227
|
type ||= name.split('.')[2]
|
224
228
|
raise ProtobufParseError, 'Not found intent type' unless TYPES.include?(type)
|
225
|
-
|
226
229
|
return false unless intent = send(type.to_sym)
|
227
230
|
|
228
231
|
values = intent.select { |e| e.name == name }
|
@@ -9,6 +9,13 @@ protoc --ruby_out=. Resources.proto
|
|
9
9
|
protoc --ruby_out=. Configuration.proto
|
10
10
|
```
|
11
11
|
|
12
|
+
## Decode
|
13
|
+
|
14
|
+
```bash
|
15
|
+
protoc --decode=aapt.pb.ResourceTable Resources.proto < aab/base/BundleConfig.pb > BundleConfig.txt
|
16
|
+
protoc --decode=aapt.pb.ResourceTable Resources.proto < aab/base/native.pb > native.txt
|
17
|
+
```
|
18
|
+
|
12
19
|
## Resouces
|
13
20
|
|
14
21
|
`Configuration.proto` and `Resources.proto` can be found in aapt2's github:
|
@@ -322,7 +322,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
322
322
|
end
|
323
323
|
end
|
324
324
|
|
325
|
+
# @!visibility private
|
325
326
|
module Aapt
|
327
|
+
|
326
328
|
module Pb
|
327
329
|
StringPool = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("aapt.pb.StringPool").msgclass
|
328
330
|
SourcePosition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("aapt.pb.SourcePosition").msgclass
|
@@ -12,7 +12,7 @@ module AppInfo
|
|
12
12
|
new(doc)
|
13
13
|
end
|
14
14
|
|
15
|
-
include Helper::
|
15
|
+
include Helper::Protobuf
|
16
16
|
|
17
17
|
attr_reader :packages, :tool_fingerprint
|
18
18
|
|
@@ -53,7 +53,7 @@ module AppInfo
|
|
53
53
|
end
|
54
54
|
|
55
55
|
class Package
|
56
|
-
include Helper::
|
56
|
+
include Helper::GenerateClass
|
57
57
|
|
58
58
|
attr_reader :name, :types
|
59
59
|
|
@@ -113,14 +113,14 @@ module AppInfo
|
|
113
113
|
end
|
114
114
|
|
115
115
|
class Entry
|
116
|
+
include Helper::GenerateClass
|
117
|
+
|
116
118
|
def self.parse_from(type, package)
|
117
119
|
type.entry.each_with_object([]) do |entry, obj|
|
118
120
|
obj << Entry.new(entry, package)
|
119
121
|
end
|
120
122
|
end
|
121
123
|
|
122
|
-
include Helper::Defines
|
123
|
-
|
124
124
|
attr_reader :name, :values
|
125
125
|
|
126
126
|
def initialize(doc, package)
|
@@ -155,7 +155,7 @@ module AppInfo
|
|
155
155
|
end
|
156
156
|
|
157
157
|
class Value
|
158
|
-
include Helper::
|
158
|
+
include Helper::Protobuf
|
159
159
|
extend Forwardable
|
160
160
|
|
161
161
|
attr_reader :locale, :config, :original_value, :value, :type
|
data/lib/app_info/version.rb
CHANGED
data/lib/app_info.rb
CHANGED
@@ -1,24 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'app_info/version'
|
4
|
-
require 'app_info/error'
|
5
4
|
require 'app_info/core_ext'
|
5
|
+
require 'app_info/const'
|
6
|
+
require 'app_info/certificate'
|
6
7
|
require 'app_info/helper'
|
8
|
+
require 'app_info/error'
|
7
9
|
|
10
|
+
require 'app_info/file'
|
8
11
|
require 'app_info/info_plist'
|
9
12
|
require 'app_info/mobile_provision'
|
10
13
|
|
14
|
+
require 'app_info/apple'
|
15
|
+
require 'app_info/macos'
|
11
16
|
require 'app_info/ipa'
|
12
17
|
require 'app_info/ipa/plugin'
|
13
18
|
require 'app_info/ipa/framework'
|
14
19
|
|
20
|
+
require 'app_info/android'
|
15
21
|
require 'app_info/apk'
|
16
22
|
require 'app_info/aab'
|
17
23
|
|
18
24
|
require 'app_info/proguard'
|
19
25
|
require 'app_info/dsym'
|
20
26
|
|
21
|
-
require 'app_info/
|
27
|
+
require 'app_info/pe'
|
22
28
|
|
23
29
|
# fix invaild date format warnings
|
24
30
|
Zip.warn_invalid_date = false
|
@@ -26,44 +32,58 @@ Zip.warn_invalid_date = false
|
|
26
32
|
# AppInfo Module
|
27
33
|
module AppInfo
|
28
34
|
class << self
|
29
|
-
UNKNOWN_FORMAT = :unkown
|
30
|
-
|
31
35
|
# Get a new parser for automatic
|
32
36
|
def parse(file)
|
33
|
-
raise NotFoundError, file unless File.exist?(file)
|
34
|
-
|
35
|
-
case file_type(file)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
37
|
+
raise NotFoundError, file unless ::File.exist?(file)
|
38
|
+
|
39
|
+
parser = case file_type(file)
|
40
|
+
when Format::IPA then IPA.new(file)
|
41
|
+
when Format::APK then APK.new(file)
|
42
|
+
when Format::AAB then AAB.new(file)
|
43
|
+
when Format::MOBILEPROVISION then MobileProvision.new(file)
|
44
|
+
when Format::DSYM then DSYM.new(file)
|
45
|
+
when Format::PROGUARD then Proguard.new(file)
|
46
|
+
when Format::MACOS then Macos.new(file)
|
47
|
+
when Format::PE then PE.new(file)
|
48
|
+
else
|
49
|
+
raise UnknownFormatError, "Do not detect file format: #{file}"
|
50
|
+
end
|
51
|
+
|
52
|
+
return parser unless block_given?
|
53
|
+
|
54
|
+
# call block and clear!
|
55
|
+
yield parser
|
56
|
+
parser.clear!
|
46
57
|
end
|
47
58
|
alias dump parse
|
48
59
|
|
49
60
|
def parse?(file)
|
50
|
-
file_type(file) !=
|
61
|
+
file_type(file) != Format::UNKNOWN
|
51
62
|
end
|
52
63
|
|
53
64
|
# Detect file type by read file header
|
54
65
|
#
|
55
66
|
# TODO: This can be better solution, if anyone knows, tell me please.
|
56
67
|
def file_type(file)
|
57
|
-
header_hex = File.read(file, 100)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
68
|
+
header_hex = ::File.read(file, 100)
|
69
|
+
case header_hex
|
70
|
+
when ZIP_RETGEX
|
71
|
+
detect_zip_file(file)
|
72
|
+
when PE_REGEX
|
73
|
+
Format::PE
|
74
|
+
when PLIST_REGEX, BPLIST_REGEX
|
75
|
+
Format::MOBILEPROVISION
|
76
|
+
else
|
77
|
+
Format::UNKNOWN
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def logger
|
82
|
+
@logger ||= Logger.new($stdout, level: :warn)
|
65
83
|
end
|
66
84
|
|
85
|
+
attr_writer :logger
|
86
|
+
|
67
87
|
private
|
68
88
|
|
69
89
|
# :nodoc:
|
@@ -71,35 +91,59 @@ module AppInfo
|
|
71
91
|
Zip.warn_invalid_date = false
|
72
92
|
zip_file = Zip::File.open(file)
|
73
93
|
|
74
|
-
return
|
75
|
-
return
|
76
|
-
|
94
|
+
return Format::PROGUARD if proguard_clues?(zip_file)
|
95
|
+
return Format::APK if apk_clues?(zip_file)
|
96
|
+
return Format::AAB if aab_clues?(zip_file)
|
97
|
+
return Format::MACOS if macos_clues?(zip_file)
|
98
|
+
return Format::PE if pe_clues?(zip_file)
|
99
|
+
return Format::UNKNOWN unless clue = other_clues?(zip_file)
|
77
100
|
|
78
|
-
|
79
|
-
|
101
|
+
clue
|
102
|
+
ensure
|
103
|
+
zip_file.close
|
104
|
+
end
|
105
|
+
|
106
|
+
# :nodoc:
|
107
|
+
def proguard_clues?(zip_file)
|
108
|
+
!zip_file.glob('*mapping*.txt').empty?
|
109
|
+
end
|
80
110
|
|
81
|
-
|
82
|
-
|
111
|
+
# :nodoc:
|
112
|
+
def apk_clues?(zip_file)
|
113
|
+
!zip_file.find_entry('AndroidManifest.xml').nil? &&
|
114
|
+
!zip_file.find_entry('classes.dex').nil?
|
115
|
+
end
|
83
116
|
|
84
|
-
|
85
|
-
|
117
|
+
# :nodoc:
|
118
|
+
def aab_clues?(zip_file)
|
119
|
+
!zip_file.find_entry('base/manifest/AndroidManifest.xml').nil? &&
|
120
|
+
!zip_file.find_entry('BundleConfig.pb').nil?
|
121
|
+
end
|
86
122
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
zip_file.close
|
123
|
+
# :nodoc:
|
124
|
+
def macos_clues?(zip_file)
|
125
|
+
!zip_file.glob('*/Contents/MacOS/*').empty? &&
|
126
|
+
!zip_file.glob('*/Contents/Info.plist').empty?
|
92
127
|
end
|
93
128
|
|
94
|
-
|
95
|
-
|
129
|
+
# :nodoc:
|
130
|
+
def pe_clues?(zip_file)
|
131
|
+
!zip_file.glob('*.exe').empty?
|
132
|
+
end
|
96
133
|
|
97
134
|
# :nodoc:
|
98
|
-
def
|
99
|
-
|
100
|
-
|
101
|
-
|
135
|
+
def other_clues?(zip_file)
|
136
|
+
zip_file.each do |f|
|
137
|
+
path = f.name
|
138
|
+
|
139
|
+
return Format::IPA if path.include?('Payload/') && path.end_with?('Info.plist')
|
140
|
+
return Format::DSYM if path.include?('Contents/Resources/DWARF/')
|
102
141
|
end
|
103
142
|
end
|
104
143
|
end
|
144
|
+
|
145
|
+
ZIP_RETGEX = /^\x50\x4b\x03\x04/.freeze
|
146
|
+
PE_REGEX = /^MZ/.freeze
|
147
|
+
PLIST_REGEX = /\x3C\x3F\x78\x6D\x6C/.freeze
|
148
|
+
BPLIST_REGEX = /^\x62\x70\x6C\x69\x73\x74/.freeze
|
105
149
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app-info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icyleaf
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: CFPropertyList
|
@@ -76,14 +76,14 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - "~>"
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 2.
|
79
|
+
version: 2.6.0
|
80
80
|
type: :runtime
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
84
|
- - "~>"
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: 2.
|
86
|
+
version: 2.6.0
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: rubyzip
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,6 +138,20 @@ dependencies:
|
|
138
138
|
- - "~>"
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: 0.2.0
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: pedump
|
143
|
+
requirement: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - "~>"
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: 0.6.2
|
148
|
+
type: :runtime
|
149
|
+
prerelease: false
|
150
|
+
version_requirements: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - "~>"
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: 0.6.2
|
141
155
|
- !ruby/object:Gem::Dependency
|
142
156
|
name: google-protobuf
|
143
157
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,34 +200,6 @@ dependencies:
|
|
186
200
|
- - ">="
|
187
201
|
- !ruby/object:Gem::Version
|
188
202
|
version: '10.0'
|
189
|
-
- !ruby/object:Gem::Dependency
|
190
|
-
name: rspec
|
191
|
-
requirement: !ruby/object:Gem::Requirement
|
192
|
-
requirements:
|
193
|
-
- - "~>"
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: '3.0'
|
196
|
-
type: :development
|
197
|
-
prerelease: false
|
198
|
-
version_requirements: !ruby/object:Gem::Requirement
|
199
|
-
requirements:
|
200
|
-
- - "~>"
|
201
|
-
- !ruby/object:Gem::Version
|
202
|
-
version: '3.0'
|
203
|
-
- !ruby/object:Gem::Dependency
|
204
|
-
name: rubocop
|
205
|
-
requirement: !ruby/object:Gem::Requirement
|
206
|
-
requirements:
|
207
|
-
- - "~>"
|
208
|
-
- !ruby/object:Gem::Version
|
209
|
-
version: '1.19'
|
210
|
-
type: :development
|
211
|
-
prerelease: false
|
212
|
-
version_requirements: !ruby/object:Gem::Requirement
|
213
|
-
requirements:
|
214
|
-
- - "~>"
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
version: '1.19'
|
217
203
|
description: Teardown tool for ipa/apk files and dSYM file, even support for info.plist
|
218
204
|
and .mobileprovision files
|
219
205
|
email:
|
@@ -240,19 +226,39 @@ files:
|
|
240
226
|
- lib/app-info.rb
|
241
227
|
- lib/app_info.rb
|
242
228
|
- lib/app_info/aab.rb
|
229
|
+
- lib/app_info/android.rb
|
230
|
+
- lib/app_info/android/signature.rb
|
231
|
+
- lib/app_info/android/signatures/base.rb
|
232
|
+
- lib/app_info/android/signatures/info.rb
|
233
|
+
- lib/app_info/android/signatures/v1.rb
|
234
|
+
- lib/app_info/android/signatures/v2.rb
|
235
|
+
- lib/app_info/android/signatures/v3.rb
|
236
|
+
- lib/app_info/android/signatures/v4.rb
|
243
237
|
- lib/app_info/apk.rb
|
238
|
+
- lib/app_info/apple.rb
|
239
|
+
- lib/app_info/certificate.rb
|
240
|
+
- lib/app_info/const.rb
|
244
241
|
- lib/app_info/core_ext.rb
|
245
242
|
- lib/app_info/core_ext/object/try.rb
|
246
243
|
- lib/app_info/core_ext/string/inflector.rb
|
247
244
|
- lib/app_info/dsym.rb
|
245
|
+
- lib/app_info/dsym/debug_info.rb
|
246
|
+
- lib/app_info/dsym/macho.rb
|
248
247
|
- lib/app_info/error.rb
|
248
|
+
- lib/app_info/file.rb
|
249
249
|
- lib/app_info/helper.rb
|
250
|
+
- lib/app_info/helper/archive.rb
|
251
|
+
- lib/app_info/helper/file_size.rb
|
252
|
+
- lib/app_info/helper/generate_class.rb
|
253
|
+
- lib/app_info/helper/protobuf.rb
|
254
|
+
- lib/app_info/helper/signatures.rb
|
250
255
|
- lib/app_info/info_plist.rb
|
251
256
|
- lib/app_info/ipa.rb
|
252
257
|
- lib/app_info/ipa/framework.rb
|
253
258
|
- lib/app_info/ipa/plugin.rb
|
254
259
|
- lib/app_info/macos.rb
|
255
260
|
- lib/app_info/mobile_provision.rb
|
261
|
+
- lib/app_info/pe.rb
|
256
262
|
- lib/app_info/png_uncrush.rb
|
257
263
|
- lib/app_info/proguard.rb
|
258
264
|
- lib/app_info/protobuf/manifest.rb
|
@@ -268,7 +274,14 @@ homepage: http://github.com/icyleaf/app-info
|
|
268
274
|
licenses:
|
269
275
|
- MIT
|
270
276
|
metadata: {}
|
271
|
-
post_install_message:
|
277
|
+
post_install_message: |
|
278
|
+
AppInfo 3.0 is coming!
|
279
|
+
**********************
|
280
|
+
The public API of some AppInfo classes has been changed.
|
281
|
+
|
282
|
+
Please ensure that your Gemfiles and .gemspecs are suitably restrictive
|
283
|
+
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.8.5).
|
284
|
+
See https://github.com/icyleaf/app_info for details.
|
272
285
|
rdoc_options: []
|
273
286
|
require_paths:
|
274
287
|
- lib
|
@@ -279,9 +292,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
279
292
|
version: '2.5'
|
280
293
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
281
294
|
requirements:
|
282
|
-
- - "
|
295
|
+
- - ">"
|
283
296
|
- !ruby/object:Gem::Version
|
284
|
-
version:
|
297
|
+
version: 1.3.1
|
285
298
|
requirements: []
|
286
299
|
rubygems_version: 3.4.1
|
287
300
|
signing_key:
|