pyu-ntlm-http 0.1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{pyu-ntlm-http}
3
+ s.version = "0.1.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.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,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pyu-ntlm-http
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 1
9
+ - 1
10
+ version: 0.1.1.1
11
+ platform: ruby
12
+ authors:
13
+ - Kohei Kajimoto,Kingsley Hendrickse
14
+ autorequire: net/ntlm_http
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2009-05-20 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Ruby/NTLM HTTP provides NTLM authentication over http.
23
+ email: kingsley@mindflowsolutions.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README
30
+ files:
31
+ - ntlm-http.gemspec
32
+ - Rakefile
33
+ - README
34
+ - lib/net/ntlm.rb
35
+ - lib/net/ntlm_http.rb
36
+ - test/function_test.rb
37
+ - examples/http.rb
38
+ - examples/imap.rb
39
+ - examples/smtp.rb
40
+ has_rdoc: true
41
+ homepage: http://www.mindflowsolutions.net
42
+ licenses: []
43
+
44
+ post_install_message:
45
+ rdoc_options:
46
+ - --main
47
+ - README
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ requirements: []
67
+
68
+ rubyforge_project: rubyntlm
69
+ rubygems_version: 1.3.7
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: Ruby/NTLM HTTP library.
73
+ test_files: []
74
+