-
-
Save wellington1993/9b7c167965a869b4b06e to your computer and use it in GitHub Desktop.
Gmail authentication helper for use with Squid proxy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/imap' | |
while true | |
# open connection | |
imap = Net::IMAP.new('imap.googlemail.com', 993, true) | |
# get credentials | |
user, pass = $stdin.readline.split | |
# authenticate | |
begin | |
imap.login(user, pass) | |
puts "OK" | |
rescue Net::IMAP::Error => err | |
puts "ERR" | |
end | |
$stdout.flush | |
imap.disconnect | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment