misoni 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -9
- data/lib/misoni/cli.rb +33 -1
- data/lib/misoni/templates/com.neoneobeam.misoni.plist.rbenv.tt +25 -0
- data/lib/misoni/templates/com.neoneobeam.misoni.plist.tt +23 -0
- data/lib/misoni/version.rb +1 -1
- data/lib/misoni.rb +10 -6
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c34f0960bf1598a02b537e9a52ea5b6b6ef10dba
|
4
|
+
data.tar.gz: 9e260266a1c621efb36b625125d2a2b6868f78e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4170fd2d5eafa90b6c92bd2dfd9e483afb2b47b459449a1aa0c3ff4c93e74a3d82660e6b9e6094fa868ea40d651311b90c3ea3d072fdb92fe777ff4d6311731d
|
7
|
+
data.tar.gz: 3e44b17254c8ae1362ac4fd453ef47eaa4140ade6d5597c09ee11e21980b55c02af14650b2af614e52260725fc1482042276f9996778398e955e1359d27adda9
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Misoni
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/misoni.svg)](http://badge.fury.io/rb/misoni)
|
4
|
+
|
3
5
|
Magical login to the Zokei Network.
|
4
6
|
|
5
7
|
「ZOKEIネットワーク接続のための認証が必要です」を二度と見ないことを目的としたプロジェクトです。鯖の味噌煮。
|
@@ -8,23 +10,26 @@ Magical login to the Zokei Network.
|
|
8
10
|
## Installation
|
9
11
|
|
10
12
|
```
|
11
|
-
$
|
12
|
-
$ cd misoni
|
13
|
-
$ bundle install --path vendor/bundle
|
13
|
+
$ gem install misoni
|
14
14
|
```
|
15
15
|
|
16
|
-
あとでちゃんと`gem install`でできるようにします。
|
17
|
-
|
18
16
|
|
19
17
|
## Configuration
|
20
18
|
|
21
19
|
```
|
22
|
-
$
|
20
|
+
$ misoni config
|
23
21
|
```
|
24
22
|
|
25
|
-
|
23
|
+
もしくは pit コマンドを直接
|
26
24
|
|
27
25
|
```
|
26
|
+
$ pit set "http://auth.zokei.ac.jp:16978"
|
27
|
+
```
|
28
|
+
|
29
|
+
するとエディタが開くので
|
30
|
+
|
31
|
+
```
|
32
|
+
---
|
28
33
|
id: a学籍番号
|
29
34
|
password: パスワード(デフォルトだと生年月日のやつ)
|
30
35
|
```
|
@@ -32,13 +37,15 @@ password: パスワード(デフォルトだと生年月日のやつ)
|
|
32
37
|
のように編集してください。
|
33
38
|
|
34
39
|
|
40
|
+
|
35
41
|
## Usage
|
36
42
|
|
37
43
|
```
|
38
|
-
$
|
44
|
+
$ misoni auth
|
39
45
|
```
|
40
46
|
|
41
|
-
|
47
|
+
すると設定したアカウントで認証します。
|
48
|
+
|
42
49
|
`install`コマンドとかで、無線LANへの接続を検知してlaunchdで叩く設定まで勝手にやってくれるようにそのうちします。
|
43
50
|
|
44
51
|
|
@@ -51,3 +58,8 @@ http://www.amazon.co.jp/registry/wishlist/23CDAA2HM4C5B
|
|
51
58
|
The MIT License (MIT)
|
52
59
|
|
53
60
|
Copyright (c) 2015 neo
|
61
|
+
|
62
|
+
Portions are:
|
63
|
+
Copyright (c) 2012 MATSUOKA Kohei
|
64
|
+
MIT License
|
65
|
+
https://github.com/machu/wifi_login
|
data/lib/misoni/cli.rb
CHANGED
@@ -5,11 +5,43 @@ require 'thor'
|
|
5
5
|
|
6
6
|
module Misoni
|
7
7
|
class CLI < Thor
|
8
|
+
include Thor::Actions
|
8
9
|
package_name "Misoni"
|
9
10
|
|
11
|
+
# https://github.com/machu/wifi_login/blob/master/lib/wifi_login/cli.rb#L9-L39
|
12
|
+
LAUNCH_AGENT_DIR = "#{ENV['HOME']}/Library/LaunchAgents"
|
13
|
+
LAUNCH_AGENT_FILE = "#{LAUNCH_AGENT_DIR}/com.neoneobeam.misoni.plist"
|
14
|
+
LOG_DIR = "#{ENV['HOME']}/Library/Logs/com.neoneobeam.misoni"
|
15
|
+
|
16
|
+
def self.source_root
|
17
|
+
File.dirname(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "install", "Install trigger. (Only for Mac OS X)"
|
21
|
+
def install
|
22
|
+
empty_directory LOG_DIR
|
23
|
+
if Misoni.in_rbenv?
|
24
|
+
template "templates/com.neoneobeam.misoni.plist.rbenv.tt", "#{LAUNCH_AGENT_FILE}"
|
25
|
+
else
|
26
|
+
template "templates/com.neoneobeam.misoni.plist.tt", "#{LAUNCH_AGENT_FILE}"
|
27
|
+
end
|
28
|
+
run "sudo chmod 600 #{LAUNCH_AGENT_FILE}"
|
29
|
+
run "sudo chown root #{LAUNCH_AGENT_FILE}"
|
30
|
+
run "launchctl load #{LAUNCH_AGENT_FILE}"
|
31
|
+
say
|
32
|
+
say 'Completed install. Please run `misoni config` or `pit set "http://auth.zokei.ac.jp:16978"` to set your ID/Password.', Thor::Shell::Color::GREEN
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "uninstall", "Uninstall trigger."
|
36
|
+
def uninstall
|
37
|
+
run "launchctl unload #{LAUNCH_AGENT_FILE}"
|
38
|
+
return unless File.exist?(LAUNCH_AGENT_FILE)
|
39
|
+
remove_file LAUNCH_AGENT_FILE
|
40
|
+
end
|
41
|
+
|
10
42
|
desc "config", "setting config"
|
11
43
|
def config
|
12
|
-
Misoni.
|
44
|
+
Misoni.config
|
13
45
|
end
|
14
46
|
|
15
47
|
desc "auth", "authorize zokei network"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
|
3
|
+
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
4
|
+
<plist version="1.0">
|
5
|
+
<dict>
|
6
|
+
<key>Label</key>
|
7
|
+
<string>com.neoneobeam.misoni</string>
|
8
|
+
<key>ProgramArguments</key>
|
9
|
+
<array>
|
10
|
+
<string>/bin/bash</string>
|
11
|
+
<string>-c</string>
|
12
|
+
<string>export PATH="$HOME/.rbenv/bin:$PATH"; eval "$(rbenv init -)"; misoni auth</string>
|
13
|
+
</array>
|
14
|
+
<key>RunAtLoad</key>
|
15
|
+
<true/>
|
16
|
+
<key>StandardErrorPath</key>
|
17
|
+
<string><%= ENV['HOME'] %>/Library/Logs/com.neoneobeam.misoni/stderr</string>
|
18
|
+
<key>StandardOutPath</key>
|
19
|
+
<string><%= ENV['HOME'] %>/Library/Logs/com.neoneobeam.misoni/stdout</string>
|
20
|
+
<key>WatchPaths</key>
|
21
|
+
<array>
|
22
|
+
<string>/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist</string>
|
23
|
+
</array>
|
24
|
+
</dict>
|
25
|
+
</plist>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
|
3
|
+
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
4
|
+
<plist version="1.0">
|
5
|
+
<dict>
|
6
|
+
<key>Label</key>
|
7
|
+
<string>com.neoneobeam.misoni</string>
|
8
|
+
<key>ProgramArguments</key>
|
9
|
+
<array>
|
10
|
+
<string>misoni auth</string>
|
11
|
+
</array>
|
12
|
+
<key>RunAtLoad</key>
|
13
|
+
<true/>
|
14
|
+
<key>StandardErrorPath</key>
|
15
|
+
<string><%= ENV['HOME'] %>/Library/Logs/com.neoneobeam.misoni/stderr</string>
|
16
|
+
<key>StandardOutPath</key>
|
17
|
+
<string><%= ENV['HOME'] %>/Library/Logs/com.neoneobeam.misoni/stdout</string>
|
18
|
+
<key>WatchPaths</key>
|
19
|
+
<array>
|
20
|
+
<string>/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist</string>
|
21
|
+
</array>
|
22
|
+
</dict>
|
23
|
+
</plist>
|
data/lib/misoni/version.rb
CHANGED
data/lib/misoni.rb
CHANGED
@@ -8,11 +8,11 @@ require 'pit'
|
|
8
8
|
module Misoni
|
9
9
|
class Error < StandardError; end
|
10
10
|
|
11
|
-
def self.
|
11
|
+
def self.config
|
12
12
|
Pit.get("http://auth.zokei.ac.jp:16978", :require => { "id"=> "YOUR_UserID", "password"=> "YOUR_PASSWORD" })
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.
|
15
|
+
def self.success?(page)
|
16
16
|
body = Nokogiri::HTML(page.body)
|
17
17
|
body.css('table tr:nth-child(2) td').each do |child|
|
18
18
|
unless child.text.include?("成功")
|
@@ -29,15 +29,19 @@ module Misoni
|
|
29
29
|
begin
|
30
30
|
agent.get('http://auth.zokei.ac.jp:16978/') do |page|
|
31
31
|
login_result = page.form_with(:action => '/cgi-bin/adeflogin.cgi') do |form|
|
32
|
-
|
33
|
-
form.field_with(:name => 'name').value =
|
34
|
-
form.field_with(:name => 'pass').value =
|
32
|
+
_config = config
|
33
|
+
form.field_with(:name => 'name').value = _config["id"]
|
34
|
+
form.field_with(:name => 'pass').value = _config["password"]
|
35
35
|
end.submit
|
36
|
-
|
36
|
+
success?(login_result)
|
37
37
|
end
|
38
38
|
rescue SocketError => e
|
39
39
|
puts e.message
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
def self.in_rbenv?
|
44
|
+
ENV.has_key?('RBENV_ROOT')
|
45
|
+
end
|
46
|
+
|
43
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: misoni
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- neo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -97,6 +97,8 @@ files:
|
|
97
97
|
- exe/misoni
|
98
98
|
- lib/misoni.rb
|
99
99
|
- lib/misoni/cli.rb
|
100
|
+
- lib/misoni/templates/com.neoneobeam.misoni.plist.rbenv.tt
|
101
|
+
- lib/misoni/templates/com.neoneobeam.misoni.plist.tt
|
100
102
|
- lib/misoni/version.rb
|
101
103
|
- misoni.gemspec
|
102
104
|
homepage: https://github.com/noir-neo/misoni
|