rubyntlm 0.1.1 → 0.2.0

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.
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.9.2
5
+ - jruby-18mode
6
+ - jruby-19mode
7
+ - rbx-18mode
8
+ - rbx-19mode
9
+ - ruby-head
10
+ - jruby-head
11
+ - 1.8.7
12
+ - ree
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ 0.2.0 - Major changes to behavior!!!!
2
+ - Bug - Type 1 packets do not include a domain and workstation by defauly. Packet capture software will see this type of packet as malformed. All packets now include this information
3
+ - Bug - Type 3 packets do not include the calling workstation. This should be setup by default.
4
+
5
+ 0.1.2
6
+ - Feature user can specify the target domain
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,17 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rubyntlm (0.2.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (10.0.3)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 1.3)
16
+ rake
17
+ rubyntlm!
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Ruby/NTLM -- NTLM Authentication Library for Ruby
2
+
3
+ [![Build Status](https://travis-ci.org/winrb/[rubyntlm].png)](https://travis-ci.org/winrb/rubyntlm)
4
+
5
+ Ruby/NTLM provides message creator and parser for the NTLM authentication.
6
+
7
+ __100% Ruby__
8
+
9
+ Simple Example
10
+ --------------
11
+
12
+ ### Creating NTLM Type 1 message
13
+
14
+ ```ruby
15
+ t1 = NTLM::Message::Type1.new()
16
+ ```
17
+
18
+ ### Parsing NTLM Type 2 message from server
19
+
20
+ ```ruby
21
+ t2 = NTLM::Message.parse(message_from_server)
22
+ ```
23
+
24
+ ### Creating NTLM Type 3 message
25
+
26
+ ```ruby
27
+ t3 = t2.response({:user => 'user', :password => 'passwd'})
28
+ ```
29
+
30
+ Support
31
+ -------
32
+
33
+ https://groups.google.com/forum/?fromgroups#!forum/rubyntlm
34
+
35
+ Contributing
36
+ ------------
37
+ 1. Fork it.
38
+ 2. Create a branch (git checkout -b my_feature_branch)
39
+ 3. Commit your changes (git commit -am "Added a sweet feature")
40
+ 4. Push to the branch (git push origin my_feature_branch)
41
+ 5. Create a pull requst from your branch into master (Please be sure to provide enough detail for us to cipher what this change is doing)
data/Rakefile CHANGED
@@ -1,66 +1,10 @@
1
- # Rakefile for rubyntlm -*- ruby -*-
2
- # $Id: Rakefile,v 1.2 2006/10/05 01:36:52 koheik Exp $
3
-
4
- require 'rake/rdoctask'
5
- require 'rake/testtask'
6
- require 'rake/packagetask'
7
- require 'rake/gempackagetask'
8
- require File.join(File.dirname(__FILE__), 'lib', 'net', 'ntlm')
9
-
10
- PKG_NAME = 'rubyntlm'
11
- PKG_VERSION = Net::NTLM::VERSION::STRING
12
-
13
- task :default => [:test]
14
-
15
- Rake::TestTask.new(:test) do |t|
16
- t.test_files = FileList[ "test/*.rb" ]
17
- t.warning = true
18
- t.verbose = true
19
- end
20
-
21
- # Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |p|
22
- # p.need_tar_gz = true
23
- # p.package_dir = 'build'
24
- # p.package_files.include("README", "Rakefile")
25
- # p.package_files.include("lib/net/**/*.rb", "test/**/*.rb", "examples/**/*.rb")
26
- # end
27
-
28
- Rake::RDocTask.new do |rd|
29
- rd.rdoc_dir = 'doc'
30
- rd.title = 'Ruby/NTLM library'
31
- rd.main = "README"
32
- rd.rdoc_files.include("README", "lib/**/*.rb")
33
- end
34
-
35
- dist_dirs = ["lib", "test", "examples"]
36
- spec = Gem::Specification.new do |s|
37
- s.name = PKG_NAME
38
- s.version = PKG_VERSION
39
- s.summary = %q{Ruby/NTLM library.}
40
- s.description = %q{Ruby/NTLM provides message creator and parser for the NTLM authentication.}
41
- s.authors = ["Kohei Kajimoto"]
42
- s.email = %q{koheik@gmail.com}
43
- s.homepage = %q{http://rubyforge.org/projects/rubyntlm}
44
- s.rubyforge_project = %q{rubyntlm}
45
-
46
- s.files = ["Rakefile", "README"]
47
- dist_dirs.each do |dir|
48
- s.files = s.files + Dir.glob("#{dir}/**/*.rb")
49
- end
50
-
51
- s.has_rdoc = true
52
- s.extra_rdoc_files = %w( README )
53
- s.rdoc_options.concat ['--main', 'README']
54
-
55
- s.autorequire = 'net/ntlm'
56
- end
57
-
58
- Rake::GemPackageTask.new(spec) do |p|
59
- p.gem_spec = spec
60
- p.need_tar = true
61
- p.need_zip = true
62
- p.package_dir = 'build'
63
- end
64
-
65
-
66
-
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ task :default => [:test]
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.test_files = FileList[ "test/*.rb" ]
8
+ t.warning = true
9
+ t.verbose = true
10
+ end
data/lib/net/ntlm.rb CHANGED
@@ -45,14 +45,16 @@
45
45
  require 'base64'
46
46
  require 'openssl'
47
47
  require 'openssl/digest'
48
+ require 'kconv'
49
+ require 'socket'
48
50
 
49
51
  module Net #:nodoc:
50
- module NTLM
52
+ module NTLM #:nodoc:
51
53
 
52
54
  module VERSION #:nodoc:
53
55
  MAJOR = 0
54
- MINOR = 1
55
- TINY = 1
56
+ MINOR = 2
57
+ TINY = 0
56
58
  STRING = [MAJOR, MINOR, TINY].join('.')
57
59
  end
58
60
 
@@ -605,8 +607,8 @@ module Net #:nodoc:
605
607
  string :sign, {:size => 8, :value => SSP_SIGN}
606
608
  int32LE :type, {:value => 1}
607
609
  int32LE :flag, {:value => DEFAULT_FLAGS[:TYPE1] }
608
- security_buffer :domain, {:value => "", :active => false}
609
- security_buffer :workstation, {:value => "", :active => false}
610
+ security_buffer :domain, {:value => ""}
611
+ security_buffer :workstation, {:value => Socket.gethostname }
610
612
  string :padding, {:size => 0, :value => "", :active => false }
611
613
  }
612
614
 
@@ -667,6 +669,7 @@ module Net #:nodoc:
667
669
  def response(arg, opt = {})
668
670
  usr = arg[:user]
669
671
  pwd = arg[:password]
672
+ domain = arg[:domain] ? arg[:domain] : ""
670
673
  if usr.nil? or pwd.nil?
671
674
  raise ArgumentError, "user and password have to be supplied"
672
675
  end
@@ -699,13 +702,12 @@ module Net #:nodoc:
699
702
  opt[:unicode] = true
700
703
  end
701
704
 
702
- tgt = self.target_name
703
705
  ti = self.target_info
704
706
 
705
707
  chal = self[:challenge].serialize
706
-
708
+
707
709
  if opt[:ntlmv2]
708
- ar = {:ntlmv2_hash => NTLM::ntlmv2_hash(usr, pwd, tgt, opt), :challenge => chal, :target_info => ti}
710
+ ar = {:ntlmv2_hash => NTLM::ntlmv2_hash(usr, pwd, domain, opt), :challenge => chal, :target_info => ti}
709
711
  lm_res = NTLM::lmv2_response(ar, opt)
710
712
  ntlm_res = NTLM::ntlmv2_response(ar, opt)
711
713
  elsif has_flag?(:NTLM2_KEY)
@@ -719,7 +721,7 @@ module Net #:nodoc:
719
721
  Type3.create({
720
722
  :lm_response => lm_res,
721
723
  :ntlm_response => ntlm_res,
722
- :domain => tgt,
724
+ :domain => domain,
723
725
  :user => usr,
724
726
  :workstation => ws,
725
727
  :flag => self.flag
@@ -754,8 +756,13 @@ module Net #:nodoc:
754
756
  t.ntlm_response = arg[:ntlm_response]
755
757
  t.domain = arg[:domain]
756
758
  t.user = arg[:user]
757
- t.workstation = arg[:workstation]
758
-
759
+
760
+ if arg[:workstation]
761
+ t.workstation = arg[:workstation]
762
+ else
763
+ t.workstation = NTLM.encode_utf16le(Socket.gethostname)
764
+ end
765
+
759
766
  if arg[:session_key]
760
767
  t.enable(:session_key)
761
768
  t.session_key = arg[session_key]
data/lib/rubyntlm.rb ADDED
@@ -0,0 +1 @@
1
+ require 'net/ntlm'
data/rubyntlm.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ require File.join(File.dirname(__FILE__), 'lib', 'net', 'ntlm')
2
+
3
+ Gem::Specification.new do |s|
4
+ s.platform = Gem::Platform::RUBY
5
+ s.name = 'rubyntlm'
6
+ s.version = Net::NTLM::VERSION::STRING
7
+ s.summary = 'Ruby/NTLM library.'
8
+ s.description = 'Ruby/NTLM provides message creator and parser for the NTLM authentication.'
9
+
10
+ s.authors = ['Kohei Kajimoto','Paul Morton']
11
+ s.email = ['koheik@gmail.com','paul.e.morton@gmail.com']
12
+ s.homepage = 'https://github.com/winrb/rubyntlm'
13
+
14
+
15
+ s.files = `git ls-files`.split($/)
16
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_development_dependency "bundler", "~> 1.3"
21
+ s.add_development_dependency "rake"
22
+ end
metadata CHANGED
@@ -1,53 +1,99 @@
1
- --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
3
- specification_version: 1
1
+ --- !ruby/object:Gem::Specification
4
2
  name: rubyntlm
5
- version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2006-10-04 00:00:00 -05:00
8
- summary: Ruby/NTLM library.
9
- require_paths:
10
- - lib
11
- email: koheik@gmail.com
12
- homepage: http://rubyforge.org/projects/rubyntlm
13
- rubyforge_project: rubyntlm
14
- description: Ruby/NTLM provides message creator and parser for the NTLM authentication.
15
- autorequire: net/ntlm
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ prerelease:
25
6
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
- authors:
7
+ authors:
30
8
  - Kohei Kajimoto
31
- files:
9
+ - Paul Morton
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-03-22 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '1.3'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: '1.3'
31
+ - !ruby/object:Gem::Dependency
32
+ name: rake
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ description: Ruby/NTLM provides message creator and parser for the NTLM authentication.
48
+ email:
49
+ - koheik@gmail.com
50
+ - paul.e.morton@gmail.com
51
+ executables: []
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - .travis.yml
56
+ - CHANGELOG.md
57
+ - Gemfile
58
+ - Gemfile.lock
59
+ - README.md
32
60
  - Rakefile
33
- - README
34
- - lib/net/ntlm.rb
35
- - test/function_test.rb
36
61
  - examples/http.rb
37
62
  - examples/imap.rb
38
63
  - examples/smtp.rb
39
- test_files: []
40
-
41
- rdoc_options:
42
- - --main
43
- - README
44
- extra_rdoc_files:
45
- - README
46
- executables: []
47
-
48
- extensions: []
49
-
64
+ - lib/net/ntlm.rb
65
+ - lib/rubyntlm.rb
66
+ - rubyntlm.gemspec
67
+ - test/function_test.rb
68
+ homepage: https://github.com/winrb/rubyntlm
69
+ licenses: []
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ segments:
81
+ - 0
82
+ hash: -254558294721854043
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ segments:
90
+ - 0
91
+ hash: -254558294721854043
50
92
  requirements: []
51
-
52
- dependencies: []
53
-
93
+ rubyforge_project:
94
+ rubygems_version: 1.8.25
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: Ruby/NTLM library.
98
+ test_files:
99
+ - test/function_test.rb
data/README DELETED
@@ -1,25 +0,0 @@
1
- = Ruby/NTLM -- NTLM Authentication Library for Ruby
2
-
3
- Ruby/NTLM provides message creator and parser for the NTLM authentication.
4
-
5
- Some features:
6
- * Independent from non-standard Ruby libraries.
7
- * Supports NTLM and NTLMv2 reponses.
8
-
9
- == Simple Example
10
-
11
- * Creating NTLM Type 1 message
12
-
13
- t1 = NTLM::Message::Type1.new()
14
-
15
- * Parsing NTLM Type 2 message from server
16
-
17
- t2 = NTLM::Message.parse(message_from_server)
18
-
19
- * Creating NTLM Type 3 message
20
-
21
- t3 = t2.response({:user => 'user', :password => 'passwd'})
22
-
23
- == Support
24
-
25
- You can find Ruby/NTLM RubyForge page at http://rubyforge.org/projects/rubyntlm.