silo_manager 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -658,7 +658,7 @@ end
658
658
  begin
659
659
  options = Options.parse ARGV
660
660
  begin
661
- @client_api = Nexpose::Connection.new options.host, options.user, options.password, options.port
661
+ @client_api = Nexpose::Connection.new options.host, options.user, options.password, options.port, options.silo_id
662
662
  @client_api.login
663
663
  rescue Exception => e
664
664
  puts "Unable to connect to #{options.host}"
@@ -962,11 +962,12 @@ class Connection
962
962
  attr_reader :url
963
963
 
964
964
  # Constructor for Connection
965
- def initialize(ip, user, pass, port = 3780)
965
+ def initialize(ip, user, pass, port = 3780, silo_id = nil)
966
966
  @host = ip
967
967
  @port = port
968
968
  @username = user
969
969
  @password = pass
970
+ @silo_id = silo_id
970
971
  @session_id = nil
971
972
  @error = false
972
973
  @url = "https://#{@host}:#{@port}/api/VERSION_STRING/xml"
@@ -975,7 +976,11 @@ class Connection
975
976
  # Establish a new connection and Session ID
976
977
  def login
977
978
  begin
978
- r = execute(make_xml('LoginRequest', { 'sync-id' => 0, 'password' => @password, 'user-id' => @username }))
979
+ login_hash = { 'sync-id' => 0, 'password' => @password, 'user-id' => @username }
980
+ unless @silo_id.nil?
981
+ login_hash['silo-id'] = @silo_id
982
+ end
983
+ r = execute(make_xml('LoginRequest', login_hash))
979
984
  rescue APIError
980
985
  raise AuthenticationFailed.new(r)
981
986
  end
@@ -9,12 +9,13 @@ class Options
9
9
  options = OpenStruct.new
10
10
  options.port = 3780
11
11
  options.host = 'localhost'
12
-
12
+ options.silo_id = nil
13
13
 
14
14
  option_parser = OptionParser.new do |option_parser|
15
15
  option_parser.on("-h host", "The network address of the NeXpose instance - Defaults to 'localhost'") { |arg| options.host=arg.chomp }
16
16
  option_parser.on("-u user_name", "The NeXpose user name - Required") { |arg| options.user=arg.chomp }
17
17
  option_parser.on("-p password", "The NeXpose password - Required") { |arg| options.password=arg.chomp }
18
+ option_parser.on("-s silo-id", "The Silo ID - Optional") { |arg| options.silo_id=arg.chomp }
18
19
  option_parser.on("--port port", "The NSC port - Defaults to 3780") { |arg| options.port=arg.chomp }
19
20
  option_parser.on_tail("--help", "Help") do
20
21
  puts option_parser
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: silo_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: librex
17
- requirement: &24169236 !ruby/object:Gem::Requirement
17
+ requirement: &24451716 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: 0.0.32
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *24169236
25
+ version_requirements: *24451716
26
26
  description: ! ' This is a tool is used to provide CRUD silo operations for Nexpose.
27
27
 
28
28
  '
@@ -34,7 +34,6 @@ extra_rdoc_files: []
34
34
  files:
35
35
  - lib/nexpose.rb
36
36
  - lib/options.rb
37
- - lib/test.rb
38
37
  - bin/silo_manager
39
38
  has_rdoc: true
40
39
  homepage: https://github.com/chrlee/silo_manager
@@ -1,8 +0,0 @@
1
- # encoding: utf-8
2
- begin
3
- test = {}
4
- test['hi-hi'] = true
5
- unless test['hi-hi']
6
- puts "Hi"
7
- end
8
- end