mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-21 11:18:06 +00:00
Configuration changes
Pulled System.rb out to individual classes.
This commit is contained in:
3
lib/objects/base_box.rb
Normal file
3
lib/objects/base_box.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class Basebox
|
||||
attr_accessor :name, :os, :distro, :vagrantbase, :url
|
||||
end
|
||||
24
lib/objects/network.rb
Normal file
24
lib/objects/network.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
class Network
|
||||
attr_accessor :name, :range
|
||||
|
||||
def initialize(name="", range="")
|
||||
@name = name
|
||||
@range = range
|
||||
end
|
||||
|
||||
def id
|
||||
hash = @name + @range
|
||||
return hash
|
||||
# return string that connects everything to 1 massive string
|
||||
end
|
||||
|
||||
def eql? other
|
||||
# checks if name matches networks.xml from scenario.xml
|
||||
other.kind_of?(self.class) && @name == other.name
|
||||
end
|
||||
|
||||
def hash
|
||||
@type.hash
|
||||
end
|
||||
|
||||
end
|
||||
22
lib/objects/service.rb
Normal file
22
lib/objects/service.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class Service
|
||||
attr_accessor :name, :type, :details, :puppets
|
||||
|
||||
def initialize(name="", type="", details="", puppets=[])
|
||||
@name = name
|
||||
@type = type
|
||||
@details = details
|
||||
@puppets = puppets
|
||||
end
|
||||
|
||||
def eql? other
|
||||
other.kind_of?(self.class) && @type == other.type
|
||||
end
|
||||
|
||||
def hash
|
||||
@type.hash
|
||||
end
|
||||
|
||||
def id
|
||||
return @type
|
||||
end
|
||||
end
|
||||
28
lib/objects/system.rb
Normal file
28
lib/objects/system.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class System
|
||||
# can access from outside of class
|
||||
attr_accessor :id, :os, :url,:basebox, :networks, :vulns, :services
|
||||
|
||||
#initalizes system variables
|
||||
def initialize(id, os, basebox, url, vulns=[], networks=[], services=[])
|
||||
@id = id
|
||||
@os = os
|
||||
@url = url
|
||||
@basebox = basebox
|
||||
@vulns = vulns
|
||||
@networks = networks
|
||||
@services = services
|
||||
end
|
||||
|
||||
def is_valid_base
|
||||
valid_base = Configuration.bases
|
||||
|
||||
valid_base.each do |b|
|
||||
if @basebox == b.vagrantbase
|
||||
@url = b.url
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
end
|
||||
@@ -3,11 +3,6 @@ require_relative('../constants.rb')
|
||||
class Vulnerability
|
||||
attr_accessor :type, :privilege, :access ,:puppets, :details, :ports, :name, :cve, :files, :scripts
|
||||
|
||||
def eql? other
|
||||
# checks if type matches vulns.xml from scenario.xml
|
||||
other.kind_of?(self.class) && @type == other.type
|
||||
end
|
||||
|
||||
def initialize(type='', privilege='', access='', puppets=[], details='', ports=[], platform ='', name='', cve='', files=[], scripts=[])
|
||||
@type = type
|
||||
@privilege = privilege
|
||||
@@ -22,6 +17,11 @@ class Vulnerability
|
||||
@scripts = scripts
|
||||
end
|
||||
|
||||
def eql? other
|
||||
# checks if type matches vulns.xml from scenario.xml
|
||||
other.kind_of?(self.class) && @type == other.type
|
||||
end
|
||||
|
||||
def id
|
||||
return @type + @privilege + @access
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user