origami 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +5 -4
- data/bin/gui/COPYING +674 -0
- data/bin/gui/about.rb +9 -9
- data/bin/gui/config.rb +7 -7
- data/bin/gui/file.rb +7 -7
- data/bin/gui/gtkhex.rb +1341 -0
- data/bin/gui/hexview.rb +16 -25
- data/bin/gui/imgview.rb +7 -7
- data/bin/gui/menu.rb +8 -8
- data/bin/gui/properties.rb +27 -14
- data/bin/gui/signing.rb +7 -7
- data/bin/gui/textview.rb +14 -17
- data/bin/gui/treeview.rb +8 -8
- data/bin/gui/walker.rb +7 -7
- data/bin/gui/xrefs.rb +7 -7
- data/bin/pdf2ruby +7 -3
- data/bin/pdfencrypt +2 -2
- data/bin/pdfextract +7 -7
- data/bin/pdfwalker +1 -1
- data/bin/shell/console.rb +2 -2
- data/lib/origami/encryption.rb +7 -9
- data/lib/origami/filters.rb +10 -0
- data/lib/origami/filters/ascii.rb +12 -7
- data/lib/origami/filters/ccitt.rb +14 -5
- data/lib/origami/filters/flate.rb +2 -11
- data/lib/origami/filters/lzw.rb +10 -3
- data/lib/origami/filters/runlength.rb +1 -1
- data/lib/origami/object.rb +7 -5
- data/lib/origami/parsers/pdf/linear.rb +6 -6
- data/lib/origami/pdf.rb +2 -2
- data/lib/origami/stream.rb +10 -9
- data/lib/origami/string.rb +9 -5
- metadata +44 -46
- data/bin/gui/hexdump.rb +0 -74
- data/lib/origami/docmdp.rb +0 -96
data/bin/gui/hexview.rb
CHANGED
@@ -4,26 +4,26 @@
|
|
4
4
|
hexview.rb
|
5
5
|
|
6
6
|
= Info
|
7
|
-
This file is part of
|
7
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
8
8
|
Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org>
|
9
9
|
All right reserved.
|
10
10
|
|
11
|
-
|
12
|
-
it under the terms of the GNU
|
11
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
13
|
the Free Software Foundation, either version 3 of the License, or
|
14
14
|
(at your option) any later version.
|
15
15
|
|
16
|
-
|
16
|
+
PDF Walker is distributed in the hope that it will be useful,
|
17
17
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
18
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
-
GNU
|
19
|
+
GNU General Public License for more details.
|
20
20
|
|
21
|
-
You should have received a copy of the GNU
|
22
|
-
along with
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
23
23
|
|
24
24
|
=end
|
25
25
|
|
26
|
-
require 'gui/
|
26
|
+
require 'gui/gtkhex'
|
27
27
|
|
28
28
|
module PDFWalker
|
29
29
|
|
@@ -44,21 +44,15 @@ module PDFWalker
|
|
44
44
|
set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
|
45
45
|
|
46
46
|
@current_obj = nil
|
47
|
-
|
48
|
-
@
|
47
|
+
|
48
|
+
@view = HexEditor.new
|
49
|
+
@view.show_offsets(true)
|
49
50
|
|
50
|
-
@
|
51
|
-
:weight => Pango::WEIGHT_BOLD,
|
52
|
-
#:foreground => "black",
|
53
|
-
:family => "Courier",
|
54
|
-
:scale => Pango::AttrScale::LARGE
|
55
|
-
)
|
56
|
-
|
57
|
-
add_with_viewport @valueview
|
51
|
+
add_with_viewport @view
|
58
52
|
end
|
59
53
|
|
60
54
|
def clear
|
61
|
-
@
|
55
|
+
@view.set_data ''
|
62
56
|
end
|
63
57
|
|
64
58
|
def load(object)
|
@@ -69,14 +63,11 @@ module PDFWalker
|
|
69
63
|
|
70
64
|
case object
|
71
65
|
when Origami::Stream
|
72
|
-
@
|
73
|
-
when Origami::
|
74
|
-
@
|
75
|
-
when Origami::ByteString
|
76
|
-
@valuebuffer.set_text(object.to_utf8)
|
66
|
+
@view.set_data(object.data)
|
67
|
+
when Origami::String
|
68
|
+
@view.set_data(object.value)
|
77
69
|
end
|
78
70
|
|
79
|
-
@valuebuffer.apply_tag("HexView", @valuebuffer.start_iter, @valuebuffer.end_iter)
|
80
71
|
@current_obj = object
|
81
72
|
|
82
73
|
rescue Exception => e
|
data/bin/gui/imgview.rb
CHANGED
@@ -4,22 +4,22 @@
|
|
4
4
|
imgview.rb
|
5
5
|
|
6
6
|
= Info
|
7
|
-
This file is part of
|
7
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
8
8
|
Copyright (C) 2010 Guillaume Delugr� <guillaume@security-labs.org>
|
9
9
|
All right reserved.
|
10
10
|
|
11
|
-
|
12
|
-
it under the terms of the GNU
|
11
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
13
|
the Free Software Foundation, either version 3 of the License, or
|
14
14
|
(at your option) any later version.
|
15
15
|
|
16
|
-
|
16
|
+
PDF Walker is distributed in the hope that it will be useful,
|
17
17
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
18
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
-
GNU
|
19
|
+
GNU General Public License for more details.
|
20
20
|
|
21
|
-
You should have received a copy of the GNU
|
22
|
-
along with
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
23
23
|
|
24
24
|
=end
|
25
25
|
|
data/bin/gui/menu.rb
CHANGED
@@ -4,22 +4,22 @@
|
|
4
4
|
menu.rb
|
5
5
|
|
6
6
|
= Info
|
7
|
-
This file is part of
|
7
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
8
8
|
Copyright (C) 2010 Guillaume Delugr� <guillaume@security-labs.org>
|
9
9
|
All right reserved.
|
10
10
|
|
11
|
-
|
12
|
-
it under the terms of the GNU
|
11
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
13
|
the Free Software Foundation, either version 3 of the License, or
|
14
14
|
(at your option) any later version.
|
15
15
|
|
16
|
-
|
16
|
+
PDF Walker is distributed in the hope that it will be useful,
|
17
17
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
18
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
-
GNU
|
19
|
+
GNU General Public License for more details.
|
20
20
|
|
21
|
-
You should have received a copy of the GNU
|
22
|
-
along with
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
23
23
|
|
24
24
|
=end
|
25
25
|
|
@@ -266,7 +266,7 @@ module PDFWalker
|
|
266
266
|
|
267
267
|
AccelMap.add_entry("<PDF Walker>/File/Open", Gdk::Keyval::GDK_O, Gdk::Window::CONTROL_MASK)
|
268
268
|
AccelMap.add_entry("<PDF Walker>/File/Refresh", Gdk::Keyval::GDK_R, Gdk::Window::CONTROL_MASK)
|
269
|
-
AccelMap.add_entry("<PDF Walker>/File/Close", Gdk::Keyval::
|
269
|
+
AccelMap.add_entry("<PDF Walker>/File/Close", Gdk::Keyval::GDK_W, Gdk::Window::CONTROL_MASK)
|
270
270
|
AccelMap.add_entry("<PDF Walker>/File/Save", Gdk::Keyval::GDK_S, Gdk::Window::CONTROL_MASK)
|
271
271
|
AccelMap.add_entry("<PDF Walker>/File/Quit", Gdk::Keyval::GDK_Q, Gdk::Window::CONTROL_MASK)
|
272
272
|
AccelMap.add_entry("<PDF Walker>/Document/Search", Gdk::Keyval::GDK_F, Gdk::Window::CONTROL_MASK)
|
data/bin/gui/properties.rb
CHANGED
@@ -4,22 +4,22 @@
|
|
4
4
|
properties.rb
|
5
5
|
|
6
6
|
= Info
|
7
|
-
This file is part of
|
7
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
8
8
|
Copyright (C) 2010 Guillaume Delugr� <guillaume@security-labs.org>
|
9
9
|
All right reserved.
|
10
10
|
|
11
|
-
|
12
|
-
it under the terms of the GNU
|
11
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
13
|
the Free Software Foundation, either version 3 of the License, or
|
14
14
|
(at your option) any later version.
|
15
15
|
|
16
|
-
|
16
|
+
PDF Walker is distributed in the hope that it will be useful,
|
17
17
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
18
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
-
GNU
|
19
|
+
GNU General Public License for more details.
|
20
20
|
|
21
|
-
You should have received a copy of the GNU
|
22
|
-
along with
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
23
23
|
|
24
24
|
=end
|
25
25
|
|
@@ -54,21 +54,34 @@ module PDFWalker
|
|
54
54
|
super("Document properties", parent, Dialog::MODAL, [Stock::CLOSE, Dialog::RESPONSE_NONE])
|
55
55
|
|
56
56
|
docframe = Frame.new(" File properties ")
|
57
|
+
stat = File.stat(parent.filename)
|
57
58
|
|
58
|
-
|
59
|
+
if RUBY_VERSION < '1.9'
|
60
|
+
require 'iconv'
|
61
|
+
i = Iconv.new("UTF-8//IGNORE//TRANSLIT", "ISO-8859-1")
|
62
|
+
|
63
|
+
creation_date = i.iconv(stat.ctime.to_s)
|
64
|
+
last_modified = i.iconv(stat.mtime.to_s)
|
65
|
+
fd = File.open(parent.filename, 'rb')
|
66
|
+
md5sum = Digest::MD5.hexdigest(fd.read)
|
67
|
+
fd.close
|
68
|
+
i.close
|
69
|
+
else
|
70
|
+
creation_date = stat.ctime.to_s.encode("utf-8", :invalid => :replace, :undef => :replace)
|
71
|
+
last_modified = stat.mtime.to_s.encode("utf-8", :invalid => :replace, :undef => :replace)
|
72
|
+
md5sum = Digest::MD5.hexdigest(File.binread(parent.filename))
|
73
|
+
end
|
59
74
|
|
60
|
-
stat = File.stat(parent.filename)
|
61
75
|
labels =
|
62
76
|
[
|
63
77
|
[ "Filename:", parent.filename ],
|
64
78
|
[ "File size:", "#{File.size(parent.filename)} bytes" ],
|
65
|
-
[ "MD5:",
|
79
|
+
[ "MD5:", md5sum ],
|
66
80
|
[ "Read-only:", "#{not stat.writable?}" ],
|
67
|
-
[ "Creation date:",
|
68
|
-
[ "Last modified:",
|
81
|
+
[ "Creation date:", creation_date ],
|
82
|
+
[ "Last modified:", last_modified ]
|
69
83
|
]
|
70
|
-
|
71
|
-
|
84
|
+
|
72
85
|
doctable = Table.new(labels.size + 1, 3)
|
73
86
|
|
74
87
|
row = 0
|
data/bin/gui/signing.rb
CHANGED
@@ -4,22 +4,22 @@
|
|
4
4
|
signing.rb
|
5
5
|
|
6
6
|
= Info
|
7
|
-
This file is part of
|
7
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
8
8
|
Copyright (C) 2010 Guillaume Delugr� <guillaume@security-labs.org>
|
9
9
|
All right reserved.
|
10
10
|
|
11
|
-
|
12
|
-
it under the terms of the GNU
|
11
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
13
|
the Free Software Foundation, either version 3 of the License, or
|
14
14
|
(at your option) any later version.
|
15
15
|
|
16
|
-
|
16
|
+
PDF Walker is distributed in the hope that it will be useful,
|
17
17
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
18
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
-
GNU
|
19
|
+
GNU General Public License for more details.
|
20
20
|
|
21
|
-
You should have received a copy of the GNU
|
22
|
-
along with
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
23
23
|
|
24
24
|
=end
|
25
25
|
|
data/bin/gui/textview.rb
CHANGED
@@ -4,28 +4,25 @@
|
|
4
4
|
textview.rb
|
5
5
|
|
6
6
|
= Info
|
7
|
-
This file is part of
|
7
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
8
8
|
Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org>
|
9
9
|
All right reserved.
|
10
10
|
|
11
|
-
|
12
|
-
it under the terms of the GNU
|
11
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
13
|
the Free Software Foundation, either version 3 of the License, or
|
14
14
|
(at your option) any later version.
|
15
15
|
|
16
|
-
|
16
|
+
PDF Walker is distributed in the hope that it will be useful,
|
17
17
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
18
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
-
GNU
|
19
|
+
GNU General Public License for more details.
|
20
20
|
|
21
|
-
You should have received a copy of the GNU
|
22
|
-
along with
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
23
23
|
|
24
24
|
=end
|
25
25
|
|
26
|
-
require 'kconv'
|
27
|
-
require 'gui/hexdump'
|
28
|
-
|
29
26
|
module PDFWalker
|
30
27
|
|
31
28
|
class Walker < Window
|
@@ -56,7 +53,7 @@ module PDFWalker
|
|
56
53
|
|
57
54
|
@pdfbuffer.create_tag("Object",
|
58
55
|
:weight => Pango::WEIGHT_BOLD,
|
59
|
-
|
56
|
+
#:foreground => "darkblue",
|
60
57
|
:family => "Courier",
|
61
58
|
:scale => Pango::AttrScale::LARGE
|
62
59
|
)
|
@@ -74,15 +71,15 @@ module PDFWalker
|
|
74
71
|
stm = "#{object.no} #{object.generation} obj\n"
|
75
72
|
stm << object.dictionary.to_s
|
76
73
|
|
77
|
-
if object.rawdata.is_binary_data?
|
78
|
-
|
79
|
-
else
|
80
|
-
|
81
|
-
end
|
74
|
+
#if object.rawdata.is_binary_data?
|
75
|
+
# stm << "stream\n[Binary data]\nendstream"
|
76
|
+
#else
|
77
|
+
# stm << "stream\n#{object.rawdata}endstream"
|
78
|
+
#end
|
82
79
|
|
83
80
|
@pdfbuffer.set_text(stm)
|
84
81
|
|
85
|
-
elsif
|
82
|
+
elsif not (object.is_a?(::Array) or object.is_a?(Array)) and
|
86
83
|
not object.is_a?(PDF) and not object.is_a?(Adobe::PPKLite) and
|
87
84
|
not object.is_a?(PDF::Revision) and not object.is_a?(Adobe::PPKLite::Revision) and
|
88
85
|
not object.is_a?(XRefToCompressedObj)
|
data/bin/gui/treeview.rb
CHANGED
@@ -4,22 +4,22 @@
|
|
4
4
|
treeview.rb
|
5
5
|
|
6
6
|
= Info
|
7
|
-
This file is part of
|
7
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
8
8
|
Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org>
|
9
9
|
All right reserved.
|
10
10
|
|
11
|
-
|
12
|
-
it under the terms of the GNU
|
11
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
13
|
the Free Software Foundation, either version 3 of the License, or
|
14
14
|
(at your option) any later version.
|
15
15
|
|
16
|
-
|
16
|
+
PDF Walker is distributed in the hope that it will be useful,
|
17
17
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
18
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
-
GNU
|
19
|
+
GNU General Public License for more details.
|
20
20
|
|
21
|
-
You should have received a copy of the GNU
|
22
|
-
along with
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
23
23
|
|
24
24
|
=end
|
25
25
|
|
@@ -285,7 +285,7 @@ module PDFWalker
|
|
285
285
|
name =
|
286
286
|
case object
|
287
287
|
when Origami::String
|
288
|
-
'"' + object.
|
288
|
+
'"' + object.to_utf8 + '"'
|
289
289
|
when Origami::Number, Name
|
290
290
|
object.value.to_s
|
291
291
|
else
|
data/bin/gui/walker.rb
CHANGED
@@ -6,22 +6,22 @@
|
|
6
6
|
walker.rb
|
7
7
|
|
8
8
|
= Info
|
9
|
-
This file is part of
|
9
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
10
10
|
Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org>
|
11
11
|
All right reserved.
|
12
12
|
|
13
|
-
|
14
|
-
it under the terms of the GNU
|
13
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
14
|
+
it under the terms of the GNU General Public License as published by
|
15
15
|
the Free Software Foundation, either version 3 of the License, or
|
16
16
|
(at your option) any later version.
|
17
17
|
|
18
|
-
|
18
|
+
PDF Walker is distributed in the hope that it will be useful,
|
19
19
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
20
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21
|
-
GNU
|
21
|
+
GNU General Public License for more details.
|
22
22
|
|
23
|
-
You should have received a copy of the GNU
|
24
|
-
along with
|
23
|
+
You should have received a copy of the GNU General Public License
|
24
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
25
25
|
|
26
26
|
=end
|
27
27
|
|
data/bin/gui/xrefs.rb
CHANGED
@@ -4,22 +4,22 @@
|
|
4
4
|
xrefs.rb
|
5
5
|
|
6
6
|
= Info
|
7
|
-
This file is part of
|
7
|
+
This file is part of PDF Walker, a graphical PDF file browser
|
8
8
|
Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org>
|
9
9
|
All right reserved.
|
10
10
|
|
11
|
-
|
12
|
-
it under the terms of the GNU
|
11
|
+
PDF Walker is free software: you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
13
|
the Free Software Foundation, either version 3 of the License, or
|
14
14
|
(at your option) any later version.
|
15
15
|
|
16
|
-
|
16
|
+
PDF Walker is distributed in the hope that it will be useful,
|
17
17
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
18
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
-
GNU
|
19
|
+
GNU General Public License for more details.
|
20
20
|
|
21
|
-
You should have received a copy of the GNU
|
22
|
-
along with
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
|
23
23
|
|
24
24
|
=end
|
25
25
|
|
data/bin/pdf2ruby
CHANGED
@@ -26,11 +26,11 @@
|
|
26
26
|
=end
|
27
27
|
|
28
28
|
require 'optparse'
|
29
|
-
require '
|
29
|
+
require 'fileutils'
|
30
30
|
begin
|
31
|
+
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../lib"
|
31
32
|
require 'origami'
|
32
33
|
rescue LoadError
|
33
|
-
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../lib"
|
34
34
|
$: << ORIGAMIDIR
|
35
35
|
require 'origami'
|
36
36
|
end
|
@@ -315,7 +315,11 @@ puts "Processing the object hierarchy..."
|
|
315
315
|
@current_idx = 0
|
316
316
|
while @current_idx != @obj_route.size
|
317
317
|
varname = @obj_route[@current_idx]
|
318
|
-
|
318
|
+
if RUBY_VERSION < '1.9'
|
319
|
+
obj = target[@var_hash.index(varname)]
|
320
|
+
else
|
321
|
+
obj = target[@var_hash.key(varname)]
|
322
|
+
end
|
319
323
|
|
320
324
|
@code_hash[varname] ||= {}
|
321
325
|
@code_hash[varname][:body] = objectToRuby(obj, 0, varname, true)
|
data/bin/pdfencrypt
CHANGED
@@ -102,8 +102,8 @@ begin
|
|
102
102
|
|
103
103
|
pdf = PDF.read(target, params)
|
104
104
|
pdf.encrypt(
|
105
|
-
:
|
106
|
-
:
|
105
|
+
:user_passwd => @options[:password],
|
106
|
+
:owner_passwd => @options[:password],
|
107
107
|
:cipher => @options[:cipher],
|
108
108
|
:key_size => @options[:key_size],
|
109
109
|
:hardened => @options[:hardened]
|