Module: Watobo::Mixin::Shaper::HttpResponse
- Includes:
- Constants
- Defined in:
- lib/watobo/mixins/shapers.rb
Constant Summary
Constants included
from Constants
Constants::AC_GROUP_APACHE, Constants::AC_GROUP_DOMINO, Constants::AC_GROUP_ENUMERATION, Constants::AC_GROUP_FILE_INCLUSION, Constants::AC_GROUP_FLASH, Constants::AC_GROUP_GENERIC, Constants::AC_GROUP_JBOSS, Constants::AC_GROUP_JOOMLA, Constants::AC_GROUP_SAP, Constants::AC_GROUP_SQL, Constants::AC_GROUP_TYPO3, Constants::AC_GROUP_XSS, Constants::AUTH_TYPE_BASIC, Constants::AUTH_TYPE_DIGEST, Constants::AUTH_TYPE_NONE, Constants::AUTH_TYPE_NTLM, Constants::AUTH_TYPE_UNKNOWN, Constants::CHAT_SOURCE_AUTO_SCAN, Constants::CHAT_SOURCE_FUZZER, Constants::CHAT_SOURCE_INTERCEPT, Constants::CHAT_SOURCE_MANUAL, Constants::CHAT_SOURCE_MANUAL_SCAN, Constants::CHAT_SOURCE_PROXY, Constants::CHAT_SOURCE_UNDEF, Constants::DEFAULT_PORT_HTTP, Constants::DEFAULT_PORT_HTTPS, Constants::FINDING_TYPE_HINT, Constants::FINDING_TYPE_INFO, Constants::FINDING_TYPE_UNDEFINED, Constants::FINDING_TYPE_VULN, Constants::FIRST_TIME_FILE, Constants::GUI_REGULAR_FONT_SIZE, Constants::GUI_SMALL_FONT_SIZE, Constants::ICON_PATH, Constants::LOG_DEBUG, Constants::LOG_INFO, Constants::SCAN_CANCELED, Constants::SCAN_FINISHED, Constants::SCAN_PAUSED, Constants::SCAN_STARTED, Constants::TE_CHUNKED, Constants::TE_COMPRESS, Constants::TE_DEFLATE, Constants::TE_GZIP, Constants::TE_IDENTITY, Constants::TE_NONE, Constants::VULN_RATING_CRITICAL, Constants::VULN_RATING_HIGH, Constants::VULN_RATING_INFO, Constants::VULN_RATING_LOW, Constants::VULN_RATING_MEDIUM, Constants::VULN_RATING_UNDEFINED
Instance Method Summary
collapse
Instance Method Details
#unchunk ⇒ Object
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
|
# File 'lib/watobo/mixins/shapers.rb', line 430
def unchunk
return Response.new(self) unless self.has_body?
if self.transfer_encoding == TE_CHUNKED then
self.("Transfer-Encoding")
self.("Content-Length", "0")
new_r = []
new_r.concat self.
new_r.push "\r\n"
bytes_to_read = 20
body = []
is_new_chunk = false
off = 0
new_body = ''
body_orig = self.body
pattern = '[0-9a-fA-F]+\r?\n'
while off >= 0 and off < body_orig.length
chunk_pos = body_orig.index(/(#{pattern})/, off)
len_raw = $1
unless chunk_pos.nil?
len = len_raw.strip.hex
chunk_start = chunk_pos + len_raw.length
chunk_end = chunk_start + len
break if len == 0
chunk = "#{body_orig[chunk_start..chunk_end]}"
new_body += chunk.chomp
off = chunk_end
end
end
new_r.push new_body
return Watobo::Response.new new_r
end
return Response.new(self)
end
|
#unchunk! ⇒ Object
421
422
423
424
425
426
427
428
|
# File 'lib/watobo/mixins/shapers.rb', line 421
def unchunk!
return false unless self.has_body?
unchunked = self.unchunk
self.replace(unchunked)
self.fix_content_length
end
|
#unzip ⇒ Object
485
486
487
488
489
490
491
492
493
494
495
|
# File 'lib/watobo/mixins/shapers.rb', line 485
def unzip
if self.content_encoding == TE_GZIP or self.transfer_encoding == TE_GZIP
if self.has_body?
unzipped = Response.new(self)
unzipped.unzip!
return unzipped
end
end
return Response.new(self)
end
|
#unzip! ⇒ Object
471
472
473
474
475
476
477
478
479
480
481
482
483
|
# File 'lib/watobo/mixins/shapers.rb', line 471
def unzip!
if self.content_encoding == TE_GZIP or self.transfer_encoding == TE_GZIP
if self.has_body?
unziped = self.unzip_body
self[-1] = unziped
self.("Transfer-Encoding") if self.transfer_encoding == TE_GZIP
self.("Content-Encoding") if self.content_encoding == TE_GZIP
self.fix_content_length
end
end
end
|
#unzip_body ⇒ Object
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
# File 'lib/watobo/mixins/shapers.rb', line 497
def unzip_body
begin
if self.has_body?
gziped = self.last
gz = Zlib::GzipReader.new(StringIO.new(gziped))
data = gz.read
return data
end
rescue => bang
puts bang
end
end
|