"The right way" to do this is to register the handler (i.e your script(s) ) with gconf.
Code:
gconftool-2 -s /desktop/gnome/url-handlers/ssh/command '/path/to/app %s' --type String
gconftool-2 -s /desktop/gnome/url-handlers/ssh/enabled --type Boolean true
gconftool-2 -s /desktop/gnome/url-handlers/ssh/needs_terminal --type Boolean true
gconftool-2 -s /desktop/gnome/url-handlers/telnet/command '/path/to/app %s' --type String
gconftool-2 -s /desktop/gnome/url-handlers/telnet/enabled --type Boolean true
gconftool-2 -s /desktop/gnome/url-handlers/telnet/needs_terminal --type Boolean true