abra 0.0.2 → 1.0.0

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
  SHA1:
3
- metadata.gz: 3a4111f151ce52f68b86addfbe356c0e992252b5
4
- data.tar.gz: d3df4084e992a497ce2f8f59233c41cc12ca9147
3
+ metadata.gz: d7797535070616d2e099216ac8960693ea638a05
4
+ data.tar.gz: 9a0d5222804bcec867f3c8bb081cabe98ffd4565
5
5
  SHA512:
6
- metadata.gz: 80b681d8a303649375f2df8d428750569845bb6634c9ea8de11c784c0eac6aa08ea430e0aedb5f077e2af9f6dbf771bbc58c328968a26a9b53946428e0e07694
7
- data.tar.gz: ae58feef7eece29e30ca70138b0b9e1c68502fbd3531a0779e57acc0a4af9fd10e6830199ec7224a21785c6875c89efff872d4b04c7be5d3c5bb87787785577d
6
+ metadata.gz: 1cb179ddd98eab7e52b72cec9a3383b7e0cc8bee3728760bbd5b328f4439682bebe67f10f0fdf8381bf1517e45a2163184134925e60625e5416cdcdd59a7446e
7
+ data.tar.gz: 14e950b7cc717330212f95fa1ae621b9663d9ce392d99e1115bc01c0fffd706825ba3be2c240c90f704e5a55310422d5334dbe68e5fb88efd7062ff168c6e081
data/Gemfile CHANGED
@@ -2,6 +2,9 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'rubyzip'
6
+ gem 'zip-zip'
7
+
5
8
  group :test do
6
9
  gem 'rspec'
7
10
  end
data/README.md CHANGED
@@ -37,6 +37,14 @@ puts "[+] SDK Version: %s." % apk.sdk_version
37
37
  puts "[+] API Level: %s." % apk.api_level
38
38
  ```
39
39
 
40
+ Extract icon file
41
+
42
+ ```ruby
43
+ require 'apk'
44
+ apk = Abra::APK.new(apk_path)
45
+ apk.icon_file
46
+ ```
47
+
40
48
  ## Development
41
49
 
42
50
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,3 +1,3 @@
1
1
  module Abra
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/apk.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require "abra/version"
2
2
  require 'aapt'
3
+ require 'resource'
4
+
3
5
 
4
6
  module Abra
5
7
  class APK
@@ -15,6 +17,18 @@ module Abra
15
17
  @label = attrs[:label]
16
18
  @icon = attrs[:icon]
17
19
  @api_level = attrs[:api_level].to_i
20
+ @resource = Resource.new(@apk)
21
+ end
22
+
23
+ def icon_file
24
+ if self.icon
25
+ dst = "/tmp/abra-#{Time.now.to_i.to_s}-#{Process.pid.to_s}-#{("%04d" % rand(9999))}"
26
+ @resource.extract(self.icon, dst)
27
+ File.read(dst)
28
+ File.delete(dst)
29
+ else
30
+ nil
31
+ end
18
32
  end
19
33
 
20
34
  def sdk_version
@@ -0,0 +1,15 @@
1
+ require 'zip/zipfilesystem'
2
+
3
+ module Abra
4
+ class Resource
5
+
6
+ def initialize(apk_path)
7
+ @apk = apk_path
8
+ end
9
+
10
+ def extract(res, dst)
11
+ Zip::ZipFile.open(@apk).extract(res, dst)
12
+ end
13
+
14
+ end
15
+ end
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - junzhepan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-28 00:00:00.000000000 Z
11
+ date: 2017-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,6 +73,7 @@ files:
73
73
  - lib/aapt.rb
74
74
  - lib/abra/version.rb
75
75
  - lib/apk.rb
76
+ - lib/resource.rb
76
77
  - lib/tool/linux/aapt
77
78
  - lib/tool/linux/lib64/libc++.so
78
79
  - lib/tool/macos/aapt