fileshunter 0.1.0.20130725 → 0.1.1.20130827
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +2 -1
- data/ChangeLog +7 -0
- data/ReleaseInfo +1 -1
- data/bin/fileshunt +4 -2
- data/lib/fileshunter.rb +0 -2
- data/lib/fileshunter/Decoders/JPEG.rb +14 -6
- metadata +2 -2
data/AUTHORS
CHANGED
data/ChangeLog
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
= FilesHunter Release History
|
2
2
|
|
3
|
+
== 0.1.1.20130827 (Beta)
|
4
|
+
|
5
|
+
* Don't load rUtilAnts anymore in the library.
|
6
|
+
* Bug correction: Don't parse directories anymore as files.
|
7
|
+
* [JPEG] Added some debugging logs
|
8
|
+
* [JPEG] Bug correction: Accept files that are not encoding Huffman tables.
|
9
|
+
|
3
10
|
== 0.1.0.20130725 (Beta)
|
4
11
|
|
5
12
|
* Initial public release.
|
data/ReleaseInfo
CHANGED
data/bin/fileshunt
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'fileshunter'
|
5
5
|
require 'fileutils'
|
6
|
+
require 'rUtilAnts/Logging'
|
7
|
+
RUtilAnts::Logging::install_logger_on_object
|
6
8
|
|
7
9
|
module FilesHunter
|
8
10
|
|
@@ -96,8 +98,8 @@ module FilesHunter
|
|
96
98
|
end
|
97
99
|
end
|
98
100
|
end
|
99
|
-
# Remove already extracted files from the list
|
100
|
-
files.select! { |file_name| ((file_name =~ /\.__EXTRACT__\./) == nil) }
|
101
|
+
# Remove already extracted files from the list, and directories
|
102
|
+
files.select! { |file_name| (!File.directory?(file_name)) and ((file_name =~ /\.__EXTRACT__\./) == nil) }
|
101
103
|
|
102
104
|
# Analyze them
|
103
105
|
analyze_files(files)
|
data/lib/fileshunter.rb
CHANGED
@@ -78,6 +78,7 @@ module FilesHunter
|
|
78
78
|
case c_1
|
79
79
|
when MARKER_APP0
|
80
80
|
# Application specific data
|
81
|
+
log_debug "@#{cursor} - Found APP0 marker"
|
81
82
|
# Usually used for JFIF
|
82
83
|
case @data[cursor+4..cursor+8]
|
83
84
|
when JFIF_HEADER
|
@@ -113,6 +114,7 @@ module FilesHunter
|
|
113
114
|
end
|
114
115
|
when MARKER_APP1
|
115
116
|
# Application specific data
|
117
|
+
log_debug "@#{cursor} - Found APP1 marker"
|
116
118
|
# Usually used for Exif
|
117
119
|
case @data[cursor+4..cursor+9]
|
118
120
|
when EXIF_HEADER
|
@@ -139,6 +141,7 @@ module FilesHunter
|
|
139
141
|
end
|
140
142
|
when MARKER_SOF0..MARKER_SOF3
|
141
143
|
# SOF: Start of Frame
|
144
|
+
log_debug "@#{cursor} - Found SOF marker"
|
142
145
|
invalid_data("@#{cursor} - Found several SOF markers") if found_sof
|
143
146
|
invalid_data("@#{cursor} - Found a SOF marker after the SOS marker") if found_sos
|
144
147
|
found_sof = true
|
@@ -164,6 +167,7 @@ module FilesHunter
|
|
164
167
|
end
|
165
168
|
when MARKER_DHT
|
166
169
|
# DHT: Define Huffman tables
|
170
|
+
log_debug "@#{cursor} - Found DHT marker"
|
167
171
|
end_cursor = cursor + 2 + size
|
168
172
|
dht_cursor = cursor + 4
|
169
173
|
while (dht_cursor < end_cursor)
|
@@ -172,12 +176,12 @@ module FilesHunter
|
|
172
176
|
invalid_data("@#{cursor} - Unknown Huffman table type: #{huffman_type}") if (huffman_type > 1)
|
173
177
|
if (huffman_type == 0)
|
174
178
|
huffman_dc_table_id = (header_byte & 0b00001111)
|
175
|
-
invalid_data("@#{cursor} - Huffman DC table id #{huffman_dc_table_id} already defined.") if (huffman_dc_tables_id.include?(huffman_dc_table_id))
|
179
|
+
#invalid_data("@#{cursor} - Huffman DC table id #{huffman_dc_table_id} already defined.") if (huffman_dc_tables_id.include?(huffman_dc_table_id))
|
176
180
|
huffman_dc_tables_id << huffman_dc_table_id
|
177
181
|
log_debug "@#{cursor} - Found Huffman DC table: #{huffman_dc_table_id}"
|
178
182
|
else
|
179
183
|
huffman_ac_table_id = (header_byte & 0b00001111)
|
180
|
-
invalid_data("@#{cursor} - Huffman AC table id #{huffman_ac_table_id} already defined.") if (huffman_ac_tables_id.include?(huffman_ac_table_id))
|
184
|
+
#invalid_data("@#{cursor} - Huffman AC table id #{huffman_ac_table_id} already defined.") if (huffman_ac_tables_id.include?(huffman_ac_table_id))
|
181
185
|
huffman_ac_tables_id << huffman_ac_table_id
|
182
186
|
log_debug "@#{cursor} - Found Huffman AC table: #{huffman_ac_table_id}"
|
183
187
|
end
|
@@ -190,8 +194,9 @@ module FilesHunter
|
|
190
194
|
end
|
191
195
|
when MARKER_SOS
|
192
196
|
# SOS: Start of Scan
|
193
|
-
|
194
|
-
invalid_data("@#{cursor} - SOS marker begins whereas no Huffman
|
197
|
+
log_debug "@#{cursor} - Found SOS marker"
|
198
|
+
#invalid_data("@#{cursor} - SOS marker begins whereas no Huffman DC table has been defined.") if (huffman_dc_tables_id.empty?)
|
199
|
+
#invalid_data("@#{cursor} - SOS marker begins whereas no Huffman AC table has been defined.") if (huffman_ac_tables_id.empty?)
|
195
200
|
invalid_data("@#{cursor} - SOS marker begins whereas no quantisation table has been defined.") if (quantisation_tables_id.empty?)
|
196
201
|
invalid_data("@#{cursor} - SOS marker begins whereas no SOF marker has been encountered.") if (!found_sof)
|
197
202
|
found_sos = true
|
@@ -201,11 +206,12 @@ module FilesHunter
|
|
201
206
|
huffman_table_ids = @data[cursor+6+2*idx_component].ord
|
202
207
|
huffman_dc_table_id = ((huffman_table_ids & 0b11110000) >> 4)
|
203
208
|
huffman_ac_table_id = (huffman_table_ids & 0b00001111)
|
204
|
-
invalid_data("@#{cursor} - Unknown DC Huffman table: #{huffman_dc_table_id}") if (!huffman_dc_tables_id.include?(huffman_dc_table_id))
|
205
|
-
invalid_data("@#{cursor} - Unknown AC Huffman table: #{huffman_ac_table_id}") if (!huffman_ac_tables_id.include?(huffman_ac_table_id))
|
209
|
+
#invalid_data("@#{cursor} - Unknown DC Huffman table: #{huffman_dc_table_id}") if (!huffman_dc_tables_id.include?(huffman_dc_table_id))
|
210
|
+
#invalid_data("@#{cursor} - Unknown AC Huffman table: #{huffman_ac_table_id}") if (!huffman_ac_tables_id.include?(huffman_ac_table_id))
|
206
211
|
end
|
207
212
|
when MARKER_DQT
|
208
213
|
# DQT: Define quantisation tables
|
214
|
+
log_debug "@#{cursor} - Found DQT marker"
|
209
215
|
end_cursor = cursor + 2 + size
|
210
216
|
dqt_cursor = cursor + 4
|
211
217
|
while (dqt_cursor < end_cursor)
|
@@ -218,6 +224,8 @@ module FilesHunter
|
|
218
224
|
dqt_cursor += 1 + 64*((precision == 0) ? 1 : 2)
|
219
225
|
invalid_data("@#{dqt_cursor} - End of quantisation table was supposed to be @#{end_cursor}.") if (dqt_cursor > end_cursor)
|
220
226
|
end
|
227
|
+
else
|
228
|
+
log_debug "@#{cursor} - Found ignored marker: #{c_1.inspect}"
|
221
229
|
end
|
222
230
|
# Does it have entropy data?
|
223
231
|
if (c_1 == MARKER_WITH_ENTROPY_DATA)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fileshunter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1.20130827
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rUtilAnts
|