Skip to content

Instantly share code, notes, and snippets.

@larstobi
Created January 6, 2012 13:00
Show Gist options
  • Select an option

  • Save larstobi/1570505 to your computer and use it in GitHub Desktop.

Select an option

Save larstobi/1570505 to your computer and use it in GitHub Desktop.
Trapeze weblogin autologin
# cat /Users/larstobi/bin/weblogin
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
page = agent.get('http://webportal.login/aaa/wba_login.html')
login_form = page.form('weblogin')
login_form.username = 'MYUSER'
login_form.key = 'MYPASSWD'
agent.submit(login_form, login_form.buttons.first)
# cat /Users/larstobi/Library/LaunchAgents/no.relatime.larstobi.weblogin.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>no.relatime.larstobi.weblogin</string>
<key>ProgramArguments</key>
<array>
<string>/Users/larstobi/bin/weblogin</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Library/Preferences/SystemConfiguration/</string>
</array>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment