Module: Risu::Templates::ScanHelper

Included in:
TemplateHelper
Defined in:
lib/risu/base/scan_helper.rb

Instance Method Summary collapse

Instance Method Details

#authenticated_countObject

TODO doc



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/risu/base/scan_helper.rb', line 50

def authenticated_count
	count = {}
	count["auth"] = 0
	count["unauth"] = 0

	Item.where(:plugin_id => 19506).each do |item|
		scan_info = scan_info_to_hash (item.plugin_output)

		auth = scan_info["credentialed_checks"]

		if auth =~ /yes/
			count["auth"] = count["auth"] + 1
		else
			count["unauth"] = count["unauth"] + 1
		end
	end

	return count
end

#scan_info_to_hash(plugin_output) ⇒ Object

TODO doc



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/risu/base/scan_helper.rb', line 27

def scan_info_to_hash plugin_output
	scan_info = {}

	plugin_output.split("\n").each do |line|
		a = line.split(":")

		if a.size != 2
			next
		end

		key = a[0].strip.downcase
		value = a[1].strip.downcase

		key = key.gsub(" ", "_")

		scan_info[key] = value
	end

	return scan_info
end