pedump 0.4.13 → 0.4.14

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.13
1
+ 0.4.14
data/lib/pedump/cli.rb CHANGED
@@ -223,6 +223,7 @@ class PEdump::CLI
223
223
 
224
224
  require 'digest/md5'
225
225
  require 'open-uri'
226
+ require 'net/http'
226
227
  require 'net/http/post/multipart'
227
228
  require 'progressbar'
228
229
 
@@ -233,16 +234,19 @@ class PEdump::CLI
233
234
  @pedump.logger.info "[.] md5: #{md5}"
234
235
  file_url = "#{URL_BASE}/#{md5}/"
235
236
 
236
- @pedump.logger.info "[.] checking if file already uploaded.."
237
- begin
238
- if (r=open(file_url).read) == "OK"
237
+ @pedump.logger.warn "[.] checking if file already uploaded.."
238
+ Net::HTTP.start('pedump.me') do |http|
239
+ http.open_timeout = 10
240
+ http.read_timeout = 10
241
+ # doing HTTP HEAD is a lot faster than open-uri
242
+ h = http.head("/#{md5}/")
243
+ if h.code.to_i == 200 && h.content_type.to_s.strip.downcase == "text/html"
239
244
  @pedump.logger.warn "[.] file already uploaded: #{file_url}"
240
245
  return
241
- else
242
- raise "invalid server response: #{r}"
246
+ elsif h.code.to_i != 404 # 404 means that there's no such file and we're OK to upload
247
+ @pedump.logger.fatal "[!] invalid server response: \"#{h.code} #{h.msg}\" (#{h.content_type})"
248
+ exit(1)
243
249
  end
244
- rescue OpenURI::HTTPError
245
- raise unless $!.to_s == "404 Not Found"
246
250
  end
247
251
 
248
252
  f.rewind
@@ -2,7 +2,7 @@ class PEdump
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- PATCH = 13
5
+ PATCH = 14
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
data/pedump.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "pedump"
8
- s.version = "0.4.13"
8
+ s.version = "0.4.14"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrey \"Zed\" Zaikin"]
12
- s.date = "2012-12-14"
12
+ s.date = "2012-12-17"
13
13
  s.description = "dump headers, sections, extract resources of win32 PE exe,dll,etc"
14
14
  s.email = "zed.0xff@gmail.com"
15
15
  s.executables = ["pedump"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pedump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.13
4
+ version: 0.4.14
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: 2012-12-14 00:00:00.000000000 Z
12
+ date: 2012-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multipart-post
@@ -231,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
231
  version: '0'
232
232
  segments:
233
233
  - 0
234
- hash: -4036387979083550297
234
+ hash: -4041753216980716747
235
235
  required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  none: false
237
237
  requirements: