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 +4 -4
- data/.github/workflows/rspec.yml +1 -1
- data/Gemfile +0 -2
- data/README.adoc +13 -0
- data/excavate.gemspec +1 -0
- data/lib/excavate/archive.rb +1 -0
- data/lib/excavate/extractors.rb +1 -0
- data/lib/excavate/extractors/xar_extractor.rb +35 -0
- data/lib/excavate/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dedf2dff68fab0c162340e9dc591f1675612d2b6f46335c6fe599ecead65434
|
4
|
+
data.tar.gz: 8d8dd45fbe6ba733d4aa759a3f9f1bb5fc457be3fa0ae176b48bc0d1a417c8ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3f6c9a0f90d398afe6ee88c64004aaa5aad6ef50382d095e9df67a2841b3ae7c1af46a2f760718837d10350d2de4b90f727b495c2d8fdd6f32ae9dd290b7de1
|
7
|
+
data.tar.gz: c33b1e35ec3c7478b9236ee705f683b937394f495bb60b57e7602841136e951cbd8eee71ceaabf586548218302e6c495010b7a30020726056d6dd3f47e2bd0ff
|
data/.github/workflows/rspec.yml
CHANGED
data/Gemfile
CHANGED
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"
|
data/lib/excavate/archive.rb
CHANGED
data/lib/excavate/extractors.rb
CHANGED
@@ -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
|
data/lib/excavate/version.rb
CHANGED
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.
|
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-
|
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
|