Module: Arachni::UI::CLI::Utilities
- Includes:
- Support::Mixins::Terminal, Arachni::Utilities
- Included in:
- OptionParser, RPC::Client::DispatcherMonitor, RPC::Client::Instance
- Defined in:
- ui/cli/utilities.rb
Instance Method Summary collapse
-
#list_checks(checks) ⇒ Object
Outputs all available checks and their info.
-
#list_platforms(platform_info) ⇒ Object
Outputs all available checks and their info.
-
#list_plugins(plugins) ⇒ Object
Outputs all available reports and their info.
-
#list_reporters(reports) ⇒ Object
Outputs all available reports and their info.
-
#load_profile(profile) ⇒ Object
Loads an Arachni Framework Profile file and merges it with the user supplied options.
-
#print_banner ⇒ Object
Outputs Arachni banner.
- #print_issues(issues, unmute = false, &interceptor) ⇒ Object
-
#save_profile(filename) ⇒ Object
Saves options to an Arachni Framework Profile file.
Methods included from Support::Mixins::Terminal
#clear_screen, #empty_screen, #flush, #move_to_home, #reprint, #reputs, #restr
Methods included from Arachni::Utilities
#available_port, available_port_mutex, #bytes_to_kilobytes, #bytes_to_megabytes, #caller_name, #caller_path, #cookie_decode, #cookie_encode, #cookies_from_file, #cookies_from_parser, #cookies_from_response, #exception_jail, #exclude_path?, #follow_protocol?, #form_decode, #form_encode, #forms_from_parser, #forms_from_response, #full_and_absolute_url?, #generate_token, #get_path, #hms_to_seconds, #html_decode, #html_encode, #include_path?, #links_from_parser, #links_from_response, #normalize_url, #page_from_response, #page_from_url, #parse_set_cookie, #path_in_domain?, #path_too_deep?, #port_available?, #rand_port, #random_seed, #redundant_path?, #regexp_array_match, #remove_constants, #request_parse_body, #seconds_to_hms, #skip_page?, #skip_path?, #skip_resource?, #skip_response?, #to_absolute, #uri_decode, #uri_encode, #uri_parse, #uri_parse_query, #uri_parser, #uri_rewrite
Instance Method Details
#list_checks(checks) ⇒ Object
Outputs all available checks and their info.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'ui/cli/utilities.rb', line 73 def list_checks( checks ) print_line print_line print_info 'Available checks:' print_line checks.each do |info| print_status "#{info[:shortname]}:" print_line '--------------------' print_line "Name:\t\t#{info[:name]}" print_line "Description:\t\n#{info[:description].strip}\n\n" if info[:issue] && (severity = info[:issue][:severity]) print_line "Severity:\t#{severity.to_s.capitalize}" end if info[:elements] && info[:elements].size > 0 print_line "Elements:\t#{info[:elements].map(&:type).join( ', ' )}" end print_line "Author:\t\t#{info[:author].join( ', ' )}" print_line "Version:\t#{info[:version]}" if info[:references] print_line 'References:' info[:references].keys.each do |key| print_info "#{key}\t\t#{info[:references][key]}" end end if info[:targets] print_line 'Targets:' if info[:targets].is_a?( Hash ) info[:targets].keys.each do |key| print_info "#{key}\t\t#{info[:targets][key]}" end else info[:targets].each { |target| print_info( target ) } end end print_line "Path:\t#{info[:path]}" print_line end end |
#list_platforms(platform_info) ⇒ Object
Outputs all available checks and their info.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'ui/cli/utilities.rb', line 54 def list_platforms( platform_info ) print_line print_line print_info 'Available platforms:' print_line platform_info.each do |type, platforms| print_status "#{type}" platforms.each do |shortname, fullname| print_info "#{shortname}:\t\t#{fullname}" end print_line end end |
#list_plugins(plugins) ⇒ Object
Outputs all available reports and their info.
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'ui/cli/utilities.rb', line 161 def list_plugins( plugins ) print_line print_line print_info 'Available plugins:' print_line plugins.each do |info| print_status "#{info[:shortname]}:" print_line '--------------------' print_line "Name:\t\t#{info[:name]}" print_line "Description:\t\n#{info[:description].strip}\n\n" if info[:options] && !info[:options].empty? print_line "Options:\t" info[:options].each do |option| option = option.is_a?( Hash ) ? option : option.to_h print_info "\t#{option[:name]} - #{option[:description]}" print_info "\tType: #{option[:type]}" if option[:choices] print_info "\tChoices: #{option[:choices].join(', ')}" end print_info "\tDefault: #{option[:default]}" print_info "\tRequired?: #{option[:required]}" print_line end end print_line "Author:\t\t#{info[:author].join( ', ' )}" print_line "Version:\t#{info[:version]}" print_line "Path:\t#{info[:path]}" print_line end end |
#list_reporters(reports) ⇒ Object
Outputs all available reports and their info.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'ui/cli/utilities.rb', line 124 def list_reporters( reports ) print_line print_line print_info 'Available reports:' print_line reports.each do |info| print_status "#{info[:shortname]}:" print_line '--------------------' print_line "Name:\t\t#{info[:name]}" print_line "Description:\t\n#{info[:description].strip}\n\n" if info[:options] && !info[:options].empty? print_line( "Options:\t" ) info[:options].each do |option| option = option.is_a?( Hash ) ? option : option.to_h print_info "\t#{option[:name]} - #{option[:description]}" print_info "\tType: #{option[:type]}" print_info "\tDefault: #{option[:default]}" print_info "\tRequired?: #{option[:required]}" print_line end end print_line "Author:\t\t#{info[:author].join( ", " )}" print_line "Version:\t#{info[:version] }" print_line "Path:\t#{info[:path]}" print_line end end |
#load_profile(profile) ⇒ Object
Loads an Arachni Framework Profile file and merges it with the user supplied options.
204 205 206 207 208 |
# File 'ui/cli/utilities.rb', line 204 def load_profile( profile ) exception_jail do Arachni::Options.load( profile ) end end |
#print_banner ⇒ Object
Outputs Arachni banner. Displays version number, author details etc.
228 229 230 231 232 |
# File 'ui/cli/utilities.rb', line 228 def puts BANNER puts puts end |
#print_issues(issues, unmute = false, &interceptor) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'ui/cli/utilities.rb', line 21 def print_issues( issues, unmute = false, &interceptor ) issues = issues.sort_by { |i| [i.severity, i.name]}.reverse interceptor ||= proc { |s| s } print_line( interceptor.call, unmute ) print_info( interceptor.call( "#{issues.size} issues have been detected." ), unmute ) print_line( interceptor.call, unmute ) issue_cnt = issues.size issues.each.with_index do |issue, i| meth = input = '' if issue.active? input = " input `#{issue.affected_input_name}`" meth = " using #{issue.vector.method.to_s.upcase}" elsif issue.vector.respond_to?( :inputs ) input = " with inputs `#{issue.vector.inputs.keys.join(', ')}`" end cnt = "#{i + 1} |".rjust( issue_cnt.to_s.size + 2 ) print_ok( interceptor.call( "#{cnt} #{issue.name} at #{issue.vector.action} in" + " #{issue.vector.type}#{input}#{meth}." ), unmute ) end print_line( interceptor.call, unmute ) end |
#save_profile(filename) ⇒ Object
Saves options to an Arachni Framework Profile file.
213 214 215 216 217 218 219 220 221 222 |
# File 'ui/cli/utilities.rb', line 213 def save_profile( filename ) if (filename = Arachni::Options.save( filename )) print_status "Saved profile in '#{filename}'." print_line else print_error 'Could not save profile.' exit 0 end end |