ntlm-http 0.1.1

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.
@@ -0,0 +1,16 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{ntlm-http}
3
+ s.version = "0.1.1"
4
+ s.date = %q{20-05-2009}
5
+ s.summary = %q{Ruby/NTLM HTTP library.}
6
+ s.email = %q{kingsley@mindflowsolutions.com}
7
+ s.homepage = %q{http://www.mindflowsolutions.net}
8
+ s.rubyforge_project = %q{rubyntlm}
9
+ s.description = %q{Ruby/NTLM HTTP provides NTLM authentication over http.}
10
+ s.autorequire = %q{net/ntlm_http}
11
+ s.has_rdoc = true
12
+ s.authors = ["Kohei Kajimoto,Kingsley Hendrickse"]
13
+ s.files = ["ntlm-http-0.1.1.gemspec", "Rakefile", "README", "lib/net/ntlm.rb", "lib/net/ntlm_http.rb", "test/function_test.rb", "examples/http.rb", "examples/imap.rb", "examples/smtp.rb"]
14
+ s.rdoc_options = ["--main", "README"]
15
+ s.extra_rdoc_files = ["README"]
16
+ end
@@ -0,0 +1,111 @@
1
+ # $Id$
2
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
3
+ require 'test/unit'
4
+ require 'net/ntlm'
5
+
6
+ class FunctionTest < Test::Unit::TestCase #:nodoc:
7
+ def setup
8
+ @passwd = "SecREt01"
9
+ @user = "user"
10
+ @domain = "domain"
11
+ @challenge = ["0123456789abcdef"].pack("H*")
12
+ @client_ch = ["ffffff0011223344"].pack("H*")
13
+ @timestamp = 1055844000
14
+ @trgt_info = [
15
+ "02000c0044004f004d00410049004e00" +
16
+ "01000c00530045005200560045005200" +
17
+ "0400140064006f006d00610069006e00" +
18
+ "2e0063006f006d000300220073006500" +
19
+ "72007600650072002e0064006f006d00" +
20
+ "610069006e002e0063006f006d000000" +
21
+ "0000"
22
+ ].pack("H*")
23
+ end
24
+
25
+ def test_lm_hash
26
+ ahash = ["ff3750bcc2b22412c2265b23734e0dac"].pack("H*")
27
+ assert_equal ahash, Net::NTLM::lm_hash(@passwd)
28
+ end
29
+
30
+ def test_ntlm_hash
31
+ ahash = ["cd06ca7c7e10c99b1d33b7485a2ed808"].pack("H*")
32
+ assert_equal ahash, Net::NTLM::ntlm_hash(@passwd)
33
+ end
34
+
35
+ def test_ntlmv2_hash
36
+ ahash = ["04b8e0ba74289cc540826bab1dee63ae"].pack("H*")
37
+ assert_equal ahash, Net::NTLM::ntlmv2_hash(@user, @passwd, @domain)
38
+ end
39
+
40
+ def test_lm_response
41
+ ares = ["c337cd5cbd44fc9782a667af6d427c6de67c20c2d3e77c56"].pack("H*")
42
+ assert_equal ares, Net::NTLM::lm_response(
43
+ {
44
+ :lm_hash => Net::NTLM::lm_hash(@passwd),
45
+ :challenge => @challenge
46
+ }
47
+ )
48
+ end
49
+
50
+ def test_ntlm_response
51
+ ares = ["25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6"].pack("H*")
52
+ ntlm_hash = Net::NTLM::ntlm_hash(@passwd)
53
+ assert_equal ares, Net::NTLM::ntlm_response(
54
+ {
55
+ :ntlm_hash => ntlm_hash,
56
+ :challenge => @challenge
57
+ }
58
+ )
59
+ end
60
+
61
+ def test_lmv2_response
62
+ ares = ["d6e6152ea25d03b7c6ba6629c2d6aaf0ffffff0011223344"].pack("H*")
63
+ assert_equal ares, Net::NTLM::lmv2_response(
64
+ {
65
+ :ntlmv2_hash => Net::NTLM::ntlmv2_hash(@user, @passwd, @domain),
66
+ :challenge => @challenge
67
+ },
68
+ { :client_challenge => @client_ch }
69
+ )
70
+ end
71
+
72
+ def test_ntlmv2_response
73
+ ares = [
74
+ "cbabbca713eb795d04c97abc01ee4983" +
75
+ "01010000000000000090d336b734c301" +
76
+ "ffffff00112233440000000002000c00" +
77
+ "44004f004d00410049004e0001000c00" +
78
+ "53004500520056004500520004001400" +
79
+ "64006f006d00610069006e002e006300" +
80
+ "6f006d00030022007300650072007600" +
81
+ "650072002e0064006f006d0061006900" +
82
+ "6e002e0063006f006d00000000000000" +
83
+ "0000"
84
+ ].pack("H*")
85
+ assert_equal ares, Net::NTLM::ntlmv2_response(
86
+ {
87
+ :ntlmv2_hash => Net::NTLM::ntlmv2_hash(@user, @passwd, @domain),
88
+ :challenge => @challenge,
89
+ :target_info => @trgt_info
90
+ },
91
+ {
92
+ :timestamp => @timestamp,
93
+ :client_challenge => @client_ch
94
+ }
95
+ )
96
+ end
97
+
98
+ def test_ntlm2_session
99
+ acha = ["ffffff001122334400000000000000000000000000000000"].pack("H*")
100
+ ares = ["10d550832d12b2ccb79d5ad1f4eed3df82aca4c3681dd455"].pack("H*")
101
+ session = Net::NTLM::ntlm2_session(
102
+ {
103
+ :ntlm_hash => Net::NTLM::ntlm_hash(@passwd),
104
+ :challenge => @challenge
105
+ },
106
+ { :client_challenge => @client_ch }
107
+ )
108
+ assert_equal acha, session[0]
109
+ assert_equal ares, session[1]
110
+ end
111
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: ntlm-http
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.1
7
+ date: 2009-05-20 00:00:00 +01:00
8
+ summary: Ruby/NTLM HTTP library.
9
+ require_paths:
10
+ - lib
11
+ email: kingsley@mindflowsolutions.com
12
+ homepage: http://www.mindflowsolutions.net
13
+ rubyforge_project: rubyntlm
14
+ description: Ruby/NTLM HTTP provides NTLM authentication over http.
15
+ autorequire: net/ntlm_http
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:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Kohei Kajimoto,Kingsley Hendrickse
31
+ files:
32
+ - ntlm-http-0.1.1.gemspec
33
+ - Rakefile
34
+ - README
35
+ - lib/net/ntlm.rb
36
+ - lib/net/ntlm_http.rb
37
+ - test/function_test.rb
38
+ - examples/http.rb
39
+ - examples/imap.rb
40
+ - examples/smtp.rb
41
+ test_files: []
42
+
43
+ rdoc_options:
44
+ - --main
45
+ - README
46
+ extra_rdoc_files:
47
+ - README
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ requirements: []
53
+
54
+ dependencies: []
55
+