=begin Arachni Copyright (c) 2010-2012 Tasos "Zapotek" Laskos This is free software; you can copy and distribute and modify this program under the term of the GPL v2.0 License (See LICENSE file for details) =end require 'base64' module Arachni module Reports module Buffer require 'cgi' def append( str ) __add( str, true ) end def simple_tag( tag, text, no_escape = false ) start_tag( tag ) __add( text, no_escape ) end_tag( tag ) end def start_tag( tag ) __buffer( "\n<#{tag}>" ) end def end_tag( tag ) __buffer( "\n" ) end def add_cookie( name, value ) __buffer( "" ) end def add_credentials( username, password ) __buffer( "" ) end def add_reference( name, url ) __buffer( "" ) end def add_param( name, value ) __buffer( "" ) end def add_mod( name ) __buffer( "" ) end def add_headers( type, headers ) start_tag( type ) headers.each_pair { |name, value| if name.downcase == 'set-cookie' && value.is_a?( Array ) __buffer( "" ) else __buffer( "" ) end } end_tag( type ) end def add_tags( tags ) start_tag( 'tags' ) tags.each { |name| __buffer( "" ) } end_tag( 'tags' ) end def buffer return @__buffer end def __buffer( str = '' ) @__buffer ||= '' @__buffer += str end def __add( text, no_escape = false ) if !no_escape __buffer( CGI.escapeHTML( text ) ) else __buffer( text ) end end end end end