Guest User

Untitled

a guest
Oct 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 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. ## getConf.rb : get the parameters of the Config.txt file
  19. #####################################################
  20.  
  21. require 'rubygems'
  22. require 'parseconfig'
  23.  
  24. class GetValues
  25.  
  26. @@token_hostlist = "Hostlist"
  27. @@token_password = "Passwordlist"
  28. @@token_user = "Userlist"
  29.  
  30. def initialize(filename, tokenHost, tokenPass,tokenUser)
  31. @file = filename
  32. @@token_hostlist = tokenHost unless tokenHost == nil
  33. @@token_password = tokenPass unless tokenPass == nil
  34. @@token_user = tokenUser unless tokenUser == nil
  35. load
  36. end
  37.  
  38. def load
  39. @config = ParseConfig.new(@file)
  40. parse
  41. end
  42.  
  43.  
  44. def parse
  45. @hostlist = @config.get_value(@@token_hostlist)
  46. @password = @config.get_value(@@token_password)
  47. @user = @config.get_value(@@token_user)
  48. end
  49. end
Add Comment
Please, Sign In to add comment