misoni 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 075a6c5fe791cd08818db2ed6e0e7c8c411223b4
4
+ data.tar.gz: d7b33e7ee1bf3e793f0ca59bc26f0e1d0523efd3
5
+ SHA512:
6
+ metadata.gz: 444de2bf3a3f91205a67416fc0e70ac19b1dc04687b2eb048130f92d3c87ef84757d90cb20e430fde1740fb392bc7c1dd77592b128d2696a0736f42100709591
7
+ data.tar.gz: b59bc78814ddb8a77fe5c3c1fc4da496f257d2d8a6d206304efd5b1678c45ce761dd613798613aae4cca0551e982711156d978dfb65c1cd5c21ab80dd5f9892d
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ vendor/bundle/
11
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in misoni.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Misoni
2
+
3
+ Magical login to the Zokei Network.
4
+
5
+ 「ZOKEIネットワーク接続のための認証が必要です」を二度と見ないことを目的としたプロジェクトです。鯖の味噌煮。
6
+
7
+
8
+ ## Installation
9
+
10
+ ```
11
+ $ git clone https://github.com/noir-neo/misoni
12
+ $ cd misoni
13
+ $ bundle install --path vendor/bundle
14
+ ```
15
+
16
+ あとでちゃんと`gem install`でできるようにします。
17
+
18
+
19
+ ## Configuration
20
+
21
+ ```
22
+ $ bundle exec bin/misoni config
23
+ ```
24
+
25
+ をするとエディタが開くので
26
+
27
+ ```
28
+ id: a学籍番号
29
+ password: パスワード(デフォルトだと生年月日のやつ)
30
+ ```
31
+
32
+ のように編集してください。
33
+
34
+
35
+ ## Usage
36
+
37
+ ```
38
+ $ bundle exec bin/misoni auth
39
+ ```
40
+
41
+ とかするといい感じです。
42
+ `install`コマンドとかで、無線LANへの接続を検知してlaunchdで叩く設定まで勝手にやってくれるようにそのうちします。
43
+
44
+
45
+ ## Kanpa
46
+
47
+ http://www.amazon.co.jp/registry/wishlist/23CDAA2HM4C5B
48
+
49
+ ## License
50
+
51
+ The MIT License (MIT)
52
+
53
+ Copyright (c) 2015 neo
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "misoni"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/exe/misoni ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "misoni"
4
+
5
+ Misoni::CLI.start
data/lib/misoni/cli.rb ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+
3
+ require 'misoni'
4
+ require 'thor'
5
+
6
+ module Misoni
7
+ class CLI < Thor
8
+ package_name "Misoni"
9
+
10
+ desc "config", "setting config"
11
+ def config
12
+ Misoni.getConfig
13
+ end
14
+
15
+ desc "auth", "authorize zokei network"
16
+ def auth
17
+ success = Misoni.auth
18
+ say 'Succeeded', Thor::Shell::Color::GREEN if success
19
+ end
20
+
21
+ desc "version", "Prints the bundler's version information"
22
+ def version
23
+ say "misoni #{Misoni::VERSION}"
24
+ end
25
+ map %w(-v --version) => :version
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ module Misoni
2
+ VERSION = "0.1.3"
3
+ end
data/lib/misoni.rb ADDED
@@ -0,0 +1,43 @@
1
+ require "misoni/version"
2
+ require "misoni/cli"
3
+ require 'rubygems'
4
+ require 'nokogiri'
5
+ require 'mechanize'
6
+ require 'pit'
7
+
8
+ module Misoni
9
+ class Error < StandardError; end
10
+
11
+ def self.getConfig
12
+ Pit.get("http://auth.zokei.ac.jp:16978", :require => { "id"=> "YOUR_UserID", "password"=> "YOUR_PASSWORD" })
13
+ end
14
+
15
+ def self.isSuccess(page)
16
+ body = Nokogiri::HTML(page.body)
17
+ body.css('table tr:nth-child(2) td').each do |child|
18
+ unless child.text.include?("成功")
19
+ raise Misoni::Error.new("authentication failed")
20
+ end
21
+ end
22
+ end
23
+
24
+ def self.auth
25
+ agent = Mechanize.new { |agent|
26
+ agent.user_agent_alias = 'Mac Safari'
27
+ }
28
+
29
+ begin
30
+ agent.get('http://auth.zokei.ac.jp:16978/') do |page|
31
+ login_result = page.form_with(:action => '/cgi-bin/adeflogin.cgi') do |form|
32
+ config = getConfig
33
+ form.field_with(:name => 'name').value = config["id"]
34
+ form.field_with(:name => 'pass').value = config["password"]
35
+ end.submit
36
+ isSuccess(login_result)
37
+ end
38
+ rescue SocketError => e
39
+ puts e.message
40
+ end
41
+ end
42
+
43
+ end
data/misoni.gemspec ADDED
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'misoni/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "misoni"
8
+ spec.version = Misoni::VERSION
9
+ spec.authors = ["neo"]
10
+ spec.email = ["noir.neo.04@gmail.com"]
11
+
12
+ spec.summary = %q{Magical login to the Zokei Network.}
13
+ spec.description = %q{Magical login to the Zokei Network. This was named by Saba no Misoni.}
14
+ spec.homepage = "https://github.com/noir-neo/misoni"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency "thor"
30
+ spec.add_dependency "mechanize"
31
+ spec.add_dependency "pit"
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.10"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: misoni
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - neo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mechanize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ description: Magical login to the Zokei Network. This was named by Saba no Misoni.
84
+ email:
85
+ - noir.neo.04@gmail.com
86
+ executables:
87
+ - misoni
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - README.md
94
+ - Rakefile
95
+ - bin/console
96
+ - bin/setup
97
+ - exe/misoni
98
+ - lib/misoni.rb
99
+ - lib/misoni/cli.rb
100
+ - lib/misoni/version.rb
101
+ - misoni.gemspec
102
+ homepage: https://github.com/noir-neo/misoni
103
+ licenses: []
104
+ metadata:
105
+ allowed_push_host: https://rubygems.org
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.4.8
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Magical login to the Zokei Network.
126
+ test_files: []