Class: Risu::Models::Reference

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/risu/models/reference.rb

Overview

Reference Model

Class Method Summary collapse

Class Method Details

.apple_saObject



215
216
217
# File 'lib/risu/models/reference.rb', line 215

def apple_sa
	where(:reference_name => "apple-sa").select('DISTINCT value')
end

.bidObject

Queries all unique BID



83
84
85
# File 'lib/risu/models/reference.rb', line 83

def bid
	where(:reference_name => "bid").select('DISTINCT value')
end

.certObject

Queries all unique cert refs



113
114
115
# File 'lib/risu/models/reference.rb', line 113

def cert
	where(:reference_name => "cert").select('DISTINCT value')
end

.cert_ccObject



209
210
211
# File 'lib/risu/models/reference.rb', line 209

def cert_cc
	where(:reference_name => "cert-cc").select('DISTINCT value')
end

.cert_vuObject



197
198
199
# File 'lib/risu/models/reference.rb', line 197

def cert_vu
	where(:reference_name => "cert-vu").select('DISTINCT value')
end

.cisco_bug_idObject



185
186
187
# File 'lib/risu/models/reference.rb', line 185

def cisco_bug_id
	where(:reference_name => "cisco-bug-id").select('DISTINCT value')
end

.cisco_saObject



173
174
175
# File 'lib/risu/models/reference.rb', line 173

def cisco_sa
	where(:reference_name => "cisco-sa").select('DISTINCT value')
end

.cisco_srObject



191
192
193
# File 'lib/risu/models/reference.rb', line 191

def cisco_sr
	where(:reference_name => "cisco-sr").select('DISTINCT value')
end

.cpeObject

Queries all unique CPE



77
78
79
# File 'lib/risu/models/reference.rb', line 77

def cpe
	where(:reference_name => "cpe").select('DISTINCT value')
end

.cveObject

Queries all unique CVEs



71
72
73
# File 'lib/risu/models/reference.rb', line 71

def cve
	where(:reference_name => "cve").select('DISTINCT value')
end

.cweObject

Queries all unique cwe refs



155
156
157
# File 'lib/risu/models/reference.rb', line 155

def cwe
	where(:reference_name => "cwe").select('DISTINCT value')
end

.dsaObject

Queries all unique dsa refs



143
144
145
# File 'lib/risu/models/reference.rb', line 143

def dsa
	where(:reference_name => "dsa").select('DISTINCT value')
end

.edbidObject

Queries all unique edbid refs



119
120
121
# File 'lib/risu/models/reference.rb', line 119

def edbid
	where(:reference_name => "edb-id").select('DISTINCT value')
end

.iavaObject

Queries all unique IAVA



95
96
97
# File 'lib/risu/models/reference.rb', line 95

def iava
	where(:reference_name => "iava").select('DISTINCT value')
end

.iavbObject



161
162
163
# File 'lib/risu/models/reference.rb', line 161

def iavb
	where(:reference_name => "iavb").select('DISTINCT value')
end

.iavtObject



167
168
169
# File 'lib/risu/models/reference.rb', line 167

def iavt
	where(:reference_name => "iavt").select('DISTINCT value')
end

.ics_alertObject



179
180
181
# File 'lib/risu/models/reference.rb', line 179

def ics_alert
	where(:reference_name => "ics-alert").select('DISTINCT value')
end

.icsaObject



221
222
223
# File 'lib/risu/models/reference.rb', line 221

def icsa
	where(:reference_name => "icsa").select('DISTINCT value')
end

.msftObject

Queries all unique MSFT



101
102
103
# File 'lib/risu/models/reference.rb', line 101

def msft
	where(:reference_name => "msft").select('DISTINCT value')
end

.msvrObject



227
228
229
# File 'lib/risu/models/reference.rb', line 227

def msvr
	where(:reference_name => "msvr").select('DISTINCT value')
end

.osvdbObject

Queries all unique OSvdb



107
108
109
# File 'lib/risu/models/reference.rb', line 107

def osvdb
	where(:reference_name => "osvdb").select('DISTINCT value')
end

.owaspObject

Queries all unique owasp refs



149
150
151
# File 'lib/risu/models/reference.rb', line 149

def owasp
	where(:reference_name => "owasp").select('DISTINCT value')
end

.reference_stringObject

Generates a full string of all the references direct output to the report



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/risu/models/reference.rb', line 36

def reference_string
	reference_names = ["cve", "cpe", "bid", "see_also", "iava", "msft",
		"osvdb", "cert", "edbid", "rhsa", "secunia", "suse", "dsa",
		"owasp", "cwe", "iavb", "iavt", "cisco_sa", "ics_alert",
		"cisco_bug_id", "cisco_sr", "cert_vu", "vmsa", "cert_cc",
		"msvr", "apple_sa", "icsa"
	]

	ref_string = ""

	reference_names.each do |type|
		ref = reference_string_by self.send(type)

		ref_string << "<b>#{type}</b>: #{ref}\n" if ref.length != 0
	end

	ref_string
end

.reference_string_by(type) ⇒ String

Generates a string of all the references of the specified type

Parameters:

  • type

    Result of a [Reference] model reference accessors

Returns:

  • (String)

    containing all references of type comma separated



60
61
62
63
64
65
66
67
# File 'lib/risu/models/reference.rb', line 60

def reference_string_by type
	rstring = []
	type.each do |ref|
		rstring << ref.value
	end

	rstring.join(", ")
end

.rhsaObject

Queries all unique rhsa refs



125
126
127
# File 'lib/risu/models/reference.rb', line 125

def rhsa
	where(:reference_name => "rhsa").select('DISTINCT value')
end

.secuniaObject

Queries all unique secunia refs



131
132
133
# File 'lib/risu/models/reference.rb', line 131

def secunia
	where(:reference_name => "secunia").select('DISTINCT value')
end

.see_alsoObject

Queries all unique see_also



89
90
91
# File 'lib/risu/models/reference.rb', line 89

def see_also
	where(:reference_name => "see_also").select('DISTINCT value')
end

.suseObject

Queries all unique suse refs



137
138
139
# File 'lib/risu/models/reference.rb', line 137

def suse
	where(:reference_name => "suse").select('DISTINCT value')
end

.usnObject



233
234
235
# File 'lib/risu/models/reference.rb', line 233

def usn
	where(:reference_name => "usn").select('DISTINCT value')
end

.vmsaObject



203
204
205
# File 'lib/risu/models/reference.rb', line 203

def vmsa
	where(:reference_name => "vmsa").select('DISTINCT value')
end