apk_analyzer 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7a749460d2c62450889ae77a17caaa168d49eca
4
- data.tar.gz: c2d6b680d16576723c5c9063c3cdca2b89d720b0
3
+ metadata.gz: c9a78dc35d71f81551f39123658300a1b79d18dd
4
+ data.tar.gz: f16422da7e2bccaaf082c12a83580f9041cceafa
5
5
  SHA512:
6
- metadata.gz: e0225df57e93601f1f6e55359f429637badb21c13c5f9794c847210b9559f4b0f83467b0946b174b886662a367244ee3a2185d399ea59760ebef73429f60a965
7
- data.tar.gz: 22ca4fd6a296419afaca64075a731598b0c0130081147c8182560fcb76cfeaa3146ff90112976db9b1b475e97d5f588e0ba9d5e92a501285f03b92eb38db7087
6
+ metadata.gz: 900e109f394f8e1caedca681c1916bc0124828aaf6f520a13e359a652f15d210d542d696b6277b8b100b819c5f03f345d28d721fbfde2dab316f8cf49987b890
7
+ data.tar.gz: 0951645dc29a00dece264930df2c37026a91bee1b9e882f022941e11a819ada1191cc68df389114661e572c524f4e236f140ca34a59513db475f78650267d370
@@ -68,7 +68,8 @@ module ApkAnalyzer
68
68
 
69
69
  # Certificate info. Issuer and dates
70
70
  def collect_cert_info
71
- os_has_keytool = system('keytool')
71
+ # Redirect keytool check error to /dev/null
72
+ os_has_keytool = system('keytool 2>/dev/null')
72
73
  raise 'keytool dependency not satisfied. Make sure that JAVA keytool utility is installed' unless os_has_keytool
73
74
  cert_info = {}
74
75
  certificate_raw = `keytool -printcert -rfc -jarfile #{@apk_path.shellescape}`
@@ -190,13 +191,16 @@ module ApkAnalyzer
190
191
 
191
192
  def cert_extract_issuer(certificate_content, result)
192
193
  subject = `echo "#{certificate_content}" | openssl x509 -noout -in /dev/stdin -subject -nameopt -esc_msb,utf8`
193
- result[:issuer_raw] = subject.gsub(/\n/,'')
194
- result[:cn] = cert_extract_issuer_parameterized(subject, 'CN').gsub(/\n/,'')
195
- result[:ou] = cert_extract_issuer_parameterized(subject, 'OU')
196
- result[:o] = cert_extract_issuer_parameterized(subject, 'O')
197
- result[:st] = cert_extract_issuer_parameterized(subject, 'ST')
198
- result[:l] = cert_extract_issuer_parameterized(subject, 'L')
199
- result[:c] = cert_extract_issuer_parameterized(subject, 'C')
194
+ # All APK certificate fields are not manadatory. At least one is needed.So to remove trailing carrier return
195
+ # character, we apply gsub method on the raw subject, and we use it after.
196
+ raw = subject.gsub(/\n/,'')
197
+ result[:issuer_raw] = raw
198
+ result[:cn] = cert_extract_issuer_parameterized(raw, 'CN')
199
+ result[:ou] = cert_extract_issuer_parameterized(raw, 'OU')
200
+ result[:o] = cert_extract_issuer_parameterized(raw, 'O')
201
+ result[:st] = cert_extract_issuer_parameterized(raw, 'ST')
202
+ result[:l] = cert_extract_issuer_parameterized(raw, 'L')
203
+ result[:c] = cert_extract_issuer_parameterized(raw, 'C')
200
204
  end
201
205
 
202
206
  def cert_extract_issuer_parameterized(subject, param)
@@ -1,3 +1,3 @@
1
1
  module ApkAnalyzer
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apk_analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - BACKELITE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-12 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apktools