Class: Arachni::UI::Web::Addons::Sample

Inherits:
Base show all
Defined in:
lib/arachni/ui/web/addons/sample.rb

Overview

Sample add-on, see the code for examples.

@author: Tasos “Zapotek” Laskos

<[email protected]>
<[email protected]>

@version: 0.1

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#adelete, #aget, #apost, #aput, #delete, #get, #initialize, #path_addon, #path_root, #path_views, #post, #put, #settings

Constructor Details

This class inherits a constructor from Arachni::UI::Web::Addons::Base

Class Method Details

.infoObject



63
64
65
66
67
68
69
70
# File 'lib/arachni/ui/web/addons/sample.rb', line 63

def self.info
    {
        :name           => 'Sample add-on',
        :description    => %q{This add-on serves as an example/tutorial.},
        :author         => 'Tasos "Zapotek" Laskos <[email protected]> ',
        :version        => '0.1'
    }
end

Instance Method Details

#runObject

This method gets fired when the plugin is loaded.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/arachni/ui/web/addons/sample.rb', line 33

def run

    #
    # You can work with get/post/put/delete handlers just like
    # when using Sinatra.
    #
    get '/' do

        #
        # From inside the block you have access to regular Sinatra stuff
        # like sessions, helpers etc.
        #

        # session   => Direct access to the session, *be careful!*.
        # settings  => Direct access to the Sinatra methods, attributes, etc.

        # You can treat 'present' just like 'erb' with a default layout.
        present :index, :msg => 'world'
    end

end

#titleObject

This optional method allows you to specify the title which will be used for the menu (in case you want it to be dynamic).



59
60
61
# File 'lib/arachni/ui/web/addons/sample.rb', line 59

def title
    'Sample'
end