nessus_console 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -118,9 +118,9 @@ else
118
118
  end
119
119
 
120
120
  include NessusConsole
121
- N=nil
121
+ # $n=nil
122
122
  if $options.has_key?(:password) and $options[:autologin] then
123
- N=NessusREST::Client.new($options)
123
+ $n=NessusREST::Client.new($options)
124
124
  end
125
125
 
126
126
  binding.pry
@@ -1,8 +1,7 @@
1
1
  require "nessus_console/version"
2
+ require "nessus_console/help"
2
3
 
3
4
  module NessusConsole
4
- attr_accessor :N
5
-
6
5
  def load
7
6
  optyaml = YAML::load_file($nessusconsoleyaml)
8
7
  if optyaml != nil then
@@ -10,12 +9,20 @@ module NessusConsole
10
9
  end
11
10
  end
12
11
 
12
+ def neshelp
13
+ NessusConsole::Help::neshelp()
14
+ end
15
+
13
16
  def save
14
17
  File.open($nessusconsoleyaml, 'w') {|f| f.write $options.to_yaml }
15
18
  end
16
19
 
20
+ def connect
21
+ $n=NessusREST::Client.new($options)
22
+ end
23
+
17
24
  def rscans
18
- N.list_scans['scans']
25
+ $n.list_scans['scans']
19
26
  end
20
27
 
21
28
  def scans(*args)
@@ -23,7 +30,7 @@ module NessusConsole
23
30
  end
24
31
 
25
32
  def rscansmy
26
- ret=N.list_scans['scans']
33
+ ret=$n.list_scans['scans']
27
34
  selscans=ret.select do |scan|
28
35
  scan['folder_id']=='2'
29
36
  end
@@ -35,7 +42,7 @@ module NessusConsole
35
42
  end
36
43
 
37
44
  def rfamilies
38
- tp N.list_families['families']
45
+ tp $n.list_families['families']
39
46
  end
40
47
 
41
48
  def families(*args)
@@ -43,7 +50,7 @@ module NessusConsole
43
50
  end
44
51
 
45
52
  def rfolders
46
- tp N.list_scans['folders']
53
+ tp $n.list_scans['folders']
47
54
  end
48
55
 
49
56
  def folders(*args)
@@ -51,7 +58,7 @@ module NessusConsole
51
58
  end
52
59
 
53
60
  def rusers
54
- N.list_users['users']
61
+ $n.list_users['users']
55
62
  end
56
63
 
57
64
  def users(*args)
@@ -59,19 +66,33 @@ module NessusConsole
59
66
  end
60
67
 
61
68
  def rhosts(id)
62
- N.scan_details(id)["hosts"]
69
+ $n.scan_details(id)['hosts']
63
70
  end
64
71
 
65
72
  def hosts(id,*args)
66
73
  tp rhosts(id), args
67
74
  end
68
75
 
76
+ def rhostsvulns(id)
77
+ filtered=Array.new
78
+ rhosts(id).each do |h|
79
+ if h[:critical]>0 then
80
+ filtered.push h
81
+ end
82
+ end
83
+ return filtered
84
+ end
85
+
86
+ def hostsvulns(id)
87
+ tp rhostsvulns(id)
88
+ end
89
+
69
90
  def hostsbrief(id)
70
91
  tp rhosts(id), :host_id, :hostname, :critical, :high, :medium, :low, :progress
71
92
  end
72
93
 
73
94
  def rvulns(id)
74
- N.scan_details(id)["vulnerabilities"]
95
+ $n.scan_details(id)['vulnerabilities']
75
96
  end
76
97
 
77
98
  def vulns (id, *args)
@@ -0,0 +1,13 @@
1
+ module NessusConsole
2
+ class Help
3
+ def self.neshelp
4
+ puts <<END
5
+ load load nessus configuration from configuration file
6
+ save save nessus configuration from configuration file
7
+ connect connect to the server with provided credentials
8
+ scans list all scans
9
+ folders list all scan folders
10
+ END
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module NessusConsole
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nessus_console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-09-01 00:00:00.000000000 Z
12
+ date: 2016-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -129,6 +129,7 @@ files:
129
129
  - bin/setup
130
130
  - exe/nessus_console
131
131
  - lib/nessus_console.rb
132
+ - lib/nessus_console/help.rb
132
133
  - lib/nessus_console/version.rb
133
134
  - nessus_console.gemspec
134
135
  homepage: https://github.com/kost/nessus_console-ruby/