diff --git a/lib/common/models/vulnerability/output.rb b/lib/common/models/vulnerability/output.rb index 0d1d5270..fb7385a3 100644 --- a/lib/common/models/vulnerability/output.rb +++ b/lib/common/models/vulnerability/output.rb @@ -15,6 +15,7 @@ class Vulnerability end end + # @return [ String ] The url to the metasploit module page def self.metasploit_module_url(module_path) # remove leading slash module_path = module_path.sub(/^\//, '') diff --git a/lib/common/models/wp_item.rb b/lib/common/models/wp_item.rb index 9525ee22..81f00691 100755 --- a/lib/common/models/wp_item.rb +++ b/lib/common/models/wp_item.rb @@ -19,6 +19,8 @@ class WpItem attr_reader :path attr_accessor :name, :wp_content_dir, :wp_plugins_dir + # @return [ Array ] + # Make it private ? def allowed_options [:name, :wp_content_dir, :wp_plugins_dir, :path, :version, :vulns_file] end diff --git a/lib/common/models/wp_user.rb b/lib/common/models/wp_user.rb index 467cca9a..fe14e7b5 100755 --- a/lib/common/models/wp_user.rb +++ b/lib/common/models/wp_user.rb @@ -9,6 +9,7 @@ class WpUser < WpItem def allowed_options; [:id, :login, :display_name, :password] end + # @return [ URI ] The uri to the auhor page def uri if id return @uri.merge("?author=#{id}") @@ -17,14 +18,17 @@ class WpUser < WpItem end end + # @param [ Wpuser ] other def <=>(other) id <=> other.id end + # @param [ WpUser ] other def ==(other) self === other end + # @param [ WpUser ] other def ===(other) id === other.id && login === other.login end diff --git a/lib/common/models/wp_version.rb b/lib/common/models/wp_version.rb index 65bde522..75023e81 100755 --- a/lib/common/models/wp_version.rb +++ b/lib/common/models/wp_version.rb @@ -13,6 +13,7 @@ class WpVersion < WpItem # The version number attr_accessor :number + # @return [ Array ] def allowed_options; super << :number << :found_from end end diff --git a/spec/lib/common/models/vulnerability/output_spec.rb b/spec/lib/common/models/vulnerability/output_spec.rb new file mode 100644 index 00000000..ad92af62 --- /dev/null +++ b/spec/lib/common/models/vulnerability/output_spec.rb @@ -0,0 +1,28 @@ +# encoding: UTF-8 + +require 'spec_helper' + +describe Vulnerability::Output do + let(:modules_url) { 'http://www.metasploit.com/modules/' } + + describe '::metasploit_module_url' do + after :each do + Vulnerability::Output.metasploit_module_url(@module).should == @expected + end + + it 'removes the leading slash' do + @module = '/exploit/testing' + @expected = modules_url + 'exploit/testing' + end + + it 'returns the correct url' do + @module = 'gathering/yolo' + @expected = modules_url + @module + end + end + + describe '#output' do + # How to test it ? oO + end + +end