Vulnerability::Output specs
This commit is contained in:
@@ -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(/^\//, '')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -13,6 +13,7 @@ class WpVersion < WpItem
|
||||
# The version number
|
||||
attr_accessor :number
|
||||
|
||||
# @return [ Array ]
|
||||
def allowed_options; super << :number << :found_from end
|
||||
|
||||
end
|
||||
|
||||
28
spec/lib/common/models/vulnerability/output_spec.rb
Normal file
28
spec/lib/common/models/vulnerability/output_spec.rb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user