excavate 0.2.3 → 0.2.4

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: f075e9cc9f1e097abd937e9788c119aa19016fb12e04db6d2848b76343ecb16a
4
- data.tar.gz: 549ab0c2572a205f3eaa95715d203741700942361cdb545ea638e7dbb8a7489e
3
+ metadata.gz: 4dedf2dff68fab0c162340e9dc591f1675612d2b6f46335c6fe599ecead65434
4
+ data.tar.gz: 8d8dd45fbe6ba733d4aa759a3f9f1bb5fc457be3fa0ae176b48bc0d1a417c8ec
5
5
  SHA512:
6
- metadata.gz: 606fa4dda709f925d779145e4b53b09a310c7cfa98d75cf992e2421eab916acccd1e48c54ae1516509c02ff350c33a54487181842260093d29e8bb70c7b039c7
7
- data.tar.gz: 4a4a4ab4d2eb48f76af71b8e1378308fc830de06ed7299339995cac94f90438f7d035b30c73646099ad2d8412a7e04441b72794378953eb94e5d5852f2fb27b9
6
+ metadata.gz: b3f6c9a0f90d398afe6ee88c64004aaa5aad6ef50382d095e9df67a2841b3ae7c1af46a2f760718837d10350d2de4b90f727b495c2d8fdd6f32ae9dd290b7de1
7
+ data.tar.gz: c33b1e35ec3c7478b9236ee705f683b937394f495bb60b57e7602841136e951cbd8eee71ceaabf586548218302e6c495010b7a30020726056d6dd3f47e2bd0ff
@@ -2,7 +2,7 @@ name: rspec
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ master ]
5
+ branches: [ master, main ]
6
6
  pull_request:
7
7
 
8
8
  jobs:
data/Gemfile CHANGED
@@ -5,9 +5,7 @@ source "https://rubygems.org"
5
5
  gemspec
6
6
 
7
7
  gem "gem-release"
8
-
9
8
  gem "rake", "~> 13.0"
10
-
11
9
  gem "rspec", "~> 3.2"
12
10
  gem "rubocop", "0.75.0"
13
11
  gem "rubocop-performance"
data/README.adoc CHANGED
@@ -69,6 +69,19 @@ $ excavate path/to/archive.cab
69
69
  ----
70
70
 
71
71
 
72
+ == Dependencies
73
+
74
+ Depends on
75
+ https://github.com/fontist/ffi-libarchive-binary[ffi-libarchive-binary] which
76
+ has the following requirements:
77
+
78
+ * zlib
79
+ * Expat
80
+ * OpenSSL (for Linux only)
81
+
82
+ These dependencies are generally present on all systems.
83
+
84
+
72
85
  == Development
73
86
 
74
87
  We are following Sandi Metz's Rules for this gem, you can read the
data/excavate.gemspec CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
 
29
29
  spec.add_runtime_dependency "arr-pm", "~> 0.0"
30
+ spec.add_runtime_dependency "ffi-libarchive-binary", "~> 0.0"
30
31
  spec.add_runtime_dependency "libmspack", "~> 0.1"
31
32
  spec.add_runtime_dependency "ruby-ole", "~> 1.0"
32
33
  spec.add_runtime_dependency "rubyzip", "~> 2.3"
@@ -7,6 +7,7 @@ module Excavate
7
7
  "msi" => Extractors::OleExtractor,
8
8
  "rpm" => Extractors::RpmExtractor,
9
9
  "tar" => Extractors::TarExtractor,
10
+ "pkg" => Extractors::XarExtractor,
10
11
  "zip" => Extractors::ZipExtractor }.freeze
11
12
 
12
13
  def initialize(archive)
@@ -6,4 +6,5 @@ require_relative "extractors/ole_extractor"
6
6
  require_relative "extractors/rpm_extractor"
7
7
  require_relative "extractors/seven_zip_extractor"
8
8
  require_relative "extractors/tar_extractor"
9
+ require_relative "extractors/xar_extractor"
9
10
  require_relative "extractors/zip_extractor"
@@ -0,0 +1,35 @@
1
+ require "ffi-libarchive-binary"
2
+
3
+ module Excavate
4
+ module Extractors
5
+ class XarExtractor < Extractor
6
+ def extract(target)
7
+ Dir.chdir(target) do
8
+ extract_with_libarchive
9
+ rename_payload(target)
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def extract_with_libarchive
16
+ flags = ::Archive::EXTRACT_PERM
17
+ reader = ::Archive::Reader.open_filename(@archive)
18
+
19
+ reader.each_entry do |entry|
20
+ reader.extract(entry, flags.to_i)
21
+ end
22
+
23
+ reader.close
24
+ end
25
+
26
+ def rename_payload(target)
27
+ Dir.glob(File.join(target, "**", "Payload")).each do |file|
28
+ next unless File.file?(file)
29
+
30
+ FileUtils.mv(file, "#{file}.cpio.gz")
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Excavate
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excavate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-01 00:00:00.000000000 Z
11
+ date: 2021-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arr-pm
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ffi-libarchive-binary
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: libmspack
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -127,6 +141,7 @@ files:
127
141
  - lib/excavate/extractors/rpm_extractor.rb
128
142
  - lib/excavate/extractors/seven_zip_extractor.rb
129
143
  - lib/excavate/extractors/tar_extractor.rb
144
+ - lib/excavate/extractors/xar_extractor.rb
130
145
  - lib/excavate/extractors/zip_extractor.rb
131
146
  - lib/excavate/file_magic.rb
132
147
  - lib/excavate/utils.rb