Class: Arachni::Parser::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/arachni/parser/page.rb

Overview

@version: 0.2.2

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Page

Returns a new instance of Page.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/arachni/parser/page.rb', line 99

def initialize( opts = {} )

    @forms = []
    @links = []
    @cookies = []
    @headers = []

    @cookiejar = {}
    @paths = []

    @response_headers = {}
    @query_vars       = {}

    opts.each {
        |k, v|
        send( "#{k}=", v )
    }
end

Instance Attribute Details

#codeFixnum

Returns the HTTP response code.

Returns:

  • (Fixnum)

    the HTTP response code



34
35
36
# File 'lib/arachni/parser/page.rb', line 34

def code
  @code
end

#cookiejarHash

Cookies extracted from the supplied cookiejar

Returns:

  • (Hash)


91
92
93
# File 'lib/arachni/parser/page.rb', line 91

def cookiejar
  @cookiejar
end

#cookiesArray<Arachni::Parser::Element::Cookie>



84
85
86
# File 'lib/arachni/parser/page.rb', line 84

def cookies
  @cookies
end

#formsArray<Arachni::Parser::Element::Form>



77
78
79
# File 'lib/arachni/parser/page.rb', line 77

def forms
  @forms
end

#headersArray<Arachni::Parser::Element::Header>

Request headers



56
57
58
# File 'lib/arachni/parser/page.rb', line 56

def headers
  @headers
end

#htmlString

Returns the HTML response.

Returns:

  • (String)

    the HTML response



49
50
51
# File 'lib/arachni/parser/page.rb', line 49

def html
  @html
end


70
71
72
# File 'lib/arachni/parser/page.rb', line 70

def links
  @links
end

#methodString

Returns the request method that returned the page.

Returns:

  • (String)

    the request method that returned the page



39
40
41
# File 'lib/arachni/parser/page.rb', line 39

def method
  @method
end

#pathsObject

Returns the value of attribute paths.



63
64
65
# File 'lib/arachni/parser/page.rb', line 63

def paths
  @paths
end

#query_varsHash

Returns url variables.

Returns:

  • (Hash)

    url variables



44
45
46
# File 'lib/arachni/parser/page.rb', line 44

def query_vars
  @query_vars
end

#response_headersHash

Returns:

  • (Hash)


61
62
63
# File 'lib/arachni/parser/page.rb', line 61

def response_headers
  @response_headers
end

#urlString

Returns url of the page.

Returns:

  • (String)

    url of the page



29
30
31
# File 'lib/arachni/parser/page.rb', line 29

def url
  @url
end

Class Method Details

.from_http_response(res, opts) ⇒ Object



93
94
95
96
97
# File 'lib/arachni/parser/page.rb', line 93

def self.from_http_response( res, opts )
    page = Arachni::Parser.new( opts, res ).run
    page.url = Arachni::Module::Utilities.url_sanitize( res.effective_url )
    return page
end

Instance Method Details

#bodyObject



118
119
120
# File 'lib/arachni/parser/page.rb', line 118

def body
    @html
end

#cookies_simpleHash

Returns cookies from #cookies as a name=>value hash

Returns:

  • (Hash)

    the cookie attributes, values, etc



156
157
158
159
160
161
162
163
164
# File 'lib/arachni/parser/page.rb', line 156

def cookies_simple
    cookies = { }

    @cookies.each {
        |cookie|
        cookies.merge!( cookie.simple )
    }
    return cookies
end

#forms_simpleArray

Returns an array of forms from #forms with its attributes and<br/> its auditable inputs as a name=>value hash

Returns:



128
129
130
131
132
133
134
135
# File 'lib/arachni/parser/page.rb', line 128

def forms_simple( )
    forms = []
    @forms.each {
        |form|
        forms << form.simple
    }
    return forms
end

Returns links from #links as a name=>value hash with href as key

Returns:

  • (Hash)


142
143
144
145
146
147
148
149
# File 'lib/arachni/parser/page.rb', line 142

def links_simple
    links = []
    @links.each {
        |link|
        links << link.simple
    }
    return links
end