Added support for encoding and storing requests of type image. Fixes issue 368.

git-svn-id: https://beef.googlecode.com/svn/trunk@1200 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
a.m.saafan@gmail.com
2011-08-17 14:19:25 +00:00
parent ff63d46337
commit a1acb6e397
3 changed files with 9 additions and 11 deletions

View File

@@ -61,7 +61,7 @@ beef.encode.base64 = {
decode : function (input) {
if (window.atob) {
return atob(escape(input));
return escape(atob(input));
}
var output = "";

View File

@@ -72,15 +72,13 @@ module Requester
http_db.response_date = Time.now
http_db.has_ran = true
# temporary hack to prevent MySQL errors when saving images
# see issue http://code.google.com/p/beef/issues/detail?id=368
if BeEF::Core::Configuration.instance.get("beef.database.default") == "mysql"
if http_db.response_headers.to_s =~ /Content-Type: image/
print_debug("Found [Content-Type: image] in the http response headers: saving dummy data instead of original raw image data")
http_db.response_data = "IMAGE CONTENT"
end
end
# Store images as binary
# see issue http://code.google.com/p/beef/issues/detail?id=368
if http_db.response_headers =~ /Content-Type: image/
http_db.response_data = http_db.response_data.unpack('a*')
end
http_db.save
end

View File

@@ -34,7 +34,7 @@ module Models
property :request, Text, :lazy => true
# The http response body received. In clear text.
property :response_data, Text, :lazy => true
property :response_data, Binary, :lazy => true, :length => 2097152
# The http response code. Useful to handle cases like 404, 500, 302, ...
property :response_status_code, Integer, :lazy => true