Module: Arachni::Framework::Parts::Data

Included in:
Arachni::Framework
Defined in:
lib/arachni/framework/parts/data.rb

Overview

Provides access to Data::Framework and helpers.

Author:

Instance Method Summary collapse

Instance Method Details

#dataData::Framework

Returns:



19
20
21
# File 'lib/arachni/framework/parts/data.rb', line 19

def data
    Arachni::Data.framework
end

#page_queue_total_sizeInteger

Returns Total number of pages added to the page audit queue.

Returns:



74
75
76
# File 'lib/arachni/framework/parts/data.rb', line 74

def page_queue_total_size
    data.page_queue_total_size
end

#push_to_page_queue(page, force = false) ⇒ Bool

Returns true if push was successful, false if the page matched any exclusion criteria or has already been seen.

Parameters:

Returns:

  • (Bool)

    true if push was successful, false if the page matched any exclusion criteria or has already been seen.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/arachni/framework/parts/data.rb', line 29

def push_to_page_queue( page, force = false )
    return false if !force && (!accepts_more_pages? ||
        state.page_seen?( page ) || page.scope.out? ||
        page.scope.redundant?( true ))

    # We want to update from the already loaded page cache (if there is one)
    # as we have to store the page anyways (needs to go through Browser analysis)
    # and it's not worth the resources to parse its elements.
    #
    # We're basically doing this to give the Browser and Trainer a better
    # view of what elements have been seen, so that they won't feed us pages
    # with elements that they think are new, but have been provided to us by
    # some other component; however, it wouldn't be the end of the world if
    # that were to happen.
    ElementFilter.update_from_page_cache page
    page.clear_cache

    data.push_to_page_queue page
    state.page_seen page

    true
end

#push_to_url_queue(url, force = false) ⇒ Bool

Returns true if push was successful, false if the url matched any exclusion criteria or has already been seen.

Parameters:

Returns:

  • (Bool)

    true if push was successful, false if the url matched any exclusion criteria or has already been seen.



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/arachni/framework/parts/data.rb', line 58

def push_to_url_queue( url, force = false )
    return if !force && !accepts_more_pages?

    url = to_absolute( url ) || url
    if state.url_seen?( url ) || skip_path?( url ) || redundant_path?( url, true )
        return false
    end

    data.push_to_url_queue url
    state.url_seen url

    true
end

#sitemapHash<String, Integer>

Returns List of crawled URLs with their HTTP codes.

Returns:

  • (Hash<String, Integer>)

    List of crawled URLs with their HTTP codes.



86
87
88
# File 'lib/arachni/framework/parts/data.rb', line 86

def sitemap
    data.sitemap
end

#url_queue_total_sizeInteger

Returns Total number of URLs added to the URL audit queue.

Returns:



80
81
82
# File 'lib/arachni/framework/parts/data.rb', line 80

def url_queue_total_size
    data.url_queue_total_size
end