The ImportController provides access to the different import plugins that have been deployed in the dradis server.

Each import plugin will include itself in the Plugins::Import module and this controller will include it so all the functionality provided by the different plugins is exposed.

For more information on import plugins see: dradisframework.org/import_plugins.html

Methods
Included Modules
Public Instance methods
filters()

For a given data source, list all the Filters exposed by the corresponding import plugin. Only supports JSON format.

    # File app/controllers/import_controller.rb, line 69
69:   def filters
70:     respond_to do |format|
71:       format.html{ redirect_to '/' }
72:       format.json{
73:         list = [
74:           {
75:             :display => 'This source does not define any filter',
76:             :value => 'invalid'
77:           }
78:         ]
79:         if (@source.constants.include?('Filters'))
80:           list.clear
81:           @source::Filters.constants.each do |filter_name|
82:             filter = "#{@source.name}::Filters::#{filter_name}".constantize 
83:             list << { 
84:               :display => "#{filter_name}: #{filter::NAME}", 
85:               :value => filter_name 
86:             }
87:           end
88:         end
89:         
90:         render :json => list
91:       }
92:     end
93:   end
query()

Run a query against the remote data source using a given filter. Only supports JSON format.

     # File app/controllers/import_controller.rb, line 97
 97:   def query
 98:     respond_to do |format|
 99:       format.html{ redirect_to '/' }
100:       format.json{
101:         render :json => @filter.run(params)
102:       }
103:     end
104:   end
sources()

Provide a list of the available remote data sources as configured by the different import plugins. Only supports JSON format.

    # File app/controllers/import_controller.rb, line 50
50:   def sources
51:     respond_to do |format|
52:       format.html{ redirect_to '/' }
53:       format.json{
54:         list = []
55:         Plugins::Import.included_modules.each do |plugin|
56:           list << { 
57:                     :display => "#{plugin::Meta::NAME} (#{plugin.name} #{plugin::Meta::VERSION::STRING})",
58:                     :value => plugin.name
59:                   }
60:         end
61:         render :json => list
62:       }
63:     end
64:   end