cinch-identify 0.0.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.
- data/LICENSE +19 -0
- data/README.md +51 -0
- data/lib/cinch/plugins/identify.rb +55 -0
- metadata +82 -0
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2011 by Dominik Honnef
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Last seen plugin
|
2
|
+
|
3
|
+
This plugin allows Cinch to automatically identify with services.
|
4
|
+
Currently, QuakeNet and all networks using NickServ are supported.
|
5
|
+
|
6
|
+
For QuakeNet, both the normal _auth_ and the more secure
|
7
|
+
_challengeauth_ commands are supported.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
First install the gem by running:
|
11
|
+
[sudo] gem install cinch-identify
|
12
|
+
|
13
|
+
Then load it in your bot:
|
14
|
+
require "cinch"
|
15
|
+
require "cinch/plugins/identify"
|
16
|
+
|
17
|
+
bot = Cinch::Bot.new do
|
18
|
+
configure do |c|
|
19
|
+
# add all required options here
|
20
|
+
c.plugins.plugins = [Cinch::Plugins::Identify] # optionally add more plugins
|
21
|
+
c.plugins.options[Cinch::Plugins::Identify] = {
|
22
|
+
:username => "my_username",
|
23
|
+
:password => "my secret password",
|
24
|
+
:type => :nickserv,
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
bot.start
|
30
|
+
|
31
|
+
## Commands
|
32
|
+
None.
|
33
|
+
|
34
|
+
## Options
|
35
|
+
### :type
|
36
|
+
The type of authentication. `:nickserv` for NickServ, `:quakenet` for
|
37
|
+
the insecure _auth_ command on QuakeNet and `:secure_quakenet` or
|
38
|
+
`:challengeauth` for the more secure _challengeauth_.
|
39
|
+
|
40
|
+
### :username
|
41
|
+
The username to use for authentication.
|
42
|
+
|
43
|
+
### :password
|
44
|
+
The password to use for authentication
|
45
|
+
|
46
|
+
### Example configuration
|
47
|
+
Check the install instructions for an example configuration.
|
48
|
+
|
49
|
+
## Warning
|
50
|
+
Be warned that, when using the `:nickserv` or `:quakenet` types, the
|
51
|
+
password will show up in the logs.
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "openssl"
|
2
|
+
|
3
|
+
module Cinch
|
4
|
+
module Plugins
|
5
|
+
class Identify
|
6
|
+
include Cinch::Plugin
|
7
|
+
|
8
|
+
listen_to :connect, method: :identify
|
9
|
+
def identify(m)
|
10
|
+
case config[:type]
|
11
|
+
when :quakenet
|
12
|
+
@bot.debug "Identifying with Q"
|
13
|
+
identify_quakenet
|
14
|
+
when :secure_quakenet, :challengeauth
|
15
|
+
@bot.debug "Identifying with Q, using CHALLENGEAUTH"
|
16
|
+
identify_secure_quakenet
|
17
|
+
when :nickserv
|
18
|
+
@bot.debug "Identifying with NickServ"
|
19
|
+
identify_nickserv
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# TODO as soon as Cinch 1.2.0 is released, use match and
|
24
|
+
# react_on instead
|
25
|
+
listen_to :notice, method: :challengeauth
|
26
|
+
def challengeauth(m)
|
27
|
+
return unless m.user && m.user.nick == "Q"
|
28
|
+
if match = m.message.match(/^CHALLENGE (.+?) (.+)$/)
|
29
|
+
challenge = match[1]
|
30
|
+
@bot.debug "Received challenge '#{challenge}'"
|
31
|
+
|
32
|
+
username = config[:username].irc_downcase(:rfc1459)
|
33
|
+
password = config[:password][0,10]
|
34
|
+
|
35
|
+
key = OpenSSL::Digest::SHA256.hexdigest(username + ":" + OpenSSL::Digest::SHA256.hexdigest(password))
|
36
|
+
response = OpenSSL::HMAC.hexdigest("SHA256", key, challenge)
|
37
|
+
User("Q@CServe.quakenet.org").send("CHALLENGEAUTH #{username} #{response} HMAC-SHA-256")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def identify_quakenet
|
43
|
+
User("Q@CServe.quakenet.org").send("auth %s %s" % [config[:username], config[:password]])
|
44
|
+
end
|
45
|
+
|
46
|
+
def identify_secure_quakenet
|
47
|
+
User("Q@CServe.quakenet.org").send("CHALLENGE")
|
48
|
+
end
|
49
|
+
|
50
|
+
def identify_nickserv
|
51
|
+
User("nickserv").send("identify %s %s" % [config[:username], config[:password]])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cinch-identify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Dominik Honnef
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-01-29 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: cinch
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 0
|
31
|
+
version: "1.0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
description: A plugin allowing Cinch bots to automatically identify with services.
|
35
|
+
email:
|
36
|
+
- dominikh@fork-bomb.org
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files: []
|
42
|
+
|
43
|
+
files:
|
44
|
+
- LICENSE
|
45
|
+
- README.md
|
46
|
+
- lib/cinch/plugins/identify.rb
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://rubydoc.info/github/cinchrb/cinch-identify
|
49
|
+
licenses: []
|
50
|
+
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
segments:
|
62
|
+
- 1
|
63
|
+
- 9
|
64
|
+
- 1
|
65
|
+
version: 1.9.1
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
requirements: []
|
75
|
+
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 1.3.7
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: A plugin allowing Cinch bots to automatically identify with services.
|
81
|
+
test_files: []
|
82
|
+
|