Method: Arachni::Page::DOM#print_transitions

Defined in:
lib/arachni/page/dom.rb


101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/arachni/page/dom.rb', line 101

def print_transitions( printer, indent = '' )
    longest_event_size = 0
    page.dom.transitions.each do |t|
        longest_event_size = [t.event.to_s.size, longest_event_size].max
    end

    page.dom.transitions.map do |t|
        padding = longest_event_size - t.event.to_s.size + 1
        time    = sprintf( '%.4f', t.time.to_f )

        if t.event == :request
            printer.call "#{indent * 2}* [#{time}s] #{t.event}#{' ' * padding} => #{t.element}"
        else
            url = nil
            if t.options[:url]
                url = "(#{t.options[:url]})"
            end

            printer.call "#{indent}-- [#{time}s] #{t.event}#{' ' * padding} => #{t.element} #{url}"

            if t.options[:cookies] && t.options[:cookies].any?
                printer.call "#{indent * 2}-- Cookies:"

                t.options[:cookies].each do |name, value|
                    printer.call  "#{indent * 3}* #{name}\t=> #{value}\n"
                end
            end

            if t.options[:inputs] && t.options[:inputs].any?
                t.options[:inputs].each do |name, value|
                    printer.call  "#{indent * 2}* #{name}\t=> #{value}\n"
                end
            end
        end
    end
end