zsteg 0.2.0 → 0.2.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: 6c3df1cb23705566ae711f5916b200de58607e377ad469516e23ef5e7c593c3a
4
- data.tar.gz: ee5175fbaccc64e440c8ae3f520624485c42a0ac7fe2228f8cb1bed66cc4d7fd
3
+ metadata.gz: cb1bb907e034ed5fc54f9febcf4cdd78f6de91af843adf94ffd03d0a8be3aac1
4
+ data.tar.gz: b5cf9a4fd08d72129954628dca764be23528402ad82e608f5f36f96825b1437d
5
5
  SHA512:
6
- metadata.gz: bf7fabe958651053060be974ce6cbb79f15a9f09f6837e817a2329bbf2e0db063b0087e842f558e0b3888648d56d5a0f5b5c14f34ce43db2f7afecc2c338ef4b
7
- data.tar.gz: 1e19798636051be8b90683e4e4efdfa758f82a0122a9573196b221026684f0620e4f354561480eb82e6756638d03ea694adf48f3f152dfa3e869ef34b20a741d
6
+ metadata.gz: 0f0532dd0e6e6bdce7dbdb9a769738f6964ce0033344f659b4447fe0af03ee7e128e89cfe1ab967edc6c4d65a2b836a4b3951320187444036a4260fee2bb79ff
7
+ data.tar.gz: 69908330b837fbbc32a3f358c478756a7341361cfce99a62922c00a0a29c6c0941396ae5785977e9d4249df1b6506ff2ae17e93ef1cbe862ae61e8e5f40715fb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ base = File.expand_path('../lib', File.dirname(__FILE__))
4
+ $:.unshift(base)
5
+
6
+ require File.join(base, 'zsteg')
7
+
8
+ ZSteg::CLI.run
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ base = File.expand_path('../lib', File.dirname(__FILE__))
4
+ $:.unshift(base)
5
+
6
+ require File.join(base, 'zsteg')
7
+
8
+ ZSteg::CLI.run
@@ -209,6 +209,8 @@ module ZSteg
209
209
  h[:order] = x
210
210
  when 'prime'
211
211
  h[:prime] = true
212
+ when 'zlib'
213
+ h[:zlib] = true
212
214
  else
213
215
  raise "uknown param #{x.inspect}"
214
216
  end
@@ -227,6 +229,8 @@ module ZSteg
227
229
  # zlib stream may contain extradata
228
230
  @img.imagedata
229
231
  @img.extradata[$1.to_i]
232
+ when /imagedata/
233
+ @img.imagedata
230
234
  else
231
235
  h = decode_param_string name
232
236
  h[:limit] = @options[:limit] if @options[:limit] != Checker::DEFAULT_LIMIT
@@ -242,7 +246,15 @@ module ZSteg
242
246
  end
243
247
 
244
248
  def extract name
245
- print _extract_data(name)
249
+ data = _extract_data(name)
250
+ if name['zlib']
251
+ if r = Checker::Zlib.check_data(data)
252
+ data = r.data
253
+ else
254
+ raise "cannot decompress with zlib"
255
+ end
256
+ end
257
+ print data
246
258
  end
247
259
 
248
260
  end
@@ -1,6 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "samples/ndh2k12_sp113.bmp" do
4
- subject{ cli(sample("ndh2k12_sp113.bmp"), "-o", "all") }
5
- it { should include("%PDF-1.4") }
3
+ sample("ndh2k12_sp113.bmp") do |fname|
4
+ describe fname do
5
+ subject{ cli(fname, "-o", "all") }
6
+ it { should include("%PDF-1.4") }
7
+
8
+ describe "--extract" do
9
+ subject{ cli(fname, "--extract b1,rgb,lsb,yx") }
10
+
11
+ it { should_not include "%PDF-1.4" }
12
+ it { subject.size.should == 546750 }
13
+ end
14
+
15
+ describe "--extract zlib" do
16
+ subject{ cli(fname, "--extract b1,rgb,lsb,yx,zlib") }
17
+
18
+ it { should include "%PDF-1.4" }
19
+ it { subject.size.should == 202383 }
20
+ end
21
+ end
6
22
  end
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: zsteg 0.2.0 ruby lib
5
+ # stub: zsteg 0.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "zsteg".freeze
9
- s.version = "0.2.0"
9
+ s.version = "0.2.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zsteg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey "Zed" Zaikin
@@ -1 +0,0 @@
1
- bin/zsteg
@@ -1 +0,0 @@
1
- bin/zsteg