annoying-wifi 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/annoying-wifi.gemspec +1 -1
- data/bin/annoying-wifi +14 -13
- metadata +1 -1
data/annoying-wifi.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.name = "annoying-wifi"
|
14
|
-
gem.version = "0.0.
|
14
|
+
gem.version = "0.0.3"
|
15
15
|
|
16
16
|
gem.add_dependency "rake"
|
17
17
|
gem.add_dependency "thor"
|
data/bin/annoying-wifi
CHANGED
@@ -5,24 +5,25 @@ require "thor"
|
|
5
5
|
require "yaml"
|
6
6
|
|
7
7
|
class AnnoyingWifi < Thor
|
8
|
-
desc "login", "Logs you in to the wifi"
|
8
|
+
desc "login", "Logs you in to the wifi. `USERNAME=takeoff_XXX PASSWORD=XXX annoying-wifi login`"
|
9
9
|
def login
|
10
|
-
|
10
|
+
while true
|
11
11
|
username = ENV.fetch('USERNAME') { raise "need USERNAME" }
|
12
12
|
password = ENV.fetch('PASSWORD') { raise "need PASSWORD" }
|
13
|
-
|
14
|
-
|
13
|
+
|
14
|
+
say "Attempting login with #{username} / #{"*"*password.length}"
|
15
|
+
req = Curl::Easy.http_post("https://controller.mobile.lan/portal_api.php", "action=authenticate&login=#{username}&password=#{password}")
|
15
16
|
|
16
17
|
puts req.body_str
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
if req.body_str =~ /error/
|
19
|
+
puts "Wrong user name/password"
|
20
|
+
elsif req.body_str =~ /expired/
|
21
|
+
puts "Looks like your username/password expired"
|
22
|
+
else
|
23
|
+
say "Hooray, you are now logged in!"
|
24
|
+
break
|
25
|
+
end
|
26
|
+
end
|
26
27
|
end
|
27
28
|
|
28
29
|
end
|