-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathauto-nessus.rb
executable file
·50 lines (49 loc) · 1.3 KB
/
auto-nessus.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'json'
require 'openssl'
require 'pry'
require 'terminal-table'
config = File.read('config.json')
@n_config = JSON.parse(config)
#binding.pry
Dir["#{File.dirname(__FILE__)}/lib/*.rb"].each { |f| require f }
case ARGV[0]
when "login"
puts "login"
login
when "list_policies"
# policies name
listPolicies("policies","name", "std")
when "list_folders"
listPolicies("folders","name", "std")
when "list_scanners"
listPolicies("scanners","name", "std")
when "list_scans"
listPolicies("scans","name", "std")
when "list_users"
listPolicies("users","username", "std")
when "create_scans"
#binding.pry
if ARGV[1].nil?
puts "Enter name of the POLICY"
puts "[exp:~$] ruby auto-nessus.rb create_scans <NAME-POLICIES> <NAME-SCAN> <FILE> "
exit
end
if ARGV[2].nil?
puts "Enter name of the SCAN"
puts "[exp:~$] ruby auto-nessus.rb create_scans <NAME-POLICIES> <NAME-SCAN> <FILE>"
exit
end
if ARGV[3].nil?
puts "Enter name of the IP-FILE"
puts "[exp:~$] ruby auto-nessus.rb create_scans <NAME-POLICIES> <NAME-SCAN> <FILE>"
exit
end
create_scan(ARGV[1],ARGV[2], ARGV[3])
else
help = File.read("help.txt")
#puts "Opcion no valida"
puts help
end