Mirror of metasploit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ntlm.rb 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # -*- coding: binary -*-
  2. require 'rex/proto/ntlm/constants'
  3. require 'rex/proto/ntlm/crypt'
  4. require 'rex/proto/ntlm/base'
  5. require 'rex/proto/ntlm/message'
  6. require 'rex/proto/ntlm/utils'
  7. module Msf
  8. ###
  9. #
  10. # This mixins will only provide the options name and description when a protocol want to use ntlm features from lib/rex/proto/ntlm .
  11. # Unfortunately other mixin's still have to make direct call from lib/rex/proto/ntlm
  12. # cause some protocol like SMB are implemented in lib/rex/proto/ while others like mssql are implemented in lib/msf/core/exploit
  13. #
  14. ###
  15. module Exploit::NTLM
  16. NTLM_CONST = ::Rex::Proto::NTLM::Constants
  17. NTLM_CRYPT = ::Rex::Proto::NTLM::Crypt
  18. NTLM_UTILS = ::Rex::Proto::NTLM::Utils
  19. NTLM_BASE = ::Rex::Proto::NTLM::Base
  20. NTLM_MESSAGE = ::Rex::Proto::NTLM::Message
  21. module Client
  22. def initialize(info = {})
  23. super
  24. register_advanced_options(
  25. [
  26. #
  27. # UseNTLMv2 forces NTLMv2 instead of NTLM2_session behavior when the 'Negotiate NTLM2' flag is set
  28. #
  29. OptBool.new('NTLM::UseNTLMv2', [ true, "Use NTLMv2 instead of NTLM2_session when \'Negotiate NTLM2\' key is true", true]),
  30. #
  31. # UseNTLM2_session forces the use of NTLMV2 session keys instead of NTLMv1, emulating the default of Windows 2000+
  32. #
  33. OptBool.new('NTLM::UseNTLM2_session', [ true, 'Activate the \'Negotiate NTLM2 key\' flag, forcing the use of a NTLMv2_session', true]),
  34. #
  35. # SendLM has no effect when NTLM_UseNTLM2_session = true, NTLM_UseNTLMv2 = false or NTLM_SendNTLM = false
  36. #
  37. OptBool.new('NTLM::SendLM', [ true, "Always send the LANMAN response (except when NTLMv2_session is specified)", true]),
  38. #
  39. # UseLMKey is valid when NTLM_SendLM = true, NTLM_SendNTLM = true, or NTLM_UseNTLM2_session = false
  40. #
  41. OptBool.new('NTLM::UseLMKey', [ true, "Activate the \'Negotiate Lan Manager Key\' flag, using the LM key when the LM response is sent", false]),
  42. #
  43. # SendNTLM allows the NTLM response to be excluded, emulating Win9x behavior (don't change unless you are testing)
  44. #
  45. OptBool.new('NTLM::SendNTLM', [ true, 'Activate the \'Negotiate NTLM key\' flag, indicating the use of NTLM responses', true]),
  46. #
  47. # SendSPN will send an avp of type 9/SPN in the ntlmv2 client blob, this is mandatory on windows seven / 2008 r2 if
  48. # Microsoft network server : Server SPN target name validation level is set to <Required from client> or we get an STATUS_ACCESS_DENIED
  49. #
  50. OptBool.new('NTLM::SendSPN', [ true, 'Send an avp of type SPN in the ntlmv2 client blob, this allows authentication on Windows 7+/Server 2008 R2+ when SPN is required', true]),
  51. ], Msf::Exploit::NTLM::Client)
  52. end
  53. end
  54. =begin
  55. module Server
  56. def initialize(info = {})
  57. super
  58. register_options(
  59. [
  60. ], Msf::Exploit::NTLM::Server)
  61. end
  62. end
  63. =end
  64. end
  65. end