pedump 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +2 -4
  3. data/VERSION +1 -1
  4. data/lib/pedump/cli.rb +16 -8
  5. data/pedump.gemspec +5 -5
  6. metadata +17 -17
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source "http://rubygems.org"
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
- gem "rest-client", "~> 1.6.7"
5
+ gem "multipart-post", "~> 1.1.4"
6
6
  gem "progressbar", "~> 0.9.2"
7
7
 
8
8
  # Add dependencies to develop your gem here.
data/Gemfile.lock CHANGED
@@ -7,12 +7,10 @@ GEM
7
7
  bundler (~> 1.0)
8
8
  git (>= 1.2.5)
9
9
  rake
10
- mime-types (1.16)
10
+ multipart-post (1.1.4)
11
11
  progressbar (0.9.2)
12
12
  rake (0.9.2.2)
13
13
  rcov (0.9.11)
14
- rest-client (1.6.7)
15
- mime-types (>= 1.16)
16
14
  rspec (2.3.0)
17
15
  rspec-core (~> 2.3.0)
18
16
  rspec-expectations (~> 2.3.0)
@@ -28,7 +26,7 @@ PLATFORMS
28
26
  DEPENDENCIES
29
27
  bundler (~> 1.0.0)
30
28
  jeweler (~> 1.6.4)
29
+ multipart-post (~> 1.1.4)
31
30
  progressbar (~> 0.9.2)
32
31
  rcov
33
- rest-client (~> 1.6.7)
34
32
  rspec (~> 2.3.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
data/lib/pedump/cli.rb CHANGED
@@ -100,6 +100,8 @@ class PEdump::CLI
100
100
  end
101
101
 
102
102
  class ProgressProxy
103
+ attr_reader :pbar
104
+
103
105
  def initialize file
104
106
  @file = file
105
107
  @pbar = ProgressBar.new("[.] uploading", file.size, STDOUT)
@@ -126,7 +128,7 @@ class PEdump::CLI
126
128
 
127
129
  require 'digest/md5'
128
130
  require 'open-uri'
129
- require 'rest-client'
131
+ require 'net/http/post/multipart'
130
132
  require 'progressbar'
131
133
 
132
134
  stdout_sync = STDOUT.sync
@@ -134,12 +136,12 @@ class PEdump::CLI
134
136
 
135
137
  md5 = Digest::MD5.file(f.path).hexdigest
136
138
  @pedump.logger.info "[.] md5: #{md5}"
137
- url = "#{URL_BASE}/#{md5}/"
139
+ file_url = "#{URL_BASE}/#{md5}/"
138
140
 
139
141
  @pedump.logger.info "[.] checking if file already uploaded.."
140
142
  begin
141
- if (r=open(url).read) == "OK"
142
- @pedump.logger.warn "[.] file already uploaded: #{url}"
143
+ if (r=open(file_url).read) == "OK"
144
+ @pedump.logger.warn "[.] file already uploaded: #{file_url}"
143
145
  return
144
146
  else
145
147
  raise "invalid server response: #{r}"
@@ -149,9 +151,15 @@ class PEdump::CLI
149
151
  end
150
152
 
151
153
  f.rewind
152
- if (r=RestClient.post(URL_BASE, :file => ProgressProxy.new(f))) != "OK"
153
- raise "invalid server response: #{r}"
154
- end
154
+
155
+ # upload with progressbar
156
+ post_url = URI.parse(URL_BASE+'/')
157
+ uio = UploadIO.new(f, "application/octet-stream", File.basename(f.path))
158
+ ppx = ProgressProxy.new(uio)
159
+ req = Net::HTTP::Post::Multipart.new post_url.path, "file" => ppx
160
+ res = Net::HTTP.start(post_url.host, post_url.port){ |http| http.request(req) }
161
+ ppx.pbar.finish
162
+
155
163
  puts
156
164
  puts "[.] analyzing..."
157
165
 
@@ -159,7 +167,7 @@ class PEdump::CLI
159
167
  raise "invalid server response: #{r}"
160
168
  end
161
169
 
162
- puts "[.] uploaded: #{url}"
170
+ puts "[.] uploaded: #{file_url}"
163
171
  ensure
164
172
  STDOUT.sync = stdout_sync
165
173
  end
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.3.0"
8
+ s.version = "0.3.1"
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 = "2011-12-11"
12
+ s.date = "2011-12-12"
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"]
@@ -43,14 +43,14 @@ Gem::Specification.new do |s|
43
43
  s.specification_version = 3
44
44
 
45
45
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
- s.add_runtime_dependency(%q<rest-client>, ["~> 1.6.7"])
46
+ s.add_runtime_dependency(%q<multipart-post>, ["~> 1.1.4"])
47
47
  s.add_runtime_dependency(%q<progressbar>, ["~> 0.9.2"])
48
48
  s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
49
49
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
50
50
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
51
51
  s.add_development_dependency(%q<rcov>, [">= 0"])
52
52
  else
53
- s.add_dependency(%q<rest-client>, ["~> 1.6.7"])
53
+ s.add_dependency(%q<multipart-post>, ["~> 1.1.4"])
54
54
  s.add_dependency(%q<progressbar>, ["~> 0.9.2"])
55
55
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
56
56
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
@@ -58,7 +58,7 @@ Gem::Specification.new do |s|
58
58
  s.add_dependency(%q<rcov>, [">= 0"])
59
59
  end
60
60
  else
61
- s.add_dependency(%q<rest-client>, ["~> 1.6.7"])
61
+ s.add_dependency(%q<multipart-post>, ["~> 1.1.4"])
62
62
  s.add_dependency(%q<progressbar>, ["~> 0.9.2"])
63
63
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
64
64
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
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.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-11 00:00:00.000000000Z
12
+ date: 2011-12-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rest-client
16
- requirement: &70185231241440 !ruby/object:Gem::Requirement
15
+ name: multipart-post
16
+ requirement: &70170796571980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.6.7
21
+ version: 1.1.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70185231241440
24
+ version_requirements: *70170796571980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: progressbar
27
- requirement: &70185231240020 !ruby/object:Gem::Requirement
27
+ requirement: &70170796565140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70185231240020
35
+ version_requirements: *70170796565140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70185231238140 !ruby/object:Gem::Requirement
38
+ requirement: &70170796564100 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.3.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70185231238140
46
+ version_requirements: *70170796564100
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70185231228680 !ruby/object:Gem::Requirement
49
+ requirement: &70170796562840 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70185231228680
57
+ version_requirements: *70170796562840
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &70185231227000 !ruby/object:Gem::Requirement
60
+ requirement: &70170796562220 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.6.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70185231227000
68
+ version_requirements: *70170796562220
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rcov
71
- requirement: &70185231225760 !ruby/object:Gem::Requirement
71
+ requirement: &70170796561460 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70185231225760
79
+ version_requirements: *70170796561460
80
80
  description: dump headers, sections, extract resources of win32 PE exe,dll,etc
81
81
  email: zed.0xff@gmail.com
82
82
  executables:
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: 2723794485104812379
118
+ hash: 1927825518031609740
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements: