rubyntlm 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +12 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +17 -0
- data/README.md +41 -0
- data/Rakefile +10 -66
- data/lib/net/ntlm.rb +18 -11
- data/lib/rubyntlm.rb +1 -0
- data/rubyntlm.gemspec +22 -0
- metadata +91 -45
- data/README +0 -25
data/.travis.yml
ADDED
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
data/Gemfile.lock
ADDED
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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 =
|
55
|
-
TINY =
|
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 => ""
|
609
|
-
security_buffer :workstation, {:value =>
|
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,
|
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 =>
|
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
|
-
|
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.
|
7
|
-
|
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
|
-
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
|
-
authors:
|
7
|
+
authors:
|
30
8
|
- Kohei Kajimoto
|
31
|
-
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
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.
|