Advertisement
Guest User

Untitled

a guest
May 3rd, 2017
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. #################### LOGIN_windows username password halEnv d3Username d3Password ####################
  2. 81 # Author: Frank_n_Beans
  3. 82 # Precondition: N/A
  4. 83 # Takes: 5 strings
  5. 84 # Where: username == windows username and password == windows
  6. 85 # password. halEnv (waphaldev, waphaltest...)
  7. 86 # d3Username == d3 password d3Password == d3 password
  8. 87 # Returns: TRUE if login is successful or FALSE if not
  9. 88 # Notes: Would rather set an error var but need to research
  10. 89 #################### LOGIN_connect username password d3Username d3Password ####################
  11. 90 proc LOGIN_connect { username password halEnv d3Username d3Password} {
  12. 91
  13. 92 set TRUE 1
  14. 93 set FALSE 0
  15. 94 set rcode $TRUE
  16. 95
  17. 96 spawn telnet $halEnv
  18. 97
  19. 98 expect -re ".*login:.*"
  20. 99
  21. 100 exp_send -- "$username\r"
  22. 101
  23. 102 expect -re ".*Password:.*"
  24. 103
  25. 104 exp_send -- "$password\r"
  26. 105
  27. 106 #expect {
  28. 107 # -re ".*Login incorrect.*" {
  29. 108 # set rcode $FALSE
  30. 109 # return $rcode
  31. 110 # }
  32. 111 #
  33. 112 # }
  34. 113
  35. 114 expect -re ".*Connected.*"
  36. 115
  37. 116 exp_send -- "\r"
  38. 117
  39. 118 expect -re ".*Enter your user id:.*"
  40. 119
  41. 120 exp_send -- "$d3Username\r"
  42. 121
  43. 122 # expect {
  44. 123 # -re ".Invalid user or password.*" {
  45. 124 # set rcode $FALSE
  46. 125 # return $rcode
  47. 126 # }
  48. 127 # }
  49. 128
  50. 129 expect -re ".*user password:.*"
  51. 130
  52. 131 exp_send -- "$d3Password\r"
  53. 132
  54. 133 # expect {
  55. 134 # -re ".Invalid user or password.*" {
  56. 135 # set rcode $FALSE
  57. 136 # return $rcode
  58. 137 # }
  59. 138 # }
  60. 139
  61. 140 expect -re ".*Select Function or OFF.*:"
  62. 141
  63. 142 return $rcode
  64. 143 }
  65. 109,2-9 Bot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement