Permalink
Browse files

Fixed Rakefile, and filled in most of bin/lawn. 0.0.2 release.

  • Loading branch information...
1 parent acf339c commit 25da4de6fd8f0b61f824191aa9e1c71ae4cf7ba7 @skalnik committed Sep 23, 2008
Showing with 21 additions and 12 deletions.
  1. +2 −2 Rakefile
  2. +19 −7 bin/lawn
  3. +0 −3 lib/lawn-login.rb
View
@@ -1,8 +1,8 @@
require 'rubygems'
require 'hoe'
-require './lib/euler.rb'
+require 'lib/lawn-login.rb'
-Hoe.new('euler', Euler::VERSION) do |p|
+Hoe.new('lawn-login', 0.0.2) do |p|
p.developer('Mike Skalnik', 'mike.skalnik@gmail.com')
p.remote_rdoc_dir = '' # Release to root
p.description = "A small gem which provides a secure method of logging into the GATech LAWN network."
View
@@ -15,27 +15,39 @@ OptionParser.new do |opts|
end
end.parse!
-if !File.exists?("~/.lawn") or app['setup'] # First run or rerun setup.
+file = File.expand_path('~/.lawn')
+
+if !File.exists?(file) or app['setup'] # First run or rerun setup.
info = Hash.new
print "LAWN username? "
- info['username'] = gets.chomp
+ info[:username] = gets.chomp
print "LAWN password? "
unencrypted_password = gets.chomp
print "Encryption password? "
encryption_password = gets.chomp[0..55]
blowfish = Crypt::Blowfish.new(encryption_password)
- info['encrypted_password'] = blowfish.encrypt_block(unencrypted_password)
+ info[:encrypted_password] = blowfish.encrypt_block(unencrypted_password)
unencrypted_password = nil
- File.open(File.expand_path('~/.lawn'), 'w') { |f|
+ File.open(file, 'w') { |f|
f.write(YAML::dump(info))
}
+ puts "OK. Lawn-login is now setup. To login next time, run `lawn <encryption_password>`"
+ exit
+else # File exists, so lets get the info from there!
+ info = YAML.load_file(file)
+end
+
+if ARGV[0].nil?
+ puts "No password given. Please give encryption password."
+ exit
end
-#blowfish = Crypt::Blowfish.new(ARGV[0])
-#password = blowfish.decrypt_block(ENCRYPTED_PASSWORD)
-#puts `curl -s -f -F username=\'#{USERNAME}\' -F password=\'#{password}\' -F iss=\'true\' -F output=\'text\' https://auth.lawn.gatech.edu/index.php`
+blowfish = Crypt::Blowfish.new(ARGV[0])
+PASSWORD = blowfish.decrypt_block(info[:encrypted_password])
+USERNAME = info[:username]
+puts `curl -s -f -F username=\'#{USERNAME}\' -F password=\'#{password}\' -F iss=\'false\' -F output=\'text\' https://auth.lawn.gatech.edu/index.php`
View
@@ -1,3 +0,0 @@
-class Lawn-login
- VERSION = '1.0.0'
-end

0 comments on commit 25da4de

Please sign in to comment.