Vulnerability::Output specs
This commit is contained in:
@@ -15,6 +15,7 @@ class Vulnerability
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @return [ String ] The url to the metasploit module page
|
||||||
def self.metasploit_module_url(module_path)
|
def self.metasploit_module_url(module_path)
|
||||||
# remove leading slash
|
# remove leading slash
|
||||||
module_path = module_path.sub(/^\//, '')
|
module_path = module_path.sub(/^\//, '')
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ class WpItem
|
|||||||
attr_reader :path
|
attr_reader :path
|
||||||
attr_accessor :name, :wp_content_dir, :wp_plugins_dir
|
attr_accessor :name, :wp_content_dir, :wp_plugins_dir
|
||||||
|
|
||||||
|
# @return [ Array ]
|
||||||
|
# Make it private ?
|
||||||
def allowed_options
|
def allowed_options
|
||||||
[:name, :wp_content_dir, :wp_plugins_dir, :path, :version, :vulns_file]
|
[:name, :wp_content_dir, :wp_plugins_dir, :path, :version, :vulns_file]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class WpUser < WpItem
|
|||||||
|
|
||||||
def allowed_options; [:id, :login, :display_name, :password] end
|
def allowed_options; [:id, :login, :display_name, :password] end
|
||||||
|
|
||||||
|
# @return [ URI ] The uri to the auhor page
|
||||||
def uri
|
def uri
|
||||||
if id
|
if id
|
||||||
return @uri.merge("?author=#{id}")
|
return @uri.merge("?author=#{id}")
|
||||||
@@ -17,14 +18,17 @@ class WpUser < WpItem
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @param [ Wpuser ] other
|
||||||
def <=>(other)
|
def <=>(other)
|
||||||
id <=> other.id
|
id <=> other.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @param [ WpUser ] other
|
||||||
def ==(other)
|
def ==(other)
|
||||||
self === other
|
self === other
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @param [ WpUser ] other
|
||||||
def ===(other)
|
def ===(other)
|
||||||
id === other.id && login === other.login
|
id === other.id && login === other.login
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class WpVersion < WpItem
|
|||||||
# The version number
|
# The version number
|
||||||
attr_accessor :number
|
attr_accessor :number
|
||||||
|
|
||||||
|
# @return [ Array ]
|
||||||
def allowed_options; super << :number << :found_from end
|
def allowed_options; super << :number << :found_from end
|
||||||
|
|
||||||
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