Guest User

Untitled

a guest
Oct 19th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. ## Config.txt
  2.  
  3. ## Default timeout
  4. #Default_Timeout = 3
  5. ## Existing servers
  6. #Hostlist = ['1.2.3.4','127.0.0.1','123.0.0.1']
  7. ## Userlist
  8. #Userlist = ['user','user','user']
  9. ## Passwordlist
  10. #Passwordlist = ['userpegrase','userpregase','userp']
  11. ## Concurrent connections max
  12. #limit_concurrent_connection = 50
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20. #####################################################
  21. ## getConf.rb : get the parameters of the Config.txt file
  22. #####################################################
  23.  
  24. require 'rubygems'
  25. require 'parseconfig'
  26.  
  27. class GetValues
  28.  
  29. @@token_hostlist = "Hostlist"
  30. @@token_password = "Passwordlist"
  31. @@token_user = "Userlist"
  32.  
  33. def initialize(filename, tokenHost, tokenPass,tokenUser)
  34. @file = filename
  35. @@token_hostlist = tokenHost unless tokenHost == nil
  36. @@token_password = tokenPass unless tokenPass == nil
  37. @@token_user = tokenUser unless tokenUser == nil
  38. load
  39. end
  40.  
  41. def load
  42. @config = ParseConfig.new(@file)
  43. parse
  44. end
  45.  
  46.  
  47. def parse
  48. @hostlist = @config.get_value(@@token_hostlist)
  49. @password = @config.get_value(@@token_password)
  50. @user = @config.get_value(@@token_user)
  51. end
  52. end
Add Comment
Please, Sign In to add comment