risu 1.4.9 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.ci +18 -0
- data/LICENSE +3 -3
- data/NEWS.markdown +45 -0
- data/README.markdown +10 -2
- data/Rakefile +15 -5
- data/TODO.markdown +45 -19
- data/lib/risu.rb +2 -1
- data/lib/risu/base/schema.rb +3 -4
- data/lib/risu/base/template_base.rb +11 -11
- data/lib/risu/cli/application.rb +23 -15
- data/lib/risu/exceptions.rb +1 -3
- data/lib/risu/models/host.rb +1 -1
- data/lib/risu/models/item.rb +90 -18
- data/lib/risu/models/plugin.rb +2 -2
- data/lib/risu/models/reference.rb +93 -0
- data/lib/risu/parsers/nessus/nessus_sax_listener.rb +28 -30
- data/lib/risu/renderers.rb +6 -0
- data/lib/risu/renderers/nilrenderer.rb +25 -0
- data/lib/risu/templates/assets.rb +5 -2
- data/lib/risu/templates/cover_sheet.rb +1 -1
- data/lib/risu/templates/exec_summary.rb +19 -4
- data/lib/risu/templates/executive_summary.rb +20 -5
- data/lib/risu/templates/finding_statistics.rb +1 -1
- data/lib/risu/templates/findings_host.rb +27 -8
- data/lib/risu/templates/findings_summary.rb +14 -1
- data/lib/risu/templates/findings_summary_with_pluginid.rb +1 -1
- data/lib/risu/templates/graphs.rb +5 -1
- data/lib/risu/templates/host_summary.rb +8 -4
- data/lib/risu/templates/ms_patch_summary.rb +1 -1
- data/lib/risu/templates/ms_update_summary.rb +1 -1
- data/lib/risu/templates/notable.rb +1 -2
- data/lib/risu/templates/notable_detailed.rb +8 -8
- data/lib/risu/templates/pci_compliance.rb +1 -1
- data/lib/risu/templates/stig_findings_summary.rb +135 -0
- data/lib/risu/templates/technical_findings.rb +5 -17
- data/lib/risu/templates/template.rb +1 -1
- data/risu.gemspec +1 -2
- metadata +43 -28
data/Gemfile.ci
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source :rubygems
|
2
|
+
source "http://rubygems.org"
|
3
|
+
source :rubyforge
|
4
|
+
source "http://gems.rubyforge.org"
|
5
|
+
|
6
|
+
gem "rails"
|
7
|
+
gem "libxml-ruby"
|
8
|
+
gem "prawn"
|
9
|
+
gem "gruff"
|
10
|
+
gem "mysql"
|
11
|
+
gem "rmagick"
|
12
|
+
gem "sqlite3"
|
13
|
+
gem "simplecov"
|
14
|
+
|
15
|
+
gem "rspec", "2.8.0"
|
16
|
+
gem "machinist", "1.0.6"
|
17
|
+
gem "sham", "1.0.2"
|
18
|
+
gem "faker", "1.0.1"
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2010-2012 Jacob Hammack,
|
1
|
+
Copyright (c) 2010-2012 Jacob Hammack, Arxopia LLC
|
2
2
|
All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without
|
@@ -9,14 +9,14 @@ modification, are permitted provided that the following conditions are met:
|
|
9
9
|
* Redistributions in binary form must reproduce the above copyright
|
10
10
|
notice, this list of conditions and the following disclaimer in the
|
11
11
|
documentation and/or other materials provided with the distribution.
|
12
|
-
* Neither the name of the Jacob Hammack or
|
12
|
+
* Neither the name of the Jacob Hammack or Arxopia LLC nor the
|
13
13
|
names of its contributors may be used to endorse or promote products
|
14
14
|
derived from this software without specific prior written permission.
|
15
15
|
|
16
16
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
17
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
18
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
-
DISCLAIMED. IN NO EVENT SHALL JACOB HAMMACK or
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL JACOB HAMMACK or Arxopia LLC BE LIABLE FOR ANY
|
20
20
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21
21
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
22
22
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
data/NEWS.markdown
CHANGED
@@ -1,5 +1,50 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
#1.5.0 (February 20, 2012)
|
4
|
+
- Updated the Item model to be compatible with Nessus 5.0
|
5
|
+
- Added critical_risks()
|
6
|
+
- Added critical_risks_unique()
|
7
|
+
- Added critical to the Risks by Severity Graph
|
8
|
+
- Everything that used High as its data now uses Critical
|
9
|
+
- The new methods also have associated tests.
|
10
|
+
- Updated the Plugin model to be compatible with Nessus 5.0
|
11
|
+
- Added critical_risks()
|
12
|
+
- Added New tags
|
13
|
+
- Plugin Model
|
14
|
+
- fname
|
15
|
+
- Item Model
|
16
|
+
- plugin_name (Not all plugins seem to support this XML struct yet, maybe nil at times; might add a fix up post processing like ips)
|
17
|
+
- Added new Methods to the Reference class for accessing references easier
|
18
|
+
- cve
|
19
|
+
- cpe
|
20
|
+
- cwe
|
21
|
+
- iava
|
22
|
+
- msft
|
23
|
+
- osvdb
|
24
|
+
- owasp
|
25
|
+
- cert
|
26
|
+
- edb_id
|
27
|
+
- rhsa
|
28
|
+
- secunia
|
29
|
+
- suse
|
30
|
+
- Added new methods to the Item class
|
31
|
+
- stigs_severity_graph()
|
32
|
+
- stig_findings()
|
33
|
+
- all_risks_unique_sorted() from [aeriff] on github
|
34
|
+
- New Templates
|
35
|
+
- stig_findings_summary - Quick summary of all the stig related findings by severity
|
36
|
+
- Template Updates
|
37
|
+
- technical_findings - Added critical risks
|
38
|
+
- exec_summary - added critical risks and a stig graph
|
39
|
+
- findings_host - added critical and lowered the font sizes a bunch
|
40
|
+
- notable_detailed - added critical and changed header to Notable
|
41
|
+
- exec_summary_detailed - added critical risks
|
42
|
+
- host_summary - added critical risks
|
43
|
+
- graphs - added stig graph
|
44
|
+
- host_summary - added critical risks and page numbers
|
45
|
+
- Misc changes in other templates
|
46
|
+
- Added test::unit tests for most of the specs
|
47
|
+
|
3
48
|
#1.4.9 (January 23, 2012)
|
4
49
|
- Added a simple notable vulnerability template table report
|
5
50
|
- Added a detailed notable vulnerability template like the technical_findings report just limited to the top vulnerabilities up to 10
|
data/README.markdown
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Risu is [Nessus](http://www.nessus.org) parser, that converts the generated reports into a [ActiveRecord](http://api.rubyonrails.org/classes/ActiveRecord/Base.html) database, this allows for easy report generation and vulnerability verification.
|
4
4
|
|
5
|
-
Version 1.
|
5
|
+
Version 1.5.0 is the current release.
|
6
6
|
|
7
7
|
## Requirements
|
8
8
|
|
@@ -74,7 +74,7 @@ Using the risu Console is just like using Rails. You can access all of the Activ
|
|
74
74
|
|_| |_|___/\__,_|
|
75
75
|
|
76
76
|
|
77
|
-
risu Console v1.
|
77
|
+
risu Console v1.5.0
|
78
78
|
>> Host.first
|
79
79
|
=> #<Risu::Models::Host id: 1, report_id: 1, name: "10.69.69.74", os: "Linux Kernel 2.6 on Debian 4.0 (etch)", mac: "XX:XX:XX:XX:XX:XX", start: "2011-04-20 16:29:37", end: "2011-04-20 16:32:14", ip: "10.69.69.74", fqdn: "redada.hammackj.net", netbios: "REDADA", local_checks_proto: nil, smb_login_used: nil, ssh_auth_meth: nil, ssh_login_used: nil, pci_dss_compliance: nil, notes: nil>
|
80
80
|
|
@@ -108,5 +108,13 @@ If you would like to contribute templates/bug fixes/etc to risu. The easiest way
|
|
108
108
|
# Issues
|
109
109
|
If you have any problems, bugs or feature requests please use the [github issue tracker](http://github.com/hammackj/risu/issues).
|
110
110
|
|
111
|
+
#Donations
|
112
|
+
I have received several requests for a method to donate to the project. You can use the following Paypal donation link; if you are interested in donating to the Risu Project. Your donations are welcome and help the development of Risu.
|
113
|
+
|
114
|
+
<a href='http://www.pledgie.com/campaigns/16810'><img alt='Click here to lend your support to: Risu and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/16810.png?skin_name=chrome' border='0' /></a>
|
115
|
+
|
111
116
|
# Contact
|
112
117
|
You can reach me at jacob[dot]hammack[at]hammackj[dot]com.
|
118
|
+
|
119
|
+
You can also contact me on IRC as hammackj on irc.freenode.net, #risu
|
120
|
+
|
data/Rakefile
CHANGED
@@ -4,6 +4,7 @@ require 'rubygems' # not sure why...
|
|
4
4
|
require "risu"
|
5
5
|
require 'rake'
|
6
6
|
require 'rspec/core/rake_task'
|
7
|
+
require 'rake/testtask'
|
7
8
|
|
8
9
|
task :build do
|
9
10
|
system "gem build #{Risu::APP_NAME}.gemspec"
|
@@ -23,11 +24,20 @@ task :clean do
|
|
23
24
|
system "rm -rf coverage"
|
24
25
|
end
|
25
26
|
|
26
|
-
task :
|
27
|
-
require 'cover_me'
|
28
|
-
CoverMe.complete!
|
29
|
-
end
|
27
|
+
task :default => [:spec]
|
30
28
|
|
31
29
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
32
|
-
|
30
|
+
t.pattern = './spec/**/*_spec.rb'
|
33
31
|
end
|
32
|
+
|
33
|
+
Rake::TestTask.new("test_units") { |t|
|
34
|
+
t.libs << "test"
|
35
|
+
t.pattern = 'test/*/*_test.rb'
|
36
|
+
t.verbose = true
|
37
|
+
}
|
38
|
+
|
39
|
+
Rake::TestTask.new("test_functional") { |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.pattern = 'test/functional/*_test.rb'
|
42
|
+
t.verbose = true
|
43
|
+
}
|
data/TODO.markdown
CHANGED
@@ -2,23 +2,34 @@
|
|
2
2
|
|
3
3
|
**Release dates are estimates, and features can be changed at any time.**
|
4
4
|
|
5
|
-
## 1.4.10 (??)
|
6
|
-
- Ensure font sizes are standard in the templates
|
7
|
-
- The font in tech findings could be 1 size smaller
|
8
|
-
- Add a filtering system for lowering the rating of plugins based on config
|
9
|
-
- Compact the data in tech findings to be more printer friendly
|
10
|
-
- Add tests for Patch model
|
11
|
-
- Plugin reference accessors with auto text
|
12
|
-
- finding summary coversheet looks odd
|
13
|
-
- unsupported OS template
|
14
|
-
- add list of unsupported os ip's accessor
|
15
|
-
- detailed findings should be combined to save paper on printing
|
16
|
-
- add more detailed pci templates
|
17
|
-
|
18
5
|
## 1.5 (??)
|
19
6
|
- Nessus 5.0 compatible
|
7
|
+
|
8
|
+
##1.5.1 (??) -
|
9
|
+
- display ruby and gems version in -v
|
10
|
+
- clean up tests move to fixtures
|
11
|
+
- hash all template results to make sure templates are being created correctly
|
12
|
+
|
13
|
+
- clean up old plugins, some are nasty
|
14
|
+
- Fix list report
|
15
|
+
- by host ordered by risk
|
16
|
+
- vulnerability name
|
17
|
+
- first cve
|
18
|
+
- Host
|
19
|
+
- vuln name | cve
|
20
|
+
- vuln name | cve
|
21
|
+
- add findings by host report
|
22
|
+
- ms_wsus_findings: Takes the plugin_output from plugin ####pluginid###
|
23
|
+
- windows policy report
|
24
|
+
- stig pie graph for cat 1 / 2 /3
|
25
|
+
- move all pci related host properties to their own table
|
26
|
+
- stig detailed report
|
27
|
+
- migration error handling
|
28
|
+
- bug report info collection option
|
29
|
+
- template for rhs plugins
|
30
|
+
- template for wsus plugins
|
20
31
|
- Complete comments for all existing code
|
21
|
-
- Create
|
32
|
+
- Create tests for everything (95%+ code coverage goal)
|
22
33
|
- Parser tests
|
23
34
|
- Add test for new xml element
|
24
35
|
- Add test for new host properties tag
|
@@ -44,7 +55,6 @@
|
|
44
55
|
- ms update summary
|
45
56
|
- pci compliance
|
46
57
|
- tech findings
|
47
|
-
|
48
58
|
- CentOS 6 tutorial
|
49
59
|
- Ubuntu latest tutorial
|
50
60
|
- Implement the ability to filter data out of the report
|
@@ -52,9 +62,18 @@
|
|
52
62
|
- Host Mac Address
|
53
63
|
- Host IP
|
54
64
|
- Plugin ID
|
55
|
-
|
56
|
-
|
57
|
-
|
65
|
+
- Ensure font sizes are standard in the templates
|
66
|
+
- The font in tech findings could be 1 size smaller
|
67
|
+
- Add a filtering system for lowering the rating of plugins based on config
|
68
|
+
- Compact the data in tech findings to be more printer friendly
|
69
|
+
- Add tests for Patch model
|
70
|
+
- Plugin reference accessors with auto text
|
71
|
+
- finding summary coversheet looks odd
|
72
|
+
- unsupported OS template
|
73
|
+
- unsupported vs supported os graph
|
74
|
+
- add list of unsupported os ip's accessor
|
75
|
+
- detailed findings should be combined to save paper on printing
|
76
|
+
- add more detailed pci templates
|
58
77
|
- Provide more templates
|
59
78
|
- Virtual Machine Summary
|
60
79
|
- Fix list Report?
|
@@ -64,6 +83,13 @@
|
|
64
83
|
- Add template validation and more error checking
|
65
84
|
- Colorize the reports with better style
|
66
85
|
- Added TOC/Index to the technical findings report, issue 15
|
86
|
+
- Category I
|
87
|
+
- Vulnerabilities that allow an attacker immediate access into amachine, allow superuser access, or bypass a firewall.These can lead to the immediate compromise of the web serverallowing the attacker to take complete control of the web serverand associated operating system, which can then be used as aresource to control other systems in your network.Some examples would be the running of unsupported software,anonymous access to privledge accounts, and the presence of sample applications installed on the web server.
|
88
|
+
- Category II
|
89
|
+
- Vulnerabilities aide the ability of an attacker to gain access into amachine, compromise sensitive data, or bypass a firewall.These will lead to the eventual compromise of the web serverallowing the attacker to manipulate the content or server settingson the web server and have access to other systems in yournetwork.Some examples would be trust relationships with unauthorizedseparate enclaves, non compliance with appropriate hostoperating system security controls, and the non compliance withthe IAVM program.
|
90
|
+
- Category III
|
91
|
+
- Vulnerabilities that impact the security posture of the system andif configured, will improve the overall security of asset.These could result in the degradation of service, compromise of information, and in some cases lead to unauthorized access to thesystem.Some examples would be untrained staff, development tools on aproduction environment, and the uncontrolled release of information to the web server.
|
92
|
+
|
67
93
|
|
68
94
|
##1.5.2 (??) - Parser work
|
69
95
|
- Add Schema checks to make sure the schema is compatible with the version of risu
|
@@ -80,7 +106,7 @@
|
|
80
106
|
|
81
107
|
## 1.6 (??)
|
82
108
|
- Remove rmagick (GRRRR!)
|
83
|
-
- Move to ruby 1.9.
|
109
|
+
- Move to ruby 1.9.3 only support
|
84
110
|
- Add Parser for Nessus NBE Format
|
85
111
|
- Add Parser for Nessus NSR Format
|
86
112
|
- Add Parser for Nessus V1 of the XML Format
|
data/lib/risu.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Risu
|
2
2
|
APP_NAME = "risu"
|
3
|
-
VERSION = "1.
|
3
|
+
VERSION = "1.5.0"
|
4
4
|
GRAPH_WIDTH = 750
|
5
5
|
EMAIL = "jacob.hammack@hammackj.com"
|
6
6
|
CONFIG_FILE = "./risu.cfg"
|
@@ -27,5 +27,6 @@ require 'risu/cli'
|
|
27
27
|
require 'risu/exceptions'
|
28
28
|
require 'risu/models'
|
29
29
|
require 'risu/parsers'
|
30
|
+
require 'risu/renderers'
|
30
31
|
|
31
32
|
include Risu::Models
|
data/lib/risu/base/schema.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
module Risu
|
4
2
|
|
5
3
|
# Risu Schema
|
@@ -87,6 +85,7 @@ module Risu
|
|
87
85
|
t.string :svc_name
|
88
86
|
t.string :protocol
|
89
87
|
t.integer :severity
|
88
|
+
t.string :plugin_name
|
90
89
|
t.boolean :verified
|
91
90
|
end
|
92
91
|
|
@@ -96,8 +95,8 @@ module Risu
|
|
96
95
|
t.text :description
|
97
96
|
t.string :plugin_version
|
98
97
|
t.datetime :plugin_publication_date
|
98
|
+
t.datetime :plugin_modification_date
|
99
99
|
t.datetime :vuln_publication_date
|
100
|
-
t.string :cpe
|
101
100
|
t.string :cvss_vector
|
102
101
|
t.string :cvss_base_score
|
103
102
|
t.string :cvss_temporal_score
|
@@ -116,6 +115,7 @@ module Risu
|
|
116
115
|
t.string :exploit_framework_exploithub
|
117
116
|
t.string :exploithub_sku
|
118
117
|
t.string :stig_severity
|
118
|
+
t.string :fname
|
119
119
|
end
|
120
120
|
|
121
121
|
create_table :individual_plugin_selections do |t|
|
@@ -177,6 +177,5 @@ module Risu
|
|
177
177
|
drop_table :service_descriptions
|
178
178
|
drop_table :patches
|
179
179
|
end
|
180
|
-
|
181
180
|
end
|
182
181
|
end
|
@@ -1,26 +1,26 @@
|
|
1
1
|
module Risu
|
2
2
|
module Base
|
3
3
|
|
4
|
-
|
4
|
+
# Base template class, all report templates must be a subclass of this.
|
5
5
|
#
|
6
6
|
class TemplateBase
|
7
|
-
|
7
|
+
@possible_templates = []
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
class << self
|
10
|
+
attr_reader :possible_templates
|
11
|
+
end
|
12
|
+
|
13
13
|
# Accessor for template metadata
|
14
14
|
#
|
15
15
|
# @return [Hash] Containing template metadata
|
16
16
|
attr_accessor :template_info
|
17
17
|
|
18
|
-
#
|
18
|
+
# Adds any class that inherits from [TemplateBase] into an [Array] of
|
19
19
|
# possible templates for further validation.
|
20
20
|
#
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
def self.inherited(child)
|
22
|
+
possible_templates << child
|
23
|
+
end
|
24
|
+
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/risu/cli/application.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
module Risu
|
4
2
|
module CLI
|
5
3
|
|
@@ -10,8 +8,8 @@ module Risu
|
|
10
8
|
include Risu::Base
|
11
9
|
attr_accessor :database
|
12
10
|
|
13
|
-
#
|
14
|
-
#
|
11
|
+
# Initalizes a CLI Application
|
12
|
+
#
|
15
13
|
def initialize
|
16
14
|
@options = {}
|
17
15
|
@database = {}
|
@@ -26,6 +24,10 @@ module Risu
|
|
26
24
|
|
27
25
|
# Creates a blank config file
|
28
26
|
#
|
27
|
+
# @todo does this need exception handling
|
28
|
+
#
|
29
|
+
# @param file Path to config file
|
30
|
+
#
|
29
31
|
def create_config(file=CONFIG_FILE)
|
30
32
|
File.open(file, 'w+') do |f|
|
31
33
|
f.write("report:\n")
|
@@ -41,16 +43,14 @@ module Risu
|
|
41
43
|
f.write(" username: \n")
|
42
44
|
f.write(" password: \n")
|
43
45
|
f.write(" timeout: \n\n")
|
44
|
-
#TODO blacklisting
|
45
|
-
#f.write("blacklist:\n")
|
46
|
-
#f.write(" ips: \n")
|
47
|
-
#f.write(" macs: \n")
|
48
|
-
#f.write(" plugins: \n\n")
|
49
46
|
end
|
50
47
|
end
|
51
48
|
|
52
49
|
# Loads the configuration file
|
53
50
|
#
|
51
|
+
# @param file Path to config file
|
52
|
+
# @param in_memory_config [Boolean] If the config is in memory
|
53
|
+
#
|
54
54
|
def load_config(file=CONFIG_FILE, in_memory_config=false)
|
55
55
|
if File.exists?(file) == true or in_memory_config == true
|
56
56
|
begin
|
@@ -71,8 +71,6 @@ module Risu
|
|
71
71
|
@report[k] = "No #{k}"
|
72
72
|
end
|
73
73
|
end
|
74
|
-
|
75
|
-
#@blacklist = yaml["blacklist"]
|
76
74
|
rescue => e
|
77
75
|
puts "[!] Error loading config! - #{e.message}"
|
78
76
|
exit
|
@@ -85,6 +83,8 @@ module Risu
|
|
85
83
|
|
86
84
|
# Initiator for [ActiveRecord] migrations.
|
87
85
|
#
|
86
|
+
# @param direction [Symbol] :up or :down
|
87
|
+
#
|
88
88
|
def migrate(direction)
|
89
89
|
begin
|
90
90
|
if @database["adapter"] == nil
|
@@ -96,10 +96,13 @@ module Risu
|
|
96
96
|
Schema.migrate(direction)
|
97
97
|
|
98
98
|
if direction == :up
|
99
|
+
puts "[*] Creating tables"
|
99
100
|
ver = Version.create
|
100
101
|
ver.version = Risu::VERSION
|
101
102
|
ver.save
|
102
103
|
end
|
104
|
+
|
105
|
+
puts "[*] Dropping tables" if direction == :down
|
103
106
|
|
104
107
|
rescue ActiveRecord::AdapterNotSpecified => ans
|
105
108
|
puts "[!] Database adapter not found, please check your config file"
|
@@ -117,7 +120,7 @@ module Risu
|
|
117
120
|
end
|
118
121
|
end
|
119
122
|
|
120
|
-
#
|
123
|
+
# Establishes an [ActiveRecord::Base] database connection
|
121
124
|
#
|
122
125
|
def db_connect
|
123
126
|
begin
|
@@ -133,18 +136,21 @@ module Risu
|
|
133
136
|
rescue ActiveRecord::AdapterNotSpecified => ans
|
134
137
|
puts "[!] Database adapter not found, please check your config file"
|
135
138
|
puts "#{ans.message}\n #{ans.backtrace}" if @options[:debug]
|
139
|
+
|
136
140
|
exit
|
137
141
|
rescue ActiveRecord::AdapterNotFound => anf
|
138
142
|
puts "[!] Database adapter not found, please check your config file"
|
139
143
|
puts "#{anf.message}\n #{anf.backtrace}" if @options[:debug]
|
144
|
+
|
140
145
|
exit
|
141
146
|
rescue => e
|
142
147
|
puts "[!] Exception! #{e.message}\n #{e.backtrace}"
|
143
148
|
end
|
144
149
|
end
|
145
150
|
|
151
|
+
# Tests the database connection
|
146
152
|
#
|
147
|
-
#
|
153
|
+
# @return [Boolean] True on successful, False on failure
|
148
154
|
def test_connection?
|
149
155
|
begin
|
150
156
|
|
@@ -162,6 +168,7 @@ module Risu
|
|
162
168
|
|
163
169
|
# Starts a console and executes anything in a block sent to it
|
164
170
|
#
|
171
|
+
# @param block Code block to transfer control
|
165
172
|
def consolize &block
|
166
173
|
|
167
174
|
yield
|
@@ -293,7 +300,8 @@ module Risu
|
|
293
300
|
end
|
294
301
|
end
|
295
302
|
|
296
|
-
#
|
303
|
+
# Main Application loop, handles all of the command line arguments and
|
304
|
+
#parsing of files on the command line
|
297
305
|
#
|
298
306
|
def run
|
299
307
|
parse_options
|
@@ -378,6 +386,7 @@ module Risu
|
|
378
386
|
|
379
387
|
# Handles the parsing of a single file
|
380
388
|
#
|
389
|
+
# @param file
|
381
390
|
def parse_file file
|
382
391
|
begin
|
383
392
|
puts "[*] Parsing #{file}..."
|
@@ -392,7 +401,6 @@ module Risu
|
|
392
401
|
doc.parse
|
393
402
|
|
394
403
|
puts "[*] Fixing IP Address field"
|
395
|
-
|
396
404
|
doc.fix_ips
|
397
405
|
|
398
406
|
else
|