-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File download is incorrect (checksums do not match) #797
Comments
Which version of ruby are you using ? |
|
Are you behind a proxy or something ? I can't reproduce that on Mac OS X nor Debian Script used: require 'typhoeus'
require 'open-uri'
@remote_file = 'https://wpvulndb.com/data/plugin_vulns.json'
@local_file = '/tmp/plugin_vulns.json'
class HttpError < StandardError
attr_reader :response
# @param [ Typhoeus::Response ] res
def initialize(response)
@response = response
end
def failure_details
msg = response.effective_url
msg += response.code == 0 ? " (#{response.return_message})" : " (status: #{response.code})"
end
def message
"HTTP Error: #{failure_details}"
end
end
def get_file(file)
res = Typhoeus.get(file)
fail HttpError.new(res) unless res.code == 200
res.body
end
puts "Ruby #{RUBY_VERSION}"
puts @file
puts "Expected Checksum: #{get_file("#{@remote_file}.sha512")}"
remote_body = get_file(@remote_file)
remote_checksum = Digest::SHA512.hexdigest(remote_body)
puts "Remote Body Checksum: #{remote_checksum}"
File.open(@local_file, 'wb') { |f| f.write(remote_body) }
puts "Downloaded File Checksum: #{Digest::SHA512.file(@local_file).hexdigest}"
open(@local_file, 'wb') do |file|
file << open(@remote_file).read
end
puts "Downloaded File Checksum (Open-URI): #{Digest::SHA512.file(@local_file).hexdigest}" Output:
|
@erwanlr: modified the script to use wpscan
Script content:
Uses |
@surfer190 my output is correct. What's your version of typhoeus (see below)?
Typhoeus (run from wpscan dir):
All versions:
|
Still can't reproduce huhu
Could you run the script, and post the content of /tmp/plugin_full.txt on gist (https://gist.github.com/) please ? |
@firefart Exactly the same:
|
Looks like the file is not complete (i.e has not been correctly downloaded), the mystery is why :o |
Could you try with the following command: |
Also, what's your curl version ? What's the result of |
@erwanlr The command with Curl:
Result of
|
One last test: I think it should work, but let's see :D |
Nope :/ |
I have increased the timeout values (connect to 5s and request to 60s), please update (git pull), then ./wpscan --update :) |
BTW, was able to partially reproduce the issue when my network was a bit busy:
Would be interested to reproduce that behaviour using Typhoeus to check the timed_out? attribute and return_message |
@erwanlr Awesome, sorted. Thanks. |
Be aware that this could be a local issue.
File downloaded with wpscan is: 245421 bytes
File download with wget is: 448537 bytes
Seems to be a problem with this code:
Changed code to:
It worked. Could this be a local problem with
Browser
or should the later code be implemented with error checking of course?The text was updated successfully, but these errors were encountered: