origami 1.2.6 → 1.2.7
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 +4 -4
- data/bin/pdf2ruby +7 -4
- data/lib/origami/encryption.rb +2 -2
- data/lib/origami/page.rb +1 -1
- data/lib/origami/pdf.rb +12 -12
- data/lib/origami/stream.rb +1 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d17b0e4071c2342bd02ad39ac239edc3e185296c
|
4
|
+
data.tar.gz: ed34fe83604f52063e0340b06e95bce6a2f2c801
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5332359f279fb3e88d28229f1bbd9b361aaeb84724ce3682d296d67b9d1c729c2c8da288a644add7109f7090692dcc669706e907731a308c13f635931c43dea3
|
7
|
+
data.tar.gz: 1fe6ceb2f9cfff14bd15018bc1c965c43ad01e96d46de67538d58c48d9d8a9c97a7dc9b520aeb9b1e2caa2d9958f3f741406a90d4f7f4ee90e9b01d0f9198e89
|
data/bin/pdf2ruby
CHANGED
@@ -82,6 +82,8 @@ if ARGV.empty?
|
|
82
82
|
else
|
83
83
|
TARGET = ARGV.shift
|
84
84
|
end
|
85
|
+
|
86
|
+
Origami::OPTIONS[:enable_type_guessing] = Origami::OPTIONS[:enable_type_propagation] = true
|
85
87
|
|
86
88
|
TARGET_DIR = File.basename(TARGET, '.pdf')
|
87
89
|
TARGET_FILE = "#{TARGET_DIR}/#{TARGET_DIR}.rb"
|
@@ -99,11 +101,12 @@ def objectToRuby(obj, inclevel = 0, internalname = nil, do_convert = false)
|
|
99
101
|
when Origami::String
|
100
102
|
"'#{obj.value.gsub("'","\\\\'")}'"
|
101
103
|
when Origami::Dictionary
|
102
|
-
|
103
|
-
if obj
|
104
|
-
|
104
|
+
customclass = nil
|
105
|
+
if obj.class != Origami::Dictionary
|
106
|
+
p = (obj.class == Origami::Encoding) ? 0 : 1
|
107
|
+
customclass = obj.class.to_s.split('::')[p..-1].join('::') # strip Origami prefix if there is no collision
|
105
108
|
end
|
106
|
-
dictionaryToRuby(obj, inclevel, internalname,
|
109
|
+
dictionaryToRuby(obj, inclevel, internalname, customclass)
|
107
110
|
when Origami::Array
|
108
111
|
arrayToRuby(obj, inclevel, internalname)
|
109
112
|
when Origami::Stream
|
data/lib/origami/encryption.rb
CHANGED
@@ -1067,7 +1067,7 @@ module Origami
|
|
1067
1067
|
module Standard
|
1068
1068
|
|
1069
1069
|
PADDING = "\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A" #:nodoc:
|
1070
|
-
PADDING.force_encoding('binary') if RUBY_VERSION
|
1070
|
+
PADDING.force_encoding('binary') if RUBY_VERSION >= '1.9'
|
1071
1071
|
|
1072
1072
|
#
|
1073
1073
|
# Permission constants for encrypted documents.
|
@@ -1115,7 +1115,7 @@ module Origami
|
|
1115
1115
|
|
1116
1116
|
if self.R < 5
|
1117
1117
|
padded = pad_password(userpassword)
|
1118
|
-
padded.force_encoding('binary') if RUBY_VERSION
|
1118
|
+
padded.force_encoding('binary') if RUBY_VERSION >= '1.9'
|
1119
1119
|
|
1120
1120
|
padded << self.O
|
1121
1121
|
padded << [ self.P ].pack("i")
|
data/lib/origami/page.rb
CHANGED
data/lib/origami/pdf.rb
CHANGED
@@ -564,15 +564,15 @@ module Origami
|
|
564
564
|
raise TypeError, "Invalid parameter type : #{no.class}"
|
565
565
|
end
|
566
566
|
|
567
|
-
set = indirect_objects_table
|
568
|
-
|
569
567
|
#
|
570
568
|
# Search through accessible indirect objects.
|
571
569
|
#
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
570
|
+
@revisions.each do |rev|
|
571
|
+
return rev.body[target] if rev.body.include?(target)
|
572
|
+
end
|
573
|
+
|
574
|
+
# Look into XRef streams.
|
575
|
+
if use_xrefstm == true
|
576
576
|
|
577
577
|
if @revisions.last.has_xrefstm?
|
578
578
|
xrefstm = @revisions.last.xrefstm
|
@@ -605,8 +605,12 @@ module Origami
|
|
605
605
|
#
|
606
606
|
# Lastly search directly into Object streams (might be very slow).
|
607
607
|
#
|
608
|
-
|
609
|
-
|
608
|
+
@revisions.each do |rev|
|
609
|
+
streams = rev.objects.find_all{|obj| obj.is_a?(ObjectStream) and obj.include?(target.refno)}
|
610
|
+
return streams.first.extract(target.refno) unless streams.empty?
|
611
|
+
end
|
612
|
+
|
613
|
+
nil
|
610
614
|
end
|
611
615
|
|
612
616
|
end
|
@@ -1016,10 +1020,6 @@ module Origami
|
|
1016
1020
|
max
|
1017
1021
|
end
|
1018
1022
|
|
1019
|
-
def indirect_objects_table #:nodoc:
|
1020
|
-
@revisions.inject({}) do |set, rev| set.merge(rev.body) end
|
1021
|
-
end
|
1022
|
-
|
1023
1023
|
def indirect_objects_by_rev #:nodoc:
|
1024
1024
|
@revisions.inject([]) do |set,rev|
|
1025
1025
|
objset = rev.objects
|
data/lib/origami/stream.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: origami
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Delugre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: "Origami is a PDF-compliant parser. This is not a PDF rendering library,
|
14
14
|
it aims at providing a scripting tool to generate and analyze malicious PDF files.
|
@@ -32,8 +32,8 @@ executables:
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
-
- README
|
36
35
|
- COPYING.LESSER
|
36
|
+
- README
|
37
37
|
- bin/config/pdfcop.conf.yml
|
38
38
|
- bin/gui/COPYING
|
39
39
|
- bin/gui/about.rb
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- bin/pdfmetadata
|
63
63
|
- bin/pdfsh
|
64
64
|
- bin/pdfwalker
|
65
|
+
- bin/shell/.irbrc
|
65
66
|
- bin/shell/console.rb
|
66
67
|
- bin/shell/hexdump.rb
|
67
68
|
- lib/origami.rb
|
@@ -154,7 +155,6 @@ files:
|
|
154
155
|
- templates/patterns.rb
|
155
156
|
- templates/widgets.rb
|
156
157
|
- templates/xdp.rb
|
157
|
-
- bin/shell/.irbrc
|
158
158
|
- test/ts_pdf.rb
|
159
159
|
homepage: http://code.google.com/p/origami-pdf
|
160
160
|
licenses:
|
@@ -166,18 +166,18 @@ require_paths:
|
|
166
166
|
- lib
|
167
167
|
required_ruby_version: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
|
-
- -
|
169
|
+
- - ">="
|
170
170
|
- !ruby/object:Gem::Version
|
171
171
|
version: '0'
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
|
-
- -
|
174
|
+
- - ">="
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
requirements:
|
178
178
|
- ruby-gtk2 if you plan to run the PDF Walker interface
|
179
179
|
rubyforge_project:
|
180
|
-
rubygems_version: 2.
|
180
|
+
rubygems_version: 2.2.2
|
181
181
|
signing_key:
|
182
182
|
specification_version: 4
|
183
183
|
summary: Origami aims at providing a scripting tool to generate and analyze malicious
|