android_parser 2.5.0 → 2.5.1

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: bc3206bde4ce793fb477360fd78062daa372bf5dba443d3521d86b8ffaf0a91f
4
- data.tar.gz: 15c49cc70cb8ac8c561bdb2f5d6e108c9ff6d095bf82b56996ee1c012c874b37
3
+ metadata.gz: 8360af54a4093e8cc95844b8b7419e3190aed92f5aa6c832f0fd4f7e8ccd2f53
4
+ data.tar.gz: 1b8a9172fdf2b4f18c43cb0a342aa5244f7ad109cbfc8b8995d74d6de9fc34a9
5
5
  SHA512:
6
- metadata.gz: 470a1645dc911bc2f41405ac41beb93d570a4885ab2413f61c7f413ce38477a7bc0c3da7162de40cd48b97799dcfd4eab12f1335a9c48a40e2555720f60a39b4
7
- data.tar.gz: 55b1870a03b25be087e20e75c2d32a92c15a5a2a1a7d6290970a1ce0af78b44399fe5e9957fb8f111c53d9c2c59e98648b594cf7aad8d16666ff77775a3cfb10
6
+ metadata.gz: 393956811a1cfcb6bd043cdc8c6494a1760a0558d6d12ce157ee9e08b67035499f702e15cf8d6baa7971572eb616c0de28ebc92003a4e9a32c18541eb82b7f7b
7
+ data.tar.gz: a7998f5d5e71b889c083f6b1d73f4d277bd7aecd6c412a5d4b14dc10bccf1104472dffde03c2a2280071f88c846906f15c80991d73689f2dd957a46270ac3fbf
@@ -1,9 +1,11 @@
1
1
  version: 2
2
2
  updates:
3
- - package-ecosystem: bundler
4
- directory: "/"
5
- schedule:
6
- interval: daily
7
- time: "21:00"
8
- timezone: Asia/Shanghai
9
- open-pull-requests-limit: 10
3
+ - package-ecosystem: "bundler"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "daily"
7
+
8
+ - package-ecosystem: "github-actions"
9
+ directory: "/"
10
+ schedule:
11
+ interval: "daily"
@@ -10,12 +10,12 @@ jobs:
10
10
  strategy:
11
11
  fail-fast: false
12
12
  matrix:
13
- ruby: [ ruby-2.5, ruby-2.6, ruby-2.7, ruby-3.0 ]
13
+ ruby: [ ruby-2.5, ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1, ruby-3.2 ]
14
14
  os: [ ubuntu-latest, macos-latest ]
15
15
  runs-on: ${{ matrix.os }}
16
16
 
17
17
  steps:
18
- - uses: actions/checkout@v2
18
+ - uses: actions/checkout@v3
19
19
 
20
20
  - uses: ruby/setup-ruby@v1
21
21
  with:
data/CHANGELOG.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # ChangeLog
2
2
 
3
+ ## 2.5.1
4
+
5
+ * Bugfix: Handle string resources referencing other resources.
6
+
3
7
  ## 2.5.0
4
8
 
5
9
  > New begins!
10
+
6
11
  ## 0.7.0
7
12
 
8
13
  * implement Apk#signs, Apk#certificates and Manifest#version_name (#14, #15)
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # android_parser
2
2
 
