security - command line interface for OS X's keychain
This looks pretty useful to me.
Via onethingwell and Sirupsen:
A simple [OS X] command line interface which lets you administer keychains, manipulate keys and certificates, and do just about anything the Security framework is capable of from the command line.
For example:
security add-internet-password -a "John Doe" -s foo.com -w pass