3
+ [![Language](https://img.shields.io/badge/ruby-2.5+-701516.svg)](.github/workflows/ci.yml)
4
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/icyleaf/android_parser/ci.yml)](https://github.com/icyleaf/android_parser/actions/workflows/ci.yml)
5
+ [![Gem version](https://img.shields.io/gem/v/android_parser.svg?style=flat)](https://rubygems.org/gems/android_parser)
6
+ [![License](https://img.shields.io/badge/license-MIT-red.svg?style=flat)](LICENSE.txt)
7
+
3
8
  Android Apk static analysis parser library for Ruby, forked from [playtestcloud/ruby_apk](https://github.com/playtestcloud/ruby_apk).
4
9
 
5
10
  ## Requirements
@@ -1,14 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # frozen_string_literal: true
4
-
5
3
  lib = File.expand_path('../lib', __FILE__)
6
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
- # require 'android_parser/version'
8
5
 
9
6
  Gem::Specification.new do |spec|
10
7
  spec.name = 'android_parser'
11
- spec.version = '2.5.0'
8
+ spec.version = '2.5.1'
12
9
  spec.authors = ['SecureBrain', 'icyleaf']
13
10
  spec.email = ['info@securebrain.co.jp', 'icyleaf.cn@gmail.com']
14
11
  spec.platform = Gem::Platform::RUBY
@@ -26,10 +23,10 @@ Gem::Specification.new do |spec|
26
23
  spec.add_dependency 'rexml', '> 3.0'
27
24
  end
28
25
 
26
+ spec.add_development_dependency 'rspec', '~> 3.0'
29
27
  spec.add_development_dependency 'rspec-its', '>= 1.2.0'
30
28
  spec.add_development_dependency 'rspec-collection_matchers', '>= 1.1.0'
31
29
  spec.add_development_dependency 'rspec-mocks', '>= 3.6.0'
32
30
  spec.add_development_dependency 'bundler', '>= 1.12'
33
31
  spec.add_development_dependency 'rake', '>= 10.0'
34
- # spec.add_development_dependency 'rspec', '~> 3.0'
35
32
  end
@@ -355,12 +355,7 @@ module Android
355
355
  @types[type_id('string')].each do |type|
356
356
  str_hash = {}
357
357
  type.entry_count.times do |i|
358
- entry = type[i]
359
- if entry.nil?
360
- str_hash[i] = nil
361
- else
362
- str_hash[i] = @global_string_pool.strings[type[i].val.data]
363
- end
358
+ str_hash[i] = lookup_string_value(type, i)
364
359
  end
365
360
  lang = type.config.locale_lang
366
361
  contry = type.config.locale_contry
@@ -375,6 +370,20 @@ module Android
375
370
  end
376
371
  private :extract_res_strings
377
372
 
373
+ def lookup_string_value(type, index)
374
+ entry = type[index]
375
+ return nil if entry.nil?
376
+
377
+ if entry.val.data_type == ResValue::TYPE_REFERENCE
378
+ # this assumes that the value references another string resource, i.e. we're ignoring the type id of the reference
379
+ reference_id = entry.val.data & 0xffff
380
+ lookup_string_value(type, reference_id)
381
+ else
382
+ @global_string_pool.strings[entry.val.data]
383
+ end
384
+ end
385
+ private :lookup_string_value
386
+
378
387
  def inspect
379
388
  "<ResTablePackage offset:%#08x, size:%#x, name:\"%s\">" % [@offset, @size, @name]
380
389
  end
@@ -523,6 +532,8 @@ module Android
523
532
  end
524
533
 
525
534
  class ResValue < Chunk
535
+ TYPE_REFERENCE = 0x01
536
+
526
537
  attr_reader :size, :data_type, :data
527
538
  def parse
528
539
  @size = read_int16
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: android_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SecureBrain
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-12-15 00:00:00.000000000 Z
12
+ date: 2023-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubyzip
@@ -31,6 +31,34 @@ dependencies:
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.0'
34
+ - !ruby/object:Gem::Dependency
35
+ name: rexml
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
34
62
  - !ruby/object:Gem::Dependency
35
63
  name: rspec-its
36
64
  requirement: !ruby/object:Gem::Requirement
@@ -152,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
180
  - !ruby/object:Gem::Version
153
181
  version: '0'
154
182
  requirements: []
155
- rubygems_version: 3.1.4
183
+ rubygems_version: 3.4.1
156
184
  signing_key:
157
185
  specification_version: 4
158
186
  summary: Static analysis tool for android apk since 2